Changeset 20497 for trunk/psModules/src/imcombine/pmStack.c
- Timestamp:
- Oct 31, 2008, 5:00:04 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/imcombine/pmStack.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/imcombine/pmStack.c
r20487 r20497 8 8 * @author GLG, MHPCC 9 9 * 10 * @version $Revision: 1.4 3$ $Name: not supported by cvs2svn $11 * @date $Date: 2008-1 0-31 21:50:59$10 * @version $Revision: 1.44 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2008-11-01 02:59:33 $ 12 12 * Copyright 2004-2007 Institute for Astronomy, University of Hawaii 13 13 * … … 219 219 int numIter, // Number of rejection iterations 220 220 float rej, // Number of standard deviations at which to reject 221 float sys, // Relative systematic error 221 222 bool useVariance, // Use variance for rejection when combining? 222 223 bool safe, // Combine safely? … … 311 312 if (useVariance && numIter > 0) { 312 313 // Use variance to check that the two are consistent 313 float diff = pixelData->data.F32[0] - pixelData->data.F32[1]; 314 float diff = 0.5 * (pixelData->data.F32[0] - pixelData->data.F32[1]); // Mean flux difference 315 float var1 = pixelVariances->data.F32[0]; // Variance of first 316 float var2 = pixelVariances->data.F32[1]; // Variance of second 314 317 #ifdef VARIANCE_FACTORS 315 float sigma2 = pixelVariances->data.F32[0] * varFactors->data.F32[pixelSources->data.U16[0]] + 316 pixelVariances->data.F32[1] * varFactors->data.F32[pixelSources->data.U16[1]]; 317 #else 318 float sigma2 = pixelVariances->data.F32[0] + pixelVariances->data.F32[1]; 318 // Variance factor contributes to the rejection level 319 var1 *= varFactors->data.F32[pixelSources->data.U16[0]]; 320 var2 *= varFactors->data.F32[pixelSources->data.U16[1]]; 319 321 #endif 322 // Systematic error contributes to the rejection level 323 var1 += PS_SQR(sys * pixelData->data.F32[0]); 324 var2 += PS_SQR(sys * pixelData->data.F32[1]); 325 326 float sigma2 = var1 + var2; // 320 327 if (PS_SQR(diff) > PS_SQR(rej) * sigma2) { 321 328 // Not consistent: mark both for inspection … … 346 353 float rej2 = PS_SQR(rej); // Rejection level squared 347 354 for (int i = 0; i < num; i++) { 355 pixelVariances->data.F32[i] *= rej2; 348 356 #ifdef VARIANCE_FACTORS 349 pixelVariances->data.F32[i] *= rej2 * varFactors->data.F32[pixelSources->data.U16[i]]; 350 #else 351 pixelVariances->data.F32[i] *= rej2; 357 // Variance factor contributes to the rejection level 358 pixelVariances->data.F32[i] *= varFactors->data.F32[pixelSources->data.U16[i]]; 352 359 #endif 360 // Systematic error contributes to the rejection level 361 pixelVariances->data.F32[i] += PS_SQR(sys * pixelData->data.F32[i]); 353 362 } 354 363 } … … 554 563 /// Stack input images 555 564 bool pmStackCombine(pmReadout *combined, psArray *input, psMaskType maskVal, psMaskType bad, 556 int kernelSize, int numIter, float rej, bool entire, bool useVariance, bool safe) 565 int kernelSize, int numIter, float rej, float sys, 566 bool entire, bool useVariance, bool safe) 557 567 { 558 568 PS_ASSERT_PTR_NON_NULL(combined, false); … … 660 670 x, y); // Reject these images 661 671 combinePixels(combinedImage, combinedMask, combinedVariance, input, weights, varFactors, 662 reject, x, y, maskVal, bad, numIter, rej, useVariance, safe, buffer);672 reject, x, y, maskVal, bad, numIter, rej, sys, useVariance, safe, buffer); 663 673 } 664 674 } … … 674 684 x, y); // Reject these images 675 685 combinePixels(combinedImage, combinedMask, combinedVariance, input, weights, varFactors, 676 reject, x, y, maskVal, bad, numIter, rej, useVariance, safe, buffer);686 reject, x, y, maskVal, bad, numIter, rej, sys, useVariance, safe, buffer); 677 687 } 678 688 } … … 701 711 for (int x = minInputCols; x < maxInputCols; x++) { 702 712 combinePixels(combinedImage, combinedMask, combinedVariance, input, weights, varFactors, 703 NULL, x, y, maskVal, bad, numIter, rej, useVariance, safe, buffer);713 NULL, x, y, maskVal, bad, numIter, rej, sys, useVariance, safe, buffer); 704 714 } 705 715 }
Note:
See TracChangeset
for help on using the changeset viewer.
