Changeset 31154 for trunk/psphot/src/psphotSignificanceImage.c
- Timestamp:
- Apr 4, 2011, 1:12:39 PM (15 years ago)
- Location:
- trunk/psphot
- Files:
-
- 2 edited
-
. (modified) (2 props)
-
src/psphotSignificanceImage.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot
- Property svn:ignore
-
old new 19 19 psphot-config 20 20 Doxyfile 21 a.out.dSYM
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
trunk/psphot/src/psphotSignificanceImage.c
r29548 r31154 4 4 // (S/N)^2. If FWMH_X,Y have been recorded, use them, otherwise use PEAKS_SMOOTH_SIGMA for the 5 5 // smoothing kernel. 6 p sImage*psphotSignificanceImage (pmReadout *readout, psMetadata *recipe, psImageMaskType maskVal) {6 pmReadout *psphotSignificanceImage (pmReadout *readout, psMetadata *recipe, psImageMaskType maskVal) { 7 7 8 8 float SIGMA_SMTH, NSIGMA_SMTH; … … 21 21 minGauss = 0.5; 22 22 } 23 24 // NOTE: for a faint extended-source detection pass, we over-smooth by SOMETHING 23 25 24 26 // if we have already determined the PSF model, then we have a better idea how to smooth this image … … 92 94 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SIGNIFICANCE_SCALE_FACTOR", PS_META_REPLACE, "Signicance scale factor", factor); 93 95 94 // XXX multithread this if needed 96 // we are going to return both the image and the weight here: the image contains the signal 97 // while the 'weight' will contain the significance (NOTE the deviation from the usual 98 // definition) 99 100 // save the smoothed significance image in the weight array 95 101 for (int j = 0; j < smooth_im->numRows; j++) { 96 102 for (int i = 0; i < smooth_im->numCols; i++) { 97 103 float value = smooth_im->data.F32[j][i]; 98 104 if (value < 0 || smooth_wt->data.F32[j][i] <= 0 || (mask->data.PS_TYPE_IMAGE_MASK_DATA[j][i] & maskVal)) { 99 smooth_ im->data.F32[j][i] = 0.0;105 smooth_wt->data.F32[j][i] = 0.0; 100 106 } else { 101 float v2 = value + PS_SQR(value/1000.0); 102 smooth_im->data.F32[j][i] = factor * PS_SQR(v2) / smooth_wt->data.F32[j][i]; 107 // XXX the value of 100 here (or 1000 before) must depend on the FWHM of the smoothing kernel, right?? 108 float v2 = value + PS_SQR(value/100.0); 109 smooth_wt->data.F32[j][i] = factor * PS_SQR(v2) / smooth_wt->data.F32[j][i]; 103 110 } 104 111 } … … 112 119 static int pass = 0; 113 120 sprintf (name, "snsmooth.v%d.fits", pass); 114 psphotSaveImage (NULL, smooth_ im, name);121 psphotSaveImage (NULL, smooth_wt, name); 115 122 pass ++; 116 123 } 117 118 psFree(smooth_wt);119 120 124 psImageConvolveSetThreads(oldThreads); 121 125 122 return smooth_im; 126 pmReadout *significanceRO = pmReadoutAlloc(NULL); 127 significanceRO->variance = smooth_wt; 128 significanceRO->image = smooth_im; 129 130 return significanceRO; 123 131 } 124 132
Note:
See TracChangeset
for help on using the changeset viewer.
