- Timestamp:
- Jun 25, 2009, 2:00:56 PM (17 years ago)
- Location:
- branches/eam_branches/20090522
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090522
- Property svn:mergeinfo changed
-
branches/eam_branches/20090522/psModules
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/20090522/psModules/src/camera/pmFPAMaskWeight.c
r23989 r24557 199 199 } 200 200 201 bool pmReadoutSetVariance(pmReadout *readout, bool poisson)201 bool pmReadoutSetVariance(pmReadout *readout, const psImage *noiseMap, bool poisson) 202 202 { 203 203 PS_ASSERT_PTR_NON_NULL(readout, false); 204 // check that the noiseMap (if it exists) matches the readout variance size) 204 205 205 206 pmCell *cell = readout->parent; // The parent cell … … 228 229 229 230 // a negative variance is non-sensical. if the image value drops below 1, the variance must be 1. 231 // XXX this calculation is wrong: limit is 1 e-, but this is in DN 230 232 readout->variance = (psImage*)psUnaryOp(readout->variance, readout->variance, "abs"); 231 233 readout->variance = (psImage*)psBinaryOp(readout->variance, readout->variance, "max", … … 239 241 } 240 242 241 readout->variance = (psImage*)psBinaryOp(readout->variance, readout->variance, "+", 242 psScalarAlloc(readnoise*readnoise/gain/gain, PS_TYPE_F32)); 243 // apply a supplied readnoise map (NOTE: in DN, not electrons): 244 if (noiseMap) { 245 psImage *rdVar = (psImage*)psBinaryOp(NULL, (const psPtr) noiseMap, "*", (const psPtr) noiseMap); 246 readout->variance = (psImage*)psBinaryOp(readout->variance, readout->variance, "+", rdVar); 247 psFree (rdVar); 248 } else { 249 readout->variance = (psImage*)psBinaryOp(readout->variance, readout->variance, "+", psScalarAlloc(readnoise*readnoise/gain/gain, PS_TYPE_F32)); 250 } 243 251 244 252 return true; … … 247 255 // this function creates the variance pixels, or uses the existing variance pixels. it will set 248 256 // the noise pixel values only if the variance image is not supplied 249 bool pmReadoutGenerateVariance(pmReadout *readout, bool poisson)257 bool pmReadoutGenerateVariance(pmReadout *readout, const psImage *noiseMap, bool poisson) 250 258 { 251 259 PS_ASSERT_PTR_NON_NULL(readout, false); … … 291 299 readout->variance = variance; 292 300 293 return pmReadoutSetVariance(readout, poisson);294 } 295 296 bool pmReadoutGenerateMaskVariance(pmReadout *readout, psImageMaskType satMask, psImageMaskType badMask, bool poisson)301 return pmReadoutSetVariance(readout, noiseMap, poisson); 302 } 303 304 bool pmReadoutGenerateMaskVariance(pmReadout *readout, psImageMaskType satMask, psImageMaskType badMask, const psImage *noiseMap, bool poisson) 297 305 { 298 306 PS_ASSERT_PTR_NON_NULL(readout, false); … … 301 309 302 310 success &= pmReadoutGenerateMask(readout, satMask, badMask); 303 success &= pmReadoutGenerateVariance(readout, poisson);311 success &= pmReadoutGenerateVariance(readout, noiseMap, poisson); 304 312 305 313 return success; 306 314 } 307 315 308 bool pmCellGenerateMaskVariance(pmCell *cell, psImageMaskType satMask, psImageMaskType badMask, bool poisson)316 bool pmCellGenerateMaskVariance(pmCell *cell, psImageMaskType satMask, psImageMaskType badMask, const psImage *noiseMap, bool poisson) 309 317 { 310 318 PS_ASSERT_PTR_NON_NULL(cell, false); … … 314 322 for (int i = 0; i < readouts->n; i++) { 315 323 pmReadout *readout = readouts->data[i]; // The readout 316 success &= pmReadoutGenerateMaskVariance(readout, poisson, satMask, badMask);324 success &= pmReadoutGenerateMaskVariance(readout, satMask, badMask, noiseMap, poisson); 317 325 } 318 326
Note:
See TracChangeset
for help on using the changeset viewer.
