IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 42964


Ignore:
Timestamp:
Mar 9, 2026, 11:06:00 AM (2 months ago)
Author:
eugene
Message:

if CELL.SATURATION concept is not found or is NAN, check for SATURATION.OVERRIDE and use that value is not NAN

File:
1 edited

Legend:

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

    r42890 r42964  
    2424    pmReadout *input = pmFPAfileThisReadout(config->files, view, "PPIMAGE.INPUT");
    2525
    26     // Check that the gain is set (this is used by both pmReadoutGenerateMask and pmReadoutGenerateVariance)
     26    // Check that the GAIN is set (this is used by both pmReadoutGenerateMask and pmReadoutGenerateVariance)
    2727    {
    28       float gain = psMetadataLookupF32(NULL, input->parent->concepts, "CELL.GAIN"); // Gain for cell
    29       if (!isfinite(gain)) {
     28      bool mdok = true; // Status of MD lookup
     29      float gain = psMetadataLookupF32(&mdok, input->parent->concepts, "CELL.GAIN"); // Gain for cell
     30      if (!mdok || !isfinite(gain)) {
    3031        psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, RECIPE_NAME); // Recipe
    3132        psAssert(recipe, "Should be there!");
     
    4445      }
    4546    }
    46     // psLogMsg ("ppImage", 6, "check gain: %f sec\n", psTimerMark ("detrend.readout"));
     47
     48    // Check that the SATURATION is set (this is used by pmReadoutSetMask)
     49    // NOTE: here we use the value of SATURATION.OVERRIDE as a signal : NAN means do not override
     50    {
     51      bool mdok = true; // Status of MD lookup
     52      float saturation = psMetadataLookupF32(&mdok, input->parent->concepts, "CELL.SATURATION"); // Saturation for cell
     53      if (!mdok || !isfinite(saturation)) {
     54        psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, RECIPE_NAME); // Recipe
     55        psAssert(recipe, "Should be there!");
     56        float override = psMetadataLookupF32(NULL, recipe, "SATURATION.OVERRIDE"); // Override the bad saturation?
     57        if (isfinite(override)) {
     58          psMetadataItem *item = psMetadataLookup(input->parent->concepts, "CELL.SATURATION"); // Saturation item
     59          psAssert(item, "Should be there!");
     60          item->data.F32 = override;
     61          psWarning("CELL.SATURATION is not set for readout (%d,%d,%d) --- setting to %f.", view->chip, view->cell, view->readout, override);
     62        } else {
     63          psWarning("CELL.SATURATION is NAN for readout (%d,%d,%d), image will be masked.", view->chip, view->cell, view->readout);
     64        }
     65      }
     66    }
    4767
    4868    // Check to see if we're in a chip that contains video
Note: See TracChangeset for help on using the changeset viewer.