- Timestamp:
- Mar 14, 2011, 3:07:22 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psphot/src/psphotSignificanceImage.c
r30750 r30903 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; … … 94 94 psMetadataAddF32(readout->analysis, PS_LIST_TAIL, "SIGNIFICANCE_SCALE_FACTOR", PS_META_REPLACE, "Signicance scale factor", factor); 95 95 96 // 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 97 101 for (int j = 0; j < smooth_im->numRows; j++) { 98 102 for (int i = 0; i < smooth_im->numCols; i++) { 99 103 float value = smooth_im->data.F32[j][i]; 100 104 if (value < 0 || smooth_wt->data.F32[j][i] <= 0 || (mask->data.PS_TYPE_IMAGE_MASK_DATA[j][i] & maskVal)) { 101 smooth_ im->data.F32[j][i] = 0.0;105 smooth_wt->data.F32[j][i] = 0.0; 102 106 } else { 103 107 // XXX the value of 100 here (or 1000 before) must depend on the FWHM of the smoothing kernel, right?? 104 108 float v2 = value + PS_SQR(value/100.0); 105 smooth_ im->data.F32[j][i] = factor * PS_SQR(v2) / smooth_wt->data.F32[j][i];109 smooth_wt->data.F32[j][i] = factor * PS_SQR(v2) / smooth_wt->data.F32[j][i]; 106 110 } 107 111 } … … 115 119 static int pass = 0; 116 120 sprintf (name, "snsmooth.v%d.fits", pass); 117 psphotSaveImage (NULL, smooth_ im, name);121 psphotSaveImage (NULL, smooth_wt, name); 118 122 pass ++; 119 123 } 120 121 psFree(smooth_wt);122 123 124 psImageConvolveSetThreads(oldThreads); 124 125 125 return smooth_im; 126 pmReadout *significanceRO = pmReadoutAlloc(NULL); 127 significanceRO->variance = smooth_wt; 128 significanceRO->image = smooth_im; 129 130 return significanceRO; 126 131 } 127 132
Note:
See TracChangeset
for help on using the changeset viewer.
