IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31066


Ignore:
Timestamp:
Mar 27, 2011, 12:08:17 PM (15 years ago)
Author:
eugene
Message:

cleaned up some of the commented out PATTERN.* code; added clarifying comments regarding recipe / format rules for PATTERN.*

Location:
trunk/ppImage/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageDetrendPattern.c

    r30860 r31066  
    2323    assert(inputView->readout == -1);
    2424
     25    // PATTERN.ROW is selected by the recipe.  If it is selected, we search for the table
     26    // PATTERN.ROW.SUBSET.  If this is found in our format file, we use that version;
     27    // otherwise, we use the table provided in the recipe file "ppImage.config".  Within that
     28    // table, we select the entry that matches our CHIP.NAME.  This will be either a boolean or
     29    // a string of bits.  If it is a boolean, it specified whether or not to correct the entire
     30    // chip; if it is a string, the bits specify which cells to correct (sequence is order of
     31    // CELLS in the format:CHIPS metadata table)
     32
     33    // We also check the chip header for the boolean 'PTRN_ROW' : if this is true, we have
     34    // already applied this correct to this data, so we simply skip the correction for this
     35    // chip.
     36
    2537    if (options->doPatternRow) {
    2638        bool status;
     
    2840        if (psMetadataLookupBool(NULL,hdu->header,"PTRN_ROW")) {
    2941          psLogMsg("ppImage", PS_LOG_INFO, "Not performing row pattern correction as it has already been done.");
     42          goto pattern_cell;
    3043        }
    31         else {
    32           pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT");
    33           pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
    34           *view = *inputView;
    35           while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) {
     44
     45        pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT");
     46        pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
     47        *view = *inputView;
     48        while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) {
    3649            if (!cell->process || !cell->file_exists) {
    37               continue;
     50                continue;
    3851            }
    3952            if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    40               ESCAPE(false, "load failure for Cell");
     53                ESCAPE(false, "load failure for Cell");
    4154            }
    4255           
     
    5669            if (!doPattern) continue;
    5770
     71            // A very detailed log message.
    5872            const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME");
    5973            const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME");
    60             psLogMsg("ppImage", PS_LOG_INFO, "Performing row pattern correction for %s, %s\n",
    61                      chipName, cellName);
     74            psLogMsg("ppImage", PS_LOG_INFO, "Performing row pattern correction for %s, %s\n", chipName, cellName);
    6275
    6376            // process each of the readouts
     
    8093            }
    8194
    82           }
    83           psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_ROW",PS_META_REPLACE,"PATTERN.ROW correction applied",true);
    84           psFree(view);
    8595        }
     96        psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_ROW",PS_META_REPLACE,"PATTERN.ROW correction applied",true);
     97        psFree(view);
    8698    }
     99
     100 pattern_cell:
     101
     102    // see the comment for PATTERN.ROW; the same rules apply for PATTERN.CELL
    87103
    88104    if (options->doPatternCell) {
     
    95111        if (psMetadataLookupBool(NULL,hdu->header,"PTRN_CEL")) {
    96112          psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell pattern correction as it has already been done.");
     113          goto pattern_done;
    97114        }
    98         else {
    99           for (int i = 0; i < chip->cells->n; i++) {
     115
     116        for (int i = 0; i < chip->cells->n; i++) {
    100117            view->cell = i;
    101118
     
    115132            }
    116133
    117           }
     134        }
    118135
    119           // Tweak the cells
    120           if (!pmPatternCell(chip, tweak, options->patternCellBG, options->patternCellMean,
    121                              options->maskValue, options->darkMask)) {
    122               psFree(tweak);
    123               psFree(view);
    124               return false;
    125           }
    126           psFree(tweak);
    127           psFree(view);
     136        // Tweak the cells
     137        if (!pmPatternCell(chip, tweak, options->patternCellBG, options->patternCellMean,
     138                           options->maskValue, options->darkMask)) {
     139            psFree(tweak);
     140            psFree(view);
     141            return false;
     142        }
     143        psFree(tweak);
     144        psFree(view);
    128145
    129           psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_CEL",PS_META_REPLACE,"PATTERN.CELL correction applied",true);
    130         }
     146        psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_CEL",PS_META_REPLACE,"PATTERN.CELL correction applied",true);
    131147    }
    132148
     149 pattern_done:
    133150    return(true);
    134151}
  • trunk/ppImage/src/ppImageOptions.c

    r30878 r31066  
    239239    options->doShutter = psMetadataLookupBool(NULL, recipe, "SHUTTER");
    240240
    241     // Look for pattern correction options in the camera format. If not found, look in the recipe.
    242 /*     if (psMetadataLookup(format, "PATTERN.ROW")) { */
    243 /*       options->doPatternRow = psMetadataLookupBool(NULL, format, "PATTERN.ROW"); */
    244 /*     } */
    245 /*     else { */
     241    // PATTERN.ROW is selected by the recipe.  If it is selected, we search for the table
     242    // PATTERN.ROW.SUBSET.  If this is found in our format file, we use that version;
     243    // otherwise, we use the table provided in the recipe file "ppImage.config".  Within that
     244    // table, we select the entry that matches our CHIP.NAME.  This will be either a boolean or
     245    // a string of bits.  If it is a boolean, it specified whether or not to correct the entire
     246    // chip; if it is a string, the bits specify which cells to correct (sequence is order of
     247    // CELLS in the format:CHIPS metadata table)
     248
     249    // We also check the chip header for the boolean 'PTRN_ROW' : if this is true, we have
     250    // already applied this correct to this data, so we simply skip the correction for this
     251    // chip.
     252
    246253    options->doPatternRow = psMetadataLookupBool(NULL, recipe, "PATTERN.ROW");
    247 /*     } */
    248 /*     if (psMetadataLookup(format, "PATTERN.CELL")) { */
    249 /*       options->doPatternCell = psMetadataLookupBool(NULL, format, "PATTERN.CELL"); */
    250 /*     } */
    251 /*     else { */
    252254    options->doPatternCell = psMetadataLookupBool(NULL, recipe, "PATTERN.CELL");
    253 /*     } */
     255
    254256    options->doMaskStats = psMetadataLookupBool(NULL, recipe, "MASK.STATS");
    255257    options->addNoise = psMetadataLookupBool(NULL, recipe, "ADDNOISE");
Note: See TracChangeset for help on using the changeset viewer.