Changeset 19482 for trunk/psModules/src/imcombine/pmStack.c
- Timestamp:
- Sep 10, 2008, 5:37:58 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/imcombine/pmStack.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmStack.c
r19336 r19482 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.3 8$ $Name: not supported by cvs2svn $11 * @date $Date: 2008-09- 03 19:42:54$10 * @version $Revision: 1.39 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2008-09-11 03:37:58 $ 12 12 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii 13 13 * … … 309 309 } 310 310 } 311 if (useVariance && safe &&numIter > 0) {311 if (useVariance && numIter > 0) { 312 312 // Use variance to check that the two are consistent 313 313 float diff = pixelData->data.F32[0] - pixelData->data.F32[1]; 314 float sigma2 = pixelVariances->data.F32[0] + pixelVariances->data.F32[1]; 314 float sigma2 = pixelVariances->data.F32[0] * varFactors->data.F32[pixelSources->data.U16[0]] + 315 pixelVariances->data.F32[1] * varFactors->data.F32[pixelSources->data.U16[1]]; 315 316 if (PS_SQR(diff) > PS_SQR(rej) * sigma2) { 316 317 // Not consistent: mark both for inspection … … 341 342 float rej2 = PS_SQR(rej); // Rejection level squared 342 343 for (int i = 0; i < num; i++) { 343 pixelVariances->data.F32[i] *= rej2 * varFactors->data.F32[ i];344 pixelVariances->data.F32[i] *= rej2 * varFactors->data.F32[pixelSources->data.U16[i]]; 344 345 } 345 346 } … … 348 349 // The clipping that follows is solely to identify suspect pixels. 349 350 // These suspect pixels will be inspected in more detail by other functions. 350 int numClipped = INT_MAX; // Number of pixels clipped per iteration351 int totalClipped = 0; // Total number of pixels clipped351 int numClipped = INT_MAX; // Number of pixels clipped per iteration 352 int totalClipped = 0; // Total number of pixels clipped 352 353 for (int i = 0; i < numIter && numClipped > 0 && num - totalClipped > 2; i++) { 353 354 numClipped = 0; 354 355 float median, stdev; // Median and stdev of the combination, for rejection 355 356 356 if (!combinationMedianStdev(&median, useVariance ? NULL : &stdev, pixelData, pixelMasks, sort)) { 357 if (!combinationMedianStdev(&median, useVariance ? NULL : &stdev, 358 pixelData, pixelMasks, sort)) { 357 359 psWarning("Bad median/stdev at %d,%d", x, y); 358 360 break; 359 361 } 360 362 361 float limit = NAN; // Rejection limit, when rejecting based on data properties 362 if (!useVariance) { 363 limit = rej * stdev; 364 } 363 float limit = rej * stdev; // Rejection limit, when rejecting based on data properties 365 364 366 365 // Mask a pixel for inspection … … 378 377 if (useVariance) { 379 378 // Comparing squares --- cheaper than lots of sqrts 379 // pixelVariances includes the variance factor and the rejection limit, from above 380 380 if (PS_SQR(diff) > pixelVariances->data.F32[j]) { 381 381 MASK_PIXEL_FOR_INSPECTION();
Note:
See TracChangeset
for help on using the changeset viewer.
