IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 23, 2021, 1:48:37 PM (5 years ago)
Author:
eugene
Message:

add hooks to load pattern row amplitudes from an external file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageDetrendPattern.c

    r41807 r41857  
    3131    // CELLS in the format:CHIPS metadata table)
    3232
     33    // New 2021 October : During ppImageParseCamera, we have loaded a file identified by
     34    // PPIMAGE.PATTERN.ROW.AMP on config->files.  This file contains a collection of FITS
     35    // tables, one per chip.  Each table lists the typical bias-drift amplitude for cell,
     36    // measured from a collection of dark images.  These values are passed (via
     37    // cell->analysis) to pmPatternRow which choosed to apply the correction based on the
     38    // ratio of the poisson noise due to the median background (+ read noise) and the
     39    // typical amplitude.  Tests show that if the amplitude / noise < 1/6, then the
     40    // row-by-row variations are insignificant.
     41
    3342    // We also check the chip header for the boolean 'PTRN_ROW' : if this is true, we have
    3443    // already applied this correct to this data, so we simply skip the correction for this
     
    5362        pmFPAfile *input = psMetadataLookupPtr(&status, config->files, "PPIMAGE.INPUT");
    5463
     64        // grab the KH correction file
     65        pmFPAfile *PRAfile = psMetadataLookupPtr (NULL, config->files, "PPIMAGE.PATTERN.ROW.AMP");
     66        if (!PRAfile) {
     67          psLogMsg("ppImage", PS_LOG_INFO, "Pattern Row Amplitude file not found, applying to all (with limits from ROW.SUBSET) ");
     68        }
     69       
    5570        pmFPAview *view = pmFPAviewAlloc(0); // View for local processing
    5671        *view = *inputView;
     
    7590                continue;
    7691            }
     92
     93            // grab the corresponding cell
     94            if (PRAfile) {
     95              pmCell *PRAcell = pmFPAviewThisCell (view, PRAfile->fpa);
     96              psAssert (PRAcell, "found Pattern Row Amplitude file, but not cell?");
     97
     98              // find the nominal signal amplitude (check the ghost and/or crosstalk recipe file)
     99              float amplitude = psMetadataLookupF32 (&status, PRAcell->analysis, "PTN.ROW.AMP");
     100              if (!status) amplitude = NAN;
     101           
     102              // put the value on the science cell
     103              psMetadataAddF32 (cell->analysis, PS_LIST_TAIL, "PTN.ROW.AMP", PS_META_REPLACE, "", amplitude);
     104            }
    77105
    78106            bool doPattern = false;
     
    280308bool ppImageDetrendPatternApplyCell (pmConfig *config, pmFPA *fpa, pmChip *chip, pmCell *cell, pmFPAview *view, ppImageOptions *options) {
    281309 
    282     // A very detailed log message.
    283     const char *chipName = psMetadataLookupStr(NULL, chip->concepts, "CHIP.NAME");
    284     const char *cellName = psMetadataLookupStr(NULL, cell->concepts, "CELL.NAME");
    285     psLogMsg("ppImage", PS_LOG_INFO, "Performing row pattern correction for %s, %s\n", chipName, cellName);
    286 
    287310    // process each of the readouts
    288311    pmReadout *readout;         // Readout from cell
Note: See TracChangeset for help on using the changeset viewer.