Changeset 25647
- Timestamp:
- Sep 28, 2009, 5:54:54 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/psphotSourceStats.c
r25528 r25647 156 156 float RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS"); 157 157 if (!status) return false; 158 float MIN_PIXEL_SN = psMetadataLookupF32 (&status, recipe, "MOMENTS_MIN_PIXEL_SN");159 if (!status) return false;160 158 float SIGMA = psMetadataLookupF32 (&status, recipe, "MOMENTS_GAUSS_SIGMA"); 161 159 if (!status) return false; … … 206 204 } 207 205 208 // measure basic source moments 209 status = pmSourceMoments (source, RADIUS, SIGMA, MIN_PIXEL_SN);206 // measure basic source moments (no S/N clipping on input pixels) 207 status = pmSourceMoments (source, RADIUS, SIGMA, 0.0); 210 208 if (status) { 211 209 Nmoments ++; … … 217 215 BIG_RADIUS = PS_MIN (INNER, 3*RADIUS); 218 216 psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y); 219 status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, MIN_PIXEL_SN);217 status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, 0.0); 220 218 if (status) { 221 219 source->mode |= PM_SOURCE_MODE_BIG_RADIUS; … … 248 246 bool status; 249 247 250 float MIN_SN = psMetadataLookupF32 (&status, recipe, "MOMENTS_SN_MIN");248 float MIN_SN = psMetadataLookupF32 (&status, recipe, "MOMENTS_SN_MIN"); 251 249 if (!status) return false; 252 250 … … 273 271 } 274 272 275 // measure basic source moments 273 // measure basic source moments (no S/N clipping on input pixels) 276 274 status = pmSourceMoments (source, 4*sigma[i], sigma[i], 0.0); 277 275 } … … 332 330 return true; 333 331 } 334 335 # if (0)336 bool psphotSourceStats_Unthreaded (int *nfail, int *nmoments, psArray *sources, psMetadata *recipe) {337 338 bool status = false;339 float BIG_RADIUS;340 341 float INNER = psMetadataLookupF32 (&status, recipe, "SKY_INNER_RADIUS");342 if (!status) return false;343 float MIN_SN = psMetadataLookupF32 (&status, recipe, "MOMENTS_SN_MIN");344 if (!status) return false;345 float RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_MOMENTS_RADIUS");346 if (!status) return false;347 348 // bit-masks to test for good/bad pixels349 psImageMaskType maskVal = psMetadataLookupImageMask(&status, recipe, "MASK.PSPHOT");350 assert (maskVal);351 352 // bit-mask to mark pixels not used in analysis353 psImageMaskType markVal = psMetadataLookupImageMask(&status, recipe, "MARK.PSPHOT");354 assert (markVal);355 356 // maskVal is used to test for rejected pixels, and must include markVal357 maskVal |= markVal;358 359 // threaded measurement of the sources moments360 int Nfail = 0;361 int Nmoments = 0;362 for (int i = 0; i < sources->n; i++) {363 pmSource *source = sources->data[i];364 365 // skip faint sources for moments measurement366 if (source->peak->SN < MIN_SN) {367 continue;368 }369 370 // measure a local sky value371 // the local sky is now ignored; kept here for reference only372 status = pmSourceLocalSky (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal);373 if (!status) {374 psErrorClear(); // XXX re-consider the errors raised here375 Nfail ++;376 continue;377 }378 379 // measure the local sky variance (needed if noise is not sqrt(signal))380 // XXX EAM : this should use ROBUST not SAMPLE median, but it is broken381 status = pmSourceLocalSkyVariance (source, PS_STAT_SAMPLE_MEDIAN, INNER, maskVal, markVal);382 if (!status) {383 Nfail ++;384 psErrorClear();385 continue;386 }387 388 // measure basic source moments389 status = pmSourceMoments (source, RADIUS, SIGMA, MIN_PIXEL_SN);390 if (status) {391 Nmoments ++;392 continue;393 }394 395 // if no valid pixels, or massive swing, likely saturated source,396 // try a much larger box397 BIG_RADIUS = PS_MIN (INNER, 3*RADIUS);398 psTrace ("psphot", 4, "retrying moments for %d, %d\n", source->peak->x, source->peak->y);399 status = pmSourceMoments (source, BIG_RADIUS, 3.0*SIGMA, MIN_PIXEL_SN);400 if (status) {401 Nmoments ++;402 continue;403 }404 405 Nfail ++;406 psErrorClear();407 continue;408 }409 410 // change the value of a scalar on the array (wrap this and put it in psArray.h)411 *nmoments = Nmoments;412 *nfail = Nfail;413 414 return true;415 }416 # endif
Note:
See TracChangeset
for help on using the changeset viewer.
