Changeset 18005
- Timestamp:
- Jun 8, 2008, 2:47:42 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotSignificanceImage.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotSignificanceImage.c
r17870 r18005 8 8 float SIGMA_SMTH, NSIGMA_SMTH; 9 9 bool status = false; 10 bool guess = false; 10 11 11 12 // smooth the image and weight map … … 19 20 SIGMA_SMTH = 0.5*(FWHM_X + FWHM_Y) / (2.0*sqrt(2.0*log(2.0))); 20 21 NSIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_NSIGMA"); 22 guess = false; 21 23 } else { 22 24 // if we do not know the FWHM, use the guess smoothing kernel supplied. … … 26 28 NSIGMA_SMTH = psMetadataLookupF32 (&status, recipe, "PEAKS_SMOOTH_NSIGMA"); 27 29 PS_ASSERT (status, NULL); 30 guess = true; 28 31 } 29 32 // record the actual smoothing sigma … … 35 38 psLogMsg ("psphot", PS_LOG_MINUTIA, "smooth image: %f sec\n", psTimerMark ("smooth")); 36 39 37 // Smooth the weight, applying the mask as we go. The variance *should* be smoothed by the 38 // PSF^2, which does not have unity normalization (variance decreases as we smooth). 39 // Instead, we are smoothing with a Gaussian with sigma = SIGMA_SMTH/sqrt(2) with unity 40 // normalization. The resulting variance is a factor of 4*pi*SIGMA_SMTH^2 too large. We 41 // correct for this effect, and the effective area, in the calculation of the (S/N)^2 image 42 // below. 40 // Smooth the weight, applying the mask as we go. The variance is smoothed by the PSF^2, 41 // renomalized to maintain the input level of the variance. We achieve this by smoothing 42 // with a Gaussian with sigma = SIGMA_SMTH/sqrt(2) with unity normalization. Note that 43 // this process yields a smoothed image with correlated errors. The pixel-to-pixel 44 // variations in smooth_im will be decreased by a factor of 4*pi*SIGMA_SMTH^2, but for 45 // measurements based on apertures comparable to or larger than the smoothing kernel, the 46 // effective per-pixel variance is maintained. 43 47 psImage *smooth_wt = psImageCopy (NULL, readout->weight, PS_TYPE_F32); 44 48 psImageSmoothMaskF32 (smooth_wt, readout->mask, maskVal, SIGMA_SMTH/sqrt(2), NSIGMA_SMTH); … … 64 68 65 69 // Build the significance image on top of smooth_im. We need to correct the ratio im/wt by 66 // two factors: 1) the error in the variance normalization above and 2) a factor to account 67 // for the relationship the peak value and the integrated flux, and the relationship 68 // between the per-pixel variance (var_i) and the total variance included in the flux 69 // measurement (effective area). These latter correction comes from: flux = Io * 70 // 2 factors: 1) the relationship the peak value and the integrated flux, and 2) the 71 // relationship between the per-pixel variance (var_i) and the total variance included in 72 // the flux measurement (effective area). These latter correction comes from: flux = Io * 70 73 // 2\pi\sigma_o^2 and total variance = var_i * 4\pi\sigma_o^2, thus (S/N)^2 = flux^2 / var 71 // = var_i\pi sigma_o^274 // = (Io/var_i) \pi sigma_o^2 72 75 73 // thus: 74 // (S/N)^2 = (im^2 / wt) * (\pi \sigma_o^2 * 4 \sigma_s^2) 75 // (S/N)^2 = (im^2 / wt) * (\pi 2 \sigma_s^2 * 4 \sigma_s^2) 76 // (S/N)^2 = (im^2 / wt) * (\pi 8 \sigma_s^4) 76 // in fact, because of the smoothing and the resulting correlated errors, the per-pixel 77 // varience is a bit smaller than the value predicted here. The total variance should be 78 // \alpha 4\pi(\sigma_r_^2 + \sigma_s^2) where \alpha approaches 1 for \sigma_s / \sigma_r 79 // << 1, and \alpha approaches 0.5 for \sigma_s / \sigma_r >> 1, with a value of 0.7 80 // (actually 1/1.5) for \sigma_s = \sigma_r 77 81 78 float factor = 8.0 * PS_SQR(M_PI) * pow(SIGMA_SMTH, 4.0); 82 // if the smoothing kernel size is known to be the psf size (\sigma_s = \sigma_r), then we 83 // can use the scaling factor of 1/1.5; otherwise, we want to be conservative and use \alpha 84 // = 0.5. Thus, for the guess smoothing kernel, (S/N)^2 = 3.0 (Io/var_i) \pi sigma_s^2 for 85 // the guess case and (S/N)^2 = 2.0 (Io/var_i) \pi sigma_s^2 for the known case 86 87 // XXX hmm, somehow the simulations are coming up with 4pi, not 3pi (as if \alpha is 1/2.0, 88 // not 1/1.5 for sigma_s = sigma_r... 89 90 float factor = guess ? 4.0 * M_PI * PS_SQR(SIGMA_SMTH) : 4.0 * M_PI * PS_SQR(SIGMA_SMTH); 79 91 // record the effective area and significance scaling factor 80 92 float effArea = 8.0 * M_PI * PS_SQR(SIGMA_SMTH);
Note:
See TracChangeset
for help on using the changeset viewer.
