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

Location:
branches/eam_branches/ipp-dev-20210817/ppImage/src
Files:
3 edited

Legend:

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

    r35685 r41857  
    116116    pmConfigFileSetsMD (config->arguments, &argc, argv, "FRINGE", "-fringe", "-fringelist");
    117117    pmConfigFileSetsMD (config->arguments, &argc, argv, "LINEARITY", "-linearity", "-linearlist");
     118    pmConfigFileSetsMD (config->arguments, &argc, argv, "PATTERN.ROW.AMP", "-pattern-row-amplitude", "-not-defined");
    118119
    119120    if ((argnum = psArgumentGet(argc, argv, "-burntool"))) {
  • 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
  • branches/eam_branches/ipp-dev-20210817/ppImage/src/ppImageParseCamera.c

    r41812 r41857  
    181181            psError (PS_ERR_IO, false, "Can't find a fringe image source");
    182182            return NULL;
     183        }
     184    }
     185
     186    if (options->doPatternRow) {
     187        if (!ppImageDefineFile(config, input->fpa, "PPIMAGE.PATTERN.ROW.AMP", "PATTERN.ROW.AMP",
     188                               PM_FPA_FILE_PATTERN_ROW_AMP, PM_DETREND_TYPE_PATTERN_ROW_AMP)) {
     189            psWarning ("Can't find a pattern row amplitude source, will apply to all cells or defined subset");
     190            // an empty or invalid file may have been generated -- we want to skip, not raise an error
     191            pmFPAfile *PRAfile = psMetadataLookupPtr (NULL, config->files, "PPIMAGE.PATTERN.ROW.AMP");
     192            if (PRAfile) {
     193              PRAfile->state |= PM_FPA_STATE_INACTIVE;
     194            }
    183195        }
    184196    }
Note: See TracChangeset for help on using the changeset viewer.