IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26644


Ignore:
Timestamp:
Jan 20, 2010, 2:21:07 PM (16 years ago)
Author:
eugene
Message:

moved the GAIN check to come before the call to pmReadoutGenerateMask

File:
1 edited

Legend:

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

    r26629 r26644  
    1414    // find the currently selected readout
    1515    pmReadout *input = pmFPAfileThisReadout(config->files, view, "PPIMAGE.INPUT");
     16
     17    // Check that the gain is set (this is used by both pmReadoutGenerateMask and pmReadoutGenerateVariance)
     18    {
     19      float gain = psMetadataLookupF32(NULL, input->parent->concepts, "CELL.GAIN"); // Gain for cell
     20      if (!isfinite(gain)) {
     21        psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, RECIPE_NAME); // Recipe
     22        psAssert(recipe, "Should be there!");
     23        bool override = psMetadataLookupBool(NULL, recipe, "GAIN.OVERRIDE"); // Override the bad gain?
     24        if (override) {
     25          psWarning("CELL.GAIN is not set for readout (%d,%d,%d) --- setting to unity.", view->chip, view->cell, view->readout);
     26          psMetadataItem *item = psMetadataLookup(input->parent->concepts, "CELL.GAIN"); // Gain item
     27          psAssert(item, "Should be there!");
     28          item->data.F32 = 1.0;
     29        } else {
     30          psWarning("CELL.GAIN is NAN for readout (%d,%d,%d), image will be masked.", view->chip, view->cell, view->readout);
     31        }
     32      }
     33    }
    1634
    1735    // Masking on the basis of pixel value needs to be done before anything else, so the values are pristine.
     
    90108        }
    91109
    92         // Check that the gain is set
    93         float gain = psMetadataLookupF32(NULL, input->parent->concepts, "CELL.GAIN"); // Gain for cell
    94         if (!isfinite(gain)) {
    95             psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, RECIPE_NAME); // Recipe
    96             psAssert(recipe, "Should be there!");
    97             bool override = psMetadataLookupBool(NULL, recipe, "GAIN.OVERRIDE"); // Override the bad gain?
    98             if (override) {
    99                 psWarning("CELL.GAIN is not set for readout (%d,%d,%d) --- setting to unity.",
    100                           view->chip, view->cell, view->readout);
    101                 psMetadataItem *item = psMetadataLookup(input->parent->concepts, "CELL.GAIN"); // Gain item
    102                 psAssert(item, "Should be there!");
    103                 item->data.F32 = 1.0;
    104             } else {
    105                 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "CELL.GAIN is not set for readout (%d,%d,%d)",
    106                         view->chip, view->cell, view->readout);
    107                 return false;
    108             }
    109         }
    110 
    111110        pmReadoutGenerateVariance(input, noiseImage, true);
    112111        psFree (noiseImage);
Note: See TracChangeset for help on using the changeset viewer.