IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30835


Ignore:
Timestamp:
Mar 9, 2011, 11:57:26 AM (15 years ago)
Author:
watersc1
Message:

prevent multiple applications of PATTERN.ROW and PATTERN.CELL

File:
1 edited

Legend:

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

    r30831 r30835  
    2525    if (options->doPatternRow) {
    2626        bool status;
    27         pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT");
    28         pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
    29         *view = *inputView;
    30         while ((cell = pmFPAviewNextCell(view, input->fpa, 1)) != NULL) {
     27        pmHDU *hdu = pmHDUFromChip(chip);
     28        if (psMetadataLookupBool(NULL,hdu->header,"PTRN_ROW")) {
     29          psLogMsg("ppImage", PS_LOG_INFO, "Not performing row pattern correction as it has already been done.");
     30        }
     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) {
    3136            if (!cell->process || !cell->file_exists) {
    32                 continue;
     37              continue;
    3338            }
    3439            if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
    3540              ESCAPE(false, "load failure for Cell");
    3641            }
    37 
     42           
    3843            if (!cell->data_exists) {
    3944                continue;
     
    7479                }
    7580            }
    76         }
    77         psFree(view);
     81
     82          }
     83          psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_ROW",PS_META_REPLACE,"PATTERN.ROW correction applied",true);
     84          psFree(view);
     85        }
    7886    }
    7987
     
    8391        pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
    8492        *view = *inputView;
    85         for (int i = 0; i < chip->cells->n; i++) {
     93
     94        pmHDU *hdu = pmHDUFromCell(cell);
     95        if (psMetadataLookupBool(NULL,hdu->header,"PTRN_CEL")) {
     96          psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell pattern correction as it has already been done.");
     97        }
     98        else {
     99          for (int i = 0; i < chip->cells->n; i++) {
    86100            view->cell = i;
    87101
    88102            pmCell *cell = chip->cells->data[i]; // Cell of interest
     103
    89104            if (cell->readouts->n > 1) {
    90105                psLogMsg("ppImage", PS_LOG_INFO, "Not performing cell pattern correction on video cell.");
     
    99114                tweak->data.U8[i] = 0xFF;
    100115            }
    101         }
    102116
    103         // Tweak the cells
    104         if (!pmPatternCell(chip, tweak, options->patternCellBG, options->patternCellMean,
    105                            options->maskValue, options->darkMask)) {
    106             psFree(tweak);
    107             psFree(view);
    108             return false;
    109         }
    110         psFree(tweak);
    111         psFree(view);
     117          }
     118
     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);
     128
     129          psMetadataAddBool(hdu->header, PS_LIST_TAIL, "PTRN_CEL",PS_META_REPLACE,"PATTERN.CELL correction applied",true);
     130        }
    112131    }
    113132
Note: See TracChangeset for help on using the changeset viewer.