Changeset 24767
- Timestamp:
- Jul 12, 2009, 12:50:36 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAMaskWeight.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAMaskWeight.c
r24483 r24767 109 109 float saturation = psMetadataLookupF32(&mdok, cell->concepts, "CELL.SATURATION"); // Saturation level 110 110 if (!mdok || isnan(saturation)) { 111 psError(PS_ERR_IO, true, "CELL.SATURATION is not set --- unable to set mask.\n"); 112 return false; 111 // psError(PS_ERR_IO, true, "CELL.SATURATION is not set --- unable to set mask.\n"); 112 // return false; 113 psWarning("CELL.SATURATION is not set --- completely masking cell.\n"); 114 saturation = NAN; 113 115 } 114 116 float bad = psMetadataLookupF32(&mdok, cell->concepts, "CELL.BAD"); // Bad level 115 117 if (!mdok || isnan(bad)) { 116 psError(PS_ERR_IO, true, "CELL.BAD is not set --- unable to set mask.\n"); 117 return false; 118 // psError(PS_ERR_IO, true, "CELL.BAD is not set --- unable to set mask.\n"); 119 // return false; 120 psWarning("CELL.BAD is not set --- completely masking cell.\n"); 121 bad = NAN; 118 122 } 119 123 psTrace("psModules.camera", 5, "Saturation: %f, bad: %f\n", saturation, bad); 120 124 125 // if CELL.GAIN or CELL.READNOISE are not set, then the variance will be set to NAN; 126 // in this case, we have to set the mask as well 127 float gain = psMetadataLookupF32(&mdok, cell->concepts, "CELL.GAIN"); // Cell gain 128 if (!mdok) { gain = NAN; } 129 float readnoise = psMetadataLookupF32(&mdok, cell->concepts, "CELL.READNOISE"); // Cell read noise 130 if (!mdok) { readnoise = NAN; } 121 131 122 132 // Set up the mask … … 127 137 } 128 138 psImage *mask = readout->mask; // The mask pixels 139 140 // completely mask if SATURATION or BAD are invalid 141 if (isnan(saturation) || isnan(bad) || isnan(gain) || isnan(readnoise)) { 142 psImageInit(mask, badMask); 143 return true; 144 } 145 129 146 psImageInit(mask, 0); 130 147 … … 210 227 float gain = psMetadataLookupF32(&mdok, cell->concepts, "CELL.GAIN"); // Cell gain 211 228 if (!mdok || isnan(gain)) { 212 psError(PS_ERR_IO, true, "CELL.GAIN is not set --- unable to set variance.\n"); 213 return false; 229 // psError(PS_ERR_IO, true, "CELL.GAIN is not set --- unable to set variance.\n"); 230 // return false; 231 psWarning("CELL.GAIN is not set --- setting variance to NAN\n"); 232 gain = NAN; 214 233 } 215 234 float readnoise = psMetadataLookupF32(&mdok, cell->concepts, "CELL.READNOISE"); // Cell read noise 216 235 if (!mdok || isnan(readnoise)) { 217 psError(PS_ERR_IO, true, "CELL.READNOISE is not set --- unable to set variance.\n"); 218 return false; 219 } 220 if (psMetadataLookup(cell->concepts, "CELL.READNOISE.UPDATE")) { 236 // psError(PS_ERR_IO, true, "CELL.READNOISE is not set --- unable to set variance.\n"); 237 // return false; 238 psWarning("CELL.READNOISE is not set --- setting variance to NAN\n"); 239 readnoise = NAN; 240 } 241 // if we have a non-NAN readnoise, then we need to ensure it has been updated (not necessary if NAN) 242 if (!isnan(gain) && psMetadataLookup(cell->concepts, "CELL.READNOISE.UPDATE")) { 221 243 psError(PS_ERR_IO, true, "CELL.READNOISE has not yet been updated for the gain"); 222 244 return false; 245 } 246 247 // for invalid input data, set the readout variance to NAN 248 if (isnan(gain) || isnan(readnoise)) { 249 if (!readout->variance) { 250 // generate the image if needed 251 readout->variance = psImageAlloc(readout->image->numCols, readout->image->numRows, PS_TYPE_F32); 252 } 253 // XXX need to set the mask, if defined 254 psImageInit(readout->variance, NAN); 255 return true; 223 256 } 224 257
Note:
See TracChangeset
for help on using the changeset viewer.
