Changeset 13012
- Timestamp:
- Apr 24, 2007, 3:27:44 PM (19 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 2 edited
-
psphotFindPeaks.c (modified) (3 diffs)
-
psphotReadout.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotFindPeaks.c
r12817 r13012 2 2 3 3 // In this function, we smooth the image, then search for the peaks 4 psArray *psphotFindPeaks (pmReadout *readout, psMetadata *recipe, int pass) { 4 psArray *psphotFindPeaks (pmReadout *readout, psMetadata *recipe, 5 bool returnFootprints, 6 const int pass) { 5 7 6 8 float SIGMA_SMTH, NSIGMA_SMTH, NSIGMA_PEAK; … … 110 112 } 111 113 112 psFree (smooth_im);113 psFree (smooth_wt);114 115 114 // optional dump of all peak data 116 115 char *output = psMetadataLookupStr (&status, recipe, "PEAKS_OUTPUT_FILE"); … … 119 118 } 120 119 psLogMsg ("psphot", PS_LOG_INFO, "%ld peaks: %f sec\n", peaks->n, psTimerMark ("psphot")); 120 // 121 // If they asked us to return a set of pmFootprints, not a raw pmPeak list, 122 // go ahead and find the footprints, and assign them their peaks. 123 // 124 // N.b. We're not culling this list; call pmFootprintCullPeaks if you 125 // want to do that 126 // 127 if (returnFootprints) { // We want an array of pmFootprint, not pmPeak 128 int npixMin = psMetadataLookupS32(&status, recipe, "FOOTPRINT_NPIXMIN"); 129 if (!status) { 130 npixMin = 1; 131 } 132 float FOOTPRINT_NSIGMA_LIMIT = 133 psMetadataLookupS32(&status, recipe, 134 (pass == 1) ? "FOOTPRINT_NSIGMA_LIMIT" : "FOOTPRINT_NSIGMA_LIMIT_2"); 135 if (!status) { 136 FOOTPRINT_NSIGMA_LIMIT = NSIGMA_PEAK; 137 } 138 threshold = PS_SQR(FOOTPRINT_NSIGMA_LIMIT)/effArea; 139 140 psArray *footprints = pmFindFootprints(smooth_im, threshold, npixMin); 141 pmPeaksAssignToFootprints(footprints, peaks); 142 143 psFree(peaks); 144 peaks = footprints; // well, you know what I mean 145 } 146 147 psFree (smooth_im); 148 psFree (smooth_wt); 121 149 122 150 return (peaks); 123 151 } 152 153 154 /************************************************************************************************************/ 155 /* 156 * Cull a set of peaks contained in a psArray of pmFootprints 157 */ 158 psErrorCode 159 psphotCullPeaks(const pmReadout *readout, 160 const psMetadata *recipe, 161 psArray *footprints) { // array of pmFootprints 162 bool status = false; 163 float nsigma_delta = psMetadataLookupF32(&status, recipe, "FOOTPRINT_CULL_NSIGMA_DELTA"); 164 if (!status) { 165 nsigma_delta = 0; // min. 166 } 167 float nsigma_min = psMetadataLookupF32(&status, recipe, "FOOTPRINT_CULL_NSIGMA_MIN"); 168 if (!status) { 169 nsigma_min = 0; 170 } 171 const float skyStdev = psMetadataLookupF32(NULL, recipe, "SKY_STDEV"); 172 173 return pmFootprintArrayCullPeaks(readout->image, readout->weight, footprints, 174 nsigma_delta, nsigma_min*skyStdev); 175 } -
trunk/psphot/src/psphotReadout.c
r12950 r13012 20 20 PS_ASSERT_PTR_NON_NULL (breakPt, false); 21 21 22 // Use the new pmFootprints approach? 23 const bool useFootprints = psMetadataLookupBool(NULL, recipe, "USE_FOOTPRINTS"); 24 22 25 // generate mask & weight images if they don't already exit 23 26 if (!pmReadoutGenerateMaskWeight (readout, true)) { … … 58 61 59 62 // find the peaks in the image 60 psArray *peaks = psphotFindPeaks (readout, recipe, 1); 63 psArray *peaks; 64 if (useFootprints) { 65 psArray *footprints = psphotFindPeaks (readout, recipe, useFootprints, 1); 66 peaks = pmFootprintArrayToPeaks(footprints); 67 psFree(footprints); 68 } else { 69 peaks = psphotFindPeaks (readout, recipe, useFootprints, 1); 70 } 71 61 72 if (!peaks) { 62 73 psLogMsg ("psphot", 3, "unable to find peaks in this image"); … … 146 157 147 158 // find the peaks in the image 148 psArray *newPeaks = psphotFindPeaks (readout, recipe, 2); 159 psArray *newPeaks; 160 if (useFootprints) { 161 psArray *newFootprints = psphotFindPeaks (readout, recipe, useFootprints, 2); 162 163 psphotCullPeaks(readout, recipe, newFootprints); 164 165 newPeaks = pmFootprintArrayToPeaks(newFootprints); 166 167 psFree(newFootprints); 168 } else { 169 newPeaks = psphotFindPeaks(readout, recipe, useFootprints, 2); 170 } 149 171 150 172 // remove noise for subtracted objects … … 186 208 187 209 // calculate source magnitudes 188 pmReadout *background = psphotSelectBackground (config, view );210 pmReadout *background = psphotSelectBackground (config, view, false); 189 211 psphotMagnitudes(sources, recipe, psf, background); 190 212
Note:
See TracChangeset
for help on using the changeset viewer.
