Changeset 6427 for trunk/psphot/src/psphotFindPeaks.c
- Timestamp:
- Feb 14, 2006, 6:33:17 AM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotFindPeaks.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotFindPeaks.c
r6379 r6427 2 2 3 3 // 2006.02.02 : no leaks 4 psArray *psphotFindPeaks (pmReadout *readout, psMetadata *config , psStats *sky) {4 psArray *psphotFindPeaks (pmReadout *readout, psMetadata *config) { 5 5 6 6 bool status = false; … … 9 9 float threshold; 10 10 11 // smooth the image 11 // smooth the image and weight map 12 13 psphotSaveImage (NULL, readout->image, "image.fits"); 12 14 13 15 psTimerStart ("psphot"); … … 16 18 NSIGMA = psMetadataLookupF32 (&status, config, "PEAKS_SMOOTH_NSIGMA"); 17 19 18 psImage *smooth = psImageCopy (NULL, readout->image, PS_TYPE_F32); 19 psphotSaveImage (NULL, smooth, "presmooth.fits"); 20 psImage *smooth_im = psImageCopy (NULL, readout->image, PS_TYPE_F32); 21 psImageSmooth (smooth_im, SIGMA, NSIGMA); 22 psLogMsg ("psphot", 4, "smooth image: %f sec\n", psTimerMark ("psphot")); 20 23 21 psImageSmooth (smooth, SIGMA, NSIGMA); 22 psLogMsg ("psphot", 4, "smooth: %f sec\n", psTimerMark ("psphot")); 24 psphotSaveImage (NULL, smooth_im, "smooth_im.fits"); 23 25 24 psphotSaveImage (NULL, smooth, "smooth.fits"); 26 psImage *smooth_wt = psImageCopy (NULL, readout->weight, PS_TYPE_F32); 27 psImageSmooth (smooth_wt, SIGMA, NSIGMA); 28 psLogMsg ("psphot", 4, "smooth weight: %f sec\n", psTimerMark ("psphot")); 29 30 psphotSaveImage (NULL, smooth_wt, "smooth_wt.fits"); 31 32 psTimerStart ("psphot"); 33 for (int j = 0; j < smooth_im->numRows; j++) { 34 for (int i = 0; i < smooth_im->numCols; i++) { 35 if (smooth_wt->data.F32[j][i] <= 0) continue; 36 smooth_im->data.F32[j][i] = PS_SQR(smooth_im->data.F32[j][i]) / smooth_wt->data.F32[j][i]; 37 } 38 } 39 psLogMsg ("psphot", 4, "built S/N map: %f sec\n", psTimerMark ("psphot")); 25 40 26 41 psTimerStart ("psphot"); 27 42 28 43 // set peak threshold 29 NSIGMA = psMetadataLookupF32 (&status, config, "PEAKS_NSIGMA_LIMIT"); 30 31 threshold = NSIGMA*sky->sampleStdev + sky->sampleMean; 32 // threshold = NSIGMA*sky->sampleStdev; 44 NSIGMA = psMetadataLookupF32 (&status, config, "PEAKS_NSIGMA_LIMIT"); 45 // threshold = NSIGMA*sky->sampleStdev + sky->sampleMean; 46 threshold = PS_SQR(NSIGMA); 33 47 psLogMsg ("psphot", 4, "threshold: %f DN\n", threshold); 34 48 35 49 // find the peaks in the smoothed image 36 psArray *peaks = pmFindImagePeaks (smooth , threshold);50 psArray *peaks = pmFindImagePeaks (smooth_im, threshold); 37 51 if (peaks == NULL) psAbort ("find peaks", "no peaks found"); 38 psFree (smooth); 52 psFree (smooth_im); 53 psFree (smooth_wt); 39 54 40 55 // optional dump of all peak data
Note:
See TracChangeset
for help on using the changeset viewer.
