IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 1, 2008, 11:42:41 AM (17 years ago)
Author:
Paul Price
Message:

Don't destroy information in pixels that are masked --- just subtract the background.

File:
1 edited

Legend:

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

    r20772 r20863  
    7575    pmFPAfile *modelFile = psMetadataLookupPtr(&status, config->files, "PSPHOT.BACKMDL"); // Background model
    7676    if (modelFile) {
    77         modelRO = pmFPAviewThisReadout(&roView, modelFile->fpa); // Background model
     77        modelRO = pmFPAviewThisReadout(&roView, modelFile->fpa); // Background model
    7878    }
    7979
     
    8484            return false;
    8585        }
    86         // the model file should now at least be defined
    87         modelFile = psMetadataLookupPtr(&status, config->files, "PSPHOT.BACKMDL"); // Background model
    88         if (!modelFile) {
     86        // the model file should now at least be defined
     87        modelFile = psMetadataLookupPtr(&status, config->files, "PSPHOT.BACKMDL"); // Background model
     88        if (!modelFile) {
    8989            psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to define background model I/O file");
    9090            return false;
    9191        }
    92         // now grab the readout from the correct location:
     92        // now grab the readout from the correct location:
    9393        if (modelFile->mode == PM_FPA_MODE_INTERNAL) {
    94             modelRO = modelFile->readout;
    95         } else {
    96             modelRO = pmFPAviewThisReadout(&roView, modelFile->fpa);
    97         }       
    98         if (!modelRO) {
     94            modelRO = modelFile->readout;
     95        } else {
     96            modelRO = pmFPAviewThisReadout(&roView, modelFile->fpa);
     97        }
     98        if (!modelRO) {
    9999            psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find background model");
    100100            return false;
     
    103103    psImageBinning *binning = psMetadataLookupPtr(&status, psphotRecipe, "PSPHOT.BACKGROUND.BINNING"); // Binning for model
    104104    if (!binning) {
    105         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find background binning");
    106         return false;
     105        psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find background binning");
     106        return false;
    107107    }
    108108
     
    143143    for (int y = 0; y < numRows; y++) {
    144144        for (int x = 0; x < numCols; x++) {
    145             if (mask && mask->data.PS_TYPE_MASK_DATA[y][x] & maskVal) {
    146                 image->data.F32[y][x] = 0.0;
     145            float value = backData[y][x];
     146            if (!isfinite(value)) {
     147                image->data.F32[y][x] = NAN;
     148                mask->data.PS_TYPE_MASK_DATA[y][x] |= options->badMask;
    147149            } else {
    148                 float value = backData[y][x];
    149                 if (!isfinite(value)) {
    150                     image->data.F32[y][x] = NAN;
    151                     mask->data.PS_TYPE_MASK_DATA[y][x] |= options->badMask;
    152                 } else {
    153                     image->data.F32[y][x] -= value;
    154                 }
     150                image->data.F32[y][x] -= value;
    155151            }
    156152        }
     
    175171    }
    176172# endif
    177    
     173
    178174    // XXX should these really be here?? (probably not...)
    179     // pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL"); 
     175    // pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL");
    180176    // pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL.STDEV");
    181177
Note: See TracChangeset for help on using the changeset viewer.