IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6079


Ignore:
Timestamp:
Jan 19, 2006, 11:44:37 PM (21 years ago)
Author:
Paul Price
Message:

Changed the way things are loaded

Location:
trunk/ppImage/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/Makefile.am

    r6064 r6079  
    1212        ppImage.c \
    1313        ppImageConfig.c \
    14         ppImageLoadPixels.c \
    1514        ppImageLoop.c \
    1615        ppImageOptions.c \
     
    2019        ppImageOutput.c \
    2120        ppImagePhot.c
     21#       ppImageLoadPixels.c
    2222#       ppDetrendFlat.c
    2323#       ppImageOutput.c
  • trunk/ppImage/src/ppImageDetrendCell.c

    r6064 r6079  
    33
    44// mask, bias, dark, flat are defined per Cell
    5 // pedestal is constructed for each readout, which may have different exposure times
    65
    76pmReadout *ppDetrendSelectFirst(pmCell *cell, char *name, bool doThis)
     
    2322bool ppDetrendCell(ppDetrend *detrend, ppOptions *options, ppConfig *config)
    2423{
    25 
    2624    pmCellSetWeights(detrend->input);
    2725
     
    3028    pmReadout *dark = ppDetrendSelectFirst(detrend->dark, "dark", options->doDark);
    3129    pmReadout *flat = ppDetrendSelectFirst(detrend->flat, "flat", options->doFlat);
     30
     31#if 0
     32    printf("Flat type: %x\n", flat->image->type.type);
     33    printf("Flat value: %f\n", flat->image->data.F32[flat->image->numRows/2][flat->image->numCols/2]);
     34#endif
    3235
    3336    // Dark time for dark image
  • trunk/ppImage/src/ppImageLoadPixels.c

    r5976 r6079  
    1414
    1515    psTrace(__func__, 1, "Loading %d,%d for %s\n", chipNum, cellNum, input->filename);
     16
     17    pmFPA *fpa = input->fpa;            // The entire focal plane array
     18    psArray *chips = fpa->chips;        // The array of chips
     19    if (chipNum >= 0 && chipNum < chips->n) {
     20        loadCells(chips->data[chipNum]);
     21        if (! chip->exists && chip->process) {
     22            loadCells(chip, cellNum);
     23        }
     24    } else {
     25        for (int i = 0; i < chips->n; i++) {
     26            pmChip *chip = chips->data[i];
     27        }
    1628
    1729    // set input:valid flags according to process and chipNum/cellNum
  • trunk/ppImage/src/ppImageLoop.c

    r5976 r6079  
    11# include "ppImage.h"
     2
     3// Read the entire FPA
     4void readFPA(ppFile *file,              // File to read
     5             ppConfig *config           // Configuration, containing the DB handle
     6    )
     7{
     8    if (file->fpa && file->fits) {
     9        if (! pmFPARead(file->fpa, file->fits, file->phu, config->database)) {
     10            psErrorStackPrint(stderr, "Unable to populate camera from input FITS file\n");
     11            exit(EXIT_FAILURE);
     12        }
     13    }
     14}
     15
     16// Read a specified chip only
     17void readChip(ppFile *file,             // File to read
     18              ppConfig *config,         // Configuration
     19              int chipNum               // Chip number to read
     20    )
     21{
     22    pmFPASelectChip(file->fpa, chipNum);
     23    readFPA(file, config);
     24}
     25
     26
     27void readCell(ppFile *file, ppConfig *config, int chipNum, int cellNum)
     28{
     29    pmChip *chip = file->fpa->chips->data[chipNum];
     30    pmChipSelectCell(chip, cellNum);
     31    readFPA(file, config);
     32}
     33
    234
    335bool ppImageLoop(ppData *data, ppOptions *options, ppConfig *config)
     
    537    ppDetrend detrend;
    638
    7     if (options->imageLoadDepth == PP_LOAD_FPA) {
     39    int processChip = psMetadataLookupS32(NULL, config->arguments, "-chip"); // Chip number to process or -1
     40
     41    // Load at FPA level if requested
     42    if (processChip < 0 && options->imageLoadDepth == PP_LOAD_FPA) {
    843        psTrace(__func__, 1, "Loading pixels for FPA...\n");
    9         ppImageLoadPixels(data->input, config->database, -1, -1);
    10         ppImageLoadPixels(data->bias,  config->database, -1, -1);
    11         ppImageLoadPixels(data->dark,  config->database, -1, -1);
    12         ppImageLoadPixels(data->mask,  config->database, -1, -1);
    13         ppImageLoadPixels(data->flat,  config->database, -1, -1);
     44        readFPA(data->input, config);
     45        readFPA(data->bias,  config);
     46        readFPA(data->dark,  config);
     47        readFPA(data->mask,  config);
     48        readFPA(data->flat,  config);
    1449    }
    1550
    16     for (int i = 0; i < data->input->fpa->chips->n; i++) {
    17         pmChip *inputChip = data->input->fpa->chips->data[i]; // Chip of interest in input image
    18         pmChip *biasChip  = data->bias->fpa->chips->data[i];  // Chip of interest in bias image
    19         pmChip *darkChip  = data->dark->fpa->chips->data[i];  // Chip of interest in dark image
    20         pmChip *maskChip  = data->mask->fpa->chips->data[i];  // Chip of interest in mask image
    21         pmChip *flatChip  = data->flat->fpa->chips->data[i];  // Chip of interest in flat image
    22 
    23         printf("Chip %d: %x %x\n", i, inputChip->exists, inputChip->process);
    24         if (! inputChip->process) { continue; }
    25 
     51    psArray *chips = data->input->fpa->chips; // Component chips
     52    for (int i = 0; i < chips->n; i++) {
     53        if (processChip >= 0 && i != processChip) {
     54            continue;
     55        }
    2656        if (options->imageLoadDepth == PP_LOAD_CHIP) {
    2757            psTrace(__func__, 1, "Loading pixels for chip %d...\n", i);
    28             ppImageLoadPixels(data->input, config->database, i, -1);
    29             ppImageLoadPixels(data->bias,  config->database, i, -1);
    30             ppImageLoadPixels(data->dark,  config->database, i, -1);
    31             ppImageLoadPixels(data->mask,  config->database, i, -1);
    32             ppImageLoadPixels(data->flat,  config->database, i, -1);
     58            readChip(data->input, config, i);
     59            readChip(data->bias,  config, i);
     60            readChip(data->dark,  config, i);
     61            readChip(data->mask,  config, i);
     62            readChip(data->flat,  config, i);
    3363        }
    3464
    35         for (int j = 0; j < inputChip->cells->n; j++) {
     65        pmChip *inputChip = chips->data[i];
     66        pmChip *biasChip  = data->bias->fpa->chips->data[i];
     67        pmChip *darkChip  = data->dark->fpa->chips->data[i];
     68        pmChip *maskChip  = data->mask->fpa->chips->data[i];
     69        pmChip *flatChip  = data->flat->fpa->chips->data[i];
     70
     71        psArray *cells = inputChip->cells;
     72        for (int j = 0; j < cells->n; j++) {
    3673            detrend.input = inputChip->cells->data[j]; // Cell of interest in input image
    3774            detrend.bias  = biasChip->cells->data[j];  // Cell of interest in bias image
     
    4077            detrend.flat  = flatChip->cells->data[j];  // Cell of interest in flat image
    4178
    42             printf ("\tCell %d: %x %x\n", j, detrend.input->exists, detrend.input->process);
    4379            if (! detrend.input->process) { continue; }
    4480
    4581            if (options->imageLoadDepth == PP_LOAD_CELL) {
    4682                psTrace(__func__, 1, "Loading pixels for chip %d, cell %d...\n", i, j);
    47                 ppImageLoadPixels(data->input, config->database, i, j);
    48                 ppImageLoadPixels(data->bias,  config->database, i, j);
    49                 ppImageLoadPixels(data->dark,  config->database, i, j);
    50                 ppImageLoadPixels(data->mask,  config->database, i, j);
    51                 ppImageLoadPixels(data->flat,  config->database, i, j);
     83                readCell(data->input, config, i, j);
     84                readCell(data->bias,  config, i, j);
     85                readCell(data->dark,  config, i, j);
     86                readCell(data->mask,  config, i, j);
     87                readCell(data->flat,  config, i, j);
    5288            }
    5389
    54             ppDetrendCell (&detrend, options, config);
     90            ppDetrendCell(&detrend, options, config);
    5591        }
    5692    }
Note: See TracChangeset for help on using the changeset viewer.