Changeset 30903
- Timestamp:
- Mar 14, 2011, 3:07:22 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psphot/src
- Files:
-
- 5 edited
-
psphot.h (modified) (1 diff)
-
psphotCullPeaks.c (modified) (4 diffs)
-
psphotFindDetections.c (modified) (1 diff)
-
psphotFindFootprints.c (modified) (3 diffs)
-
psphotSignificanceImage.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psphot/src/psphot.h
r30883 r30903 173 173 174 174 // used by psphotFindDetections 175 p sImage*psphotSignificanceImage (pmReadout *readout, psMetadata *recipe, psImageMaskType maskVal);175 pmReadout *psphotSignificanceImage (pmReadout *readout, psMetadata *recipe, psImageMaskType maskVal); 176 176 psArray *psphotFindPeaks (psImage *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int nMax); 177 bool psphotFindFootprints (pmDetections *detections, p sImage*significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int pass, psImageMaskType maskVal);178 psErrorCode psphotCullPeaks(const pmReadout *readout, const p sMetadata *recipe, psArray *footprints);177 bool psphotFindFootprints (pmDetections *detections, pmReadout *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int pass, psImageMaskType maskVal); 178 psErrorCode psphotCullPeaks(const pmReadout *readout, const pmReadout *signifRO, const psMetadata *recipe, psArray *footprints); 179 179 180 180 // in psphotApResid.c: -
branches/eam_branches/ipp-20110213/psphot/src/psphotCullPeaks.c
r30869 r30903 6 6 psErrorCode 7 7 psphotCullPeaks(const pmReadout *readout, // the image wherein lives the footprint 8 const pmReadout *signifR, // smoothed image and significance 8 9 const psMetadata *recipe, 9 10 psArray *footprints) { // array of pmFootprints … … 26 27 psAssert (status, "cannot find SKY_STDEV in readout->analysis"); 27 28 28 const float MIN_THRESHOLD = nsigma_min*skyStdev; 29 // the sky has been smoothed, so we need to scale down the raw sky stdev by this amount: 30 float scaleFactor = psMetadataLookupF32(&status, readout->analysis, "SIGNIFICANCE_SCALE_FACTOR"); 31 if (!status) scaleFactor = 1.0; 32 33 const float MIN_THRESHOLD = nsigma_min*skyStdev / sqrt(scaleFactor); 29 34 30 35 // for saturated stars, we should be somewhat more agressive about culling: instead of … … 36 41 // fStdev = 0.005, stdev_pad = 0.011*40k = 400 37 42 // threshold = 40k - 4*400 = 38400 38 39 // in practice, we should make the threshold in such a case more like 0.5 * saturation... 43 // this gives too tight of a tolerance on the bright stars 44 // in practice, we should make the threshold much lower. 45 // below I am using 0.05 * saturation (eg, 2000 DN above sky in a GPC1 image) 40 46 41 47 float SATURATION = NAN; … … 72 78 } 73 79 74 if (pmFootprintCullPeaks(readout->image, readout->variance, fp, nsigma_delta, fPadding, MIN_THRESHOLD, max_threshold) != PS_ERR_NONE) { 80 // if we cull using the significance image, then the thresholds are different 81 # if (0) 82 if (pmFootprintCullPeaks(signifR->image, readout->variance, fp, nsigma_delta, fPadding, MIN_THRESHOLD, max_threshold, true) != PS_ERR_NONE) { 75 83 return psError(PS_ERR_UNKNOWN, false, "Culling pmFootprint %d", fp->id); 76 84 } 85 # endif 86 # if (1) 87 if (pmFootprintCullPeaks(signifR->image, signifR->variance, fp, nsigma_delta, fPadding, MIN_THRESHOLD, max_threshold, false) != PS_ERR_NONE) { 88 return psError(PS_ERR_UNKNOWN, false, "Culling pmFootprint %d", fp->id); 89 } 90 # endif 91 # if (0) 92 if (pmFootprintCullPeaks(readout->image, readout->variance, fp, nsigma_delta, fPadding, MIN_THRESHOLD, max_threshold, true) != PS_ERR_NONE) { 93 return psError(PS_ERR_UNKNOWN, false, "Culling pmFootprint %d", fp->id); 94 } 95 # endif 96 77 97 float dtime = psTimerMark ("psphot.cull.footprints"); 78 98 if (dtime > 1.0) { -
branches/eam_branches/ipp-20110213/psphot/src/psphotFindDetections.c
r30624 r30903 84 84 85 85 // generate the smoothed significance image 86 p sImage*significance = psphotSignificanceImage (readout, recipe, maskVal);86 pmReadout *significance = psphotSignificanceImage (readout, recipe, maskVal); 87 87 88 88 // display the log significance image 89 psphotVisualShowLogSignificance (significance , 0.0, 4.5);89 psphotVisualShowLogSignificance (significance->variance, 0.0, 4.5); 90 90 91 91 // display the significance image 92 psphotVisualShowSignificance (significance , 0.98*threshold, 1.02*threshold);92 psphotVisualShowSignificance (significance->variance, 0.98*threshold, 1.02*threshold); 93 93 94 94 // detect the peaks in the significance image 95 detections->peaks = psphotFindPeaks (significance , readout, recipe, threshold, NMAX);95 detections->peaks = psphotFindPeaks (significance->variance, readout, recipe, threshold, NMAX); 96 96 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "PEAK_THRESHOLD", PS_META_REPLACE, "Peak Detection Threshold", threshold); 97 97 if (!detections->peaks) { -
branches/eam_branches/ipp-20110213/psphot/src/psphotFindFootprints.c
r30624 r30903 1 1 # include "psphotInternal.h" 2 2 3 bool psphotFindFootprints (pmDetections *detections, p sImage*significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int pass, psImageMaskType maskVal) {3 bool psphotFindFootprints (pmDetections *detections, pmReadout *significance, pmReadout *readout, psMetadata *recipe, const float threshold, const int pass, psImageMaskType maskVal) { 4 4 5 5 bool status; … … 18 18 PS_ASSERT (status, false); 19 19 20 // find the raw footprints & assign the peaks to those footprints21 psArray *footprints = pmFootprintsFind (significance , threshold, npixMin);20 // find the raw footprints in the smoothed significance image & assign the peaks to those footprints 21 psArray *footprints = pmFootprintsFind (significance->variance, threshold, npixMin); 22 22 23 23 if (pmFootprintsAssignPeaks(footprints, detections->peaks) != PS_ERR_NONE) { … … 56 56 } 57 57 58 psphotCullPeaks(readout, recipe, detections->footprints);58 psphotCullPeaks(readout, significance, recipe, detections->footprints); 59 59 detections->peaks = pmFootprintArrayToPeaks(detections->footprints); 60 60 psLogMsg ("psphot", PS_LOG_INFO, "%ld peaks, %ld total footprints: %f sec\n", detections->peaks->n, detections->footprints->n, psTimerMark ("psphot.footprints")); -
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.
