Changeset 27571
- Timestamp:
- Apr 1, 2010, 5:02:37 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotSourceStats.c (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotSourceStats.c
r27136 r27571 16 16 // loop over the available readouts 17 17 for (int i = 0; i < num; i++) { 18 if (!psphotSourceStatsReadout (config, view, "PSPHOT.INPUT", i, recipe, setWindow)) {18 if (!psphotSourceStatsReadout (config, view, "PSPHOT.INPUT", i, recipe, setWindow)) { 19 19 psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for PSPHOT.INPUT entry %d", i); 20 return false;21 }20 return false; 21 } 22 22 } 23 23 return true; … … 44 44 // XXX TEST: 45 45 if (detections->allSources) { 46 psphotMaskCosmicRayFootprintCheck(detections->allSources);46 psphotMaskCosmicRayFootprintCheck(detections->allSources); 47 47 } 48 48 if (detections->newSources) { 49 psphotMaskCosmicRayFootprintCheck(detections->newSources);49 psphotMaskCosmicRayFootprintCheck(detections->newSources); 50 50 } 51 51 … … 88 88 // if there are no peaks, we save the empty source array and return 89 89 if (!peaks->n) { 90 // save the new sources on the detection structure:91 detections->newSources = sources;92 return true;90 // save the new sources on the detection structure: 91 detections->newSources = sources; 92 return true; 93 93 } 94 94 … … 119 119 psLogMsg ("psphot", PS_LOG_INFO, "break point PEAKS, skipping MOMENTS\n"); 120 120 psphotVisualShowMoments (sources); 121 detections->newSources = sources;121 detections->newSources = sources; 122 122 return true; 123 123 } … … 126 126 if (!psphotSetMomentsWindow(recipe, readout->analysis, sources)) { 127 127 psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to determine Moments Window!"); 128 psFree(sources);128 psFree(sources); 129 129 return false; 130 130 } … … 134 134 float SIGMA = psMetadataLookupF32 (&status, readout->analysis, "MOMENTS_GAUSS_SIGMA"); 135 135 if (!status) { 136 SIGMA = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA");136 SIGMA = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA"); 137 137 } 138 138 float RADIUS = psMetadataLookupF32 (&status, readout->analysis, "PSF_MOMENTS_RADIUS"); 139 139 if (!status) { 140 RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");140 RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS"); 141 141 } 142 142 … … 178 178 psError(PS_ERR_UNKNOWN, false, "Unable to launch thread job PSPHOT_SOURCE_STATS"); 179 179 psFree (job); 180 psFree(sources);180 psFree(sources); 181 181 return false; 182 182 } … … 187 187 if (!psThreadPoolWait (false)) { 188 188 psError(PS_ERR_UNKNOWN, false, "Failure in thread job PSPHOT_SOURCE_STATS"); 189 psFree(sources);189 psFree(sources); 190 190 return false; 191 191 } … … 220 220 221 221 if (detections->allSources) { 222 psphotMaskCosmicRayFootprintCheck(detections->allSources);222 psphotMaskCosmicRayFootprintCheck(detections->allSources); 223 223 } 224 224 if (detections->newSources) { 225 psphotMaskCosmicRayFootprintCheck(detections->newSources);225 psphotMaskCosmicRayFootprintCheck(detections->newSources); 226 226 } 227 227 … … 229 229 } 230 230 231 // this function is currently only called by psphotCheckExtSources 231 // this function is currently only called by psphotCheckExtSources 232 232 bool psphotSourceStatsUpdate (psArray *sources, pmConfig *config, pmReadout *readout) { 233 233 … … 261 261 262 262 // allocate space for moments 263 if (!source->moments) {264 source->moments = pmMomentsAlloc();265 }263 if (!source->moments) { 264 source->moments = pmMomentsAlloc(); 265 } 266 266 267 267 // allocate image, weight, mask arrays for each peak (square of radius OUTER) … … 279 279 // XXX how else could we get the window size in? 280 280 if (!psphotSetMomentsWindow(recipe, readout->analysis, sources)) { 281 psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to determine Moments Window!");282 return NULL;281 psError(PS_ERR_UNEXPECTED_NULL, false, "Failed to determine Moments Window!"); 282 return NULL; 283 283 } 284 284 … … 303 303 psThreadJob *job = psThreadJobAlloc ("PSPHOT_SOURCE_STATS"); 304 304 305 // XXX: this must match the above305 // XXX: this must match the above 306 306 psArrayAdd(job->args, 1, cells->data[j]); // sources 307 307 psArrayAdd(job->args, 1, recipe); … … 515 515 if (maxS < 0.65) Sigma = sigma[0]; 516 516 517 for (int i = 0; i < NSIGMA - 1; i++) { 517 for (int i = 0; i < NSIGMA - 1 && isnan(Sigma); i++) { 518 if (!isfinite(Sout[i]) || !isfinite(Sout[i+1])) continue; 518 519 if ((Sout[i] > 0.65) && (Sout[i+1] > 0.65)) continue; 519 520 if ((Sout[i] < 0.65) && (Sout[i+1] < 0.65)) continue;
Note:
See TracChangeset
for help on using the changeset viewer.
