Changeset 25611
- Timestamp:
- Sep 27, 2009, 10:52:23 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20090715/psphot/src/psphotSourceSize.c
r25530 r25611 4 4 typedef struct { 5 5 psImageMaskType maskVal; 6 psImageMaskType markVal; 6 7 psImageMaskType crMask; 7 8 float ApResid; … … 39 40 assert (options.maskVal); 40 41 42 options.markVal = psMetadataLookupImageMask(&status, recipe, "MARK.PSPHOT"); // Mask value for bad pixels 43 assert (options.markVal); 44 41 45 // bit to mask the cosmic-ray pixels 42 46 options.crMask = pmConfigMaskGet("CR", config); // Mask value for cosmic rays … … 81 85 psphotVisualPlotSourceSize (recipe, sources); 82 86 psphotVisualShowSourceSize (readout, sources); 87 psphotVisualPlotApResid (sources, options.ApResid, options.ApSysErr); 83 88 84 89 return true; … … 89 94 // replace the source flux 90 95 pmSourceAdd (source, PM_MODEL_OP_FULL, maskVal); 91 source->tmpFlags &= ~PM_SOURCE_TMPF_SUBTRACTED;92 96 93 97 // flag this as a CR … … 198 202 psVector *ApErr = psVectorAllocEmpty (100, PS_TYPE_F32); 199 203 204 psImageMaskType maskVal = options->maskVal | options->markVal; 205 206 // XXX why PHOT_WEIGHT?? 200 207 pmSourcePhotometryMode photMode = PM_SOURCE_PHOT_WEIGHT; 201 208 … … 204 211 if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue; 205 212 213 // replace object in image 214 if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) { 215 pmSourceAdd (source, PM_MODEL_OP_FULL, options->maskVal); 216 } 217 218 // clear the mask bit and set the circular mask pixels 219 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(options->markVal)); 220 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", options->markVal); 221 206 222 // XXX can we test if psfMag is set and calculate only if needed? 207 pmSourceMagnitudes (source, psf, photMode, options->maskVal);223 pmSourceMagnitudes (source, psf, photMode, maskVal); // maskVal includes markVal 208 224 225 // clear the mask bit 226 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(options->markVal)); 227 228 // re-subtract the object, leave local sky 229 pmSourceSub (source, PM_MODEL_OP_FULL, options->maskVal); 230 209 231 float apMag = -2.5*log10(source->moments->Sum); 210 232 float dMag = source->psfMag - apMag; … … 288 310 pmSourcePhotometryMode photMode = PM_SOURCE_PHOT_WEIGHT; 289 311 312 psImageMaskType maskVal = options->maskVal | options->markVal; 313 290 314 for (psS32 i = 0 ; i < sources->n ; i++) { 291 315 … … 322 346 psF32 Myy = source->moments->Myy; 323 347 348 // replace object in image 349 if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) { 350 pmSourceAdd (source, PM_MODEL_OP_FULL, options->maskVal); 351 } 352 353 // clear the mask bit and set the circular mask pixels 354 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(options->markVal)); 355 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, source->apRadius, "OR", options->markVal); 356 324 357 // XXX can we test if psfMag is set and calculate only if needed? 325 pmSourceMagnitudes (source, psf, photMode, options->maskVal); 358 pmSourceMagnitudes (source, psf, photMode, maskVal); // maskVal includes markVal 359 360 // clear the mask bit 361 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(options->markVal)); 362 363 // re-subtract the object, leave local sky 364 pmSourceSub (source, PM_MODEL_OP_FULL, options->maskVal); 326 365 327 366 float apMag = -2.5*log10(source->moments->Sum); … … 336 375 bool isPSF = (fabs(nSigma) < options->nSigmaApResid) && (fabs(Mxx - psfClump->X) < options->nSigmaMoments*psfClump->dX) && (fabs(Myy - psfClump->Y) < options->nSigmaMoments*psfClump->dY); 337 376 if (isPSF) { 338 if (Mxx > 3.0) {339 fprintf (stderr, "!");340 }341 377 Npsf ++; 342 378 continue; … … 345 381 // Defects may not always match CRs from peak curvature analysis 346 382 // Defects may also be marked as SATSTAR -- XXX deactivate this flag? 383 // XXX this rule is not great 347 384 if ((Mxx < psfClump->X) || (Myy < psfClump->Y)) { 348 385 source->mode |= PM_SOURCE_MODE_DEFECT; … … 366 403 } 367 404 368 fprintf (stderr, "miss%f,%f : %f %f -- %f\n", source->peak->xf, source->peak->yf, Mxx, Myy, nSigma);405 psWarning ("sourse size was missed for %f,%f : %f %f -- %f\n", source->peak->xf, source->peak->yf, Mxx, Myy, nSigma); 369 406 Nmiss ++; 370 407 }
Note:
See TracChangeset
for help on using the changeset viewer.
