Changeset 20863
- Timestamp:
- Dec 1, 2008, 11:42:41 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/ppImage/src/ppImageReplaceBackground.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ppImage/src/ppImageReplaceBackground.c
r20772 r20863 75 75 pmFPAfile *modelFile = psMetadataLookupPtr(&status, config->files, "PSPHOT.BACKMDL"); // Background model 76 76 if (modelFile) { 77 modelRO = pmFPAviewThisReadout(&roView, modelFile->fpa); // Background model77 modelRO = pmFPAviewThisReadout(&roView, modelFile->fpa); // Background model 78 78 } 79 79 … … 84 84 return false; 85 85 } 86 // the model file should now at least be defined87 modelFile = psMetadataLookupPtr(&status, config->files, "PSPHOT.BACKMDL"); // Background model88 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) { 89 89 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to define background model I/O file"); 90 90 return false; 91 91 } 92 // now grab the readout from the correct location:92 // now grab the readout from the correct location: 93 93 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) { 99 99 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find background model"); 100 100 return false; … … 103 103 psImageBinning *binning = psMetadataLookupPtr(&status, psphotRecipe, "PSPHOT.BACKGROUND.BINNING"); // Binning for model 104 104 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; 107 107 } 108 108 … … 143 143 for (int y = 0; y < numRows; y++) { 144 144 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; 147 149 } 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; 155 151 } 156 152 } … … 175 171 } 176 172 # endif 177 173 178 174 // XXX should these really be here?? (probably not...) 179 // pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL"); 175 // pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL"); 180 176 // pmFPAfileDropInternal(config->files, "PSPHOT.BACKMDL.STDEV"); 181 177
Note:
See TracChangeset
for help on using the changeset viewer.
