Changeset 28904
- Timestamp:
- Aug 12, 2010, 8:22:30 AM (16 years ago)
- Location:
- branches/eam_branches/ipp-20100621/psModules/src
- Files:
-
- 4 edited
-
imcombine/pmSubtraction.c (modified) (1 diff)
-
objects/pmSource.h (modified) (1 diff)
-
objects/pmSourcePhotometry.c (modified) (7 diffs)
-
objects/pmSourcePhotometry.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/psModules/src/imcombine/pmSubtraction.c
r28866 r28904 1223 1223 bool threaded = pmSubtractionThreaded(); // Running threaded? 1224 1224 1225 // XXX This is no longer used 1225 1226 psImage *convMask = NULL; // Convolved mask image (common to inputs 1 and 2) 1226 1227 if (subMask) { -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSource.h
r28822 r28904 74 74 float errMag; ///< error in psfMag OR extMag (depending on type) 75 75 float apMag; ///< apMag corresponding to psfMag or extMag (depending on type) 76 float pixWeight; ///< model-weighted coverage of valid pixels 76 float apMagRaw; ///< raw mag in given aperture 77 float apRadius; ///< radius for aperture magnitude 78 79 float psfWeightNotBad; ///< PSF-weighted coverage of unmasked (not BAD) pixels 80 float psfWeightNotPoor; ///< PSF-weighted coverage of unmasked (not POOR) pixels 81 77 82 float psfChisq; ///< probability of PSF 78 83 float crNsigma; ///< Nsigma deviation from PSF to CR 79 84 float extNsigma; ///< Nsigma deviation from PSF to EXT 80 85 float sky, skyErr; ///< The sky and its error at the center of the object 81 float apRadius;82 86 psRegion region; ///< area on image covered by selected pixels 83 87 pmSourceExtendedPars *extpars; ///< extended source parameters -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourcePhotometry.c
r28796 r28904 155 155 // measure the contribution of included pixels 156 156 if (mode & PM_SOURCE_PHOT_WEIGHT) { 157 pmSourcePixelWeight (&source->pixWeight , model, source->maskObj, maskVal);157 pmSourcePixelWeight (&source->pixWeightNotBad, &source->pixWeightNotPoor, model, source->maskObj, maskVal, markVal); 158 158 } 159 159 … … 201 201 202 202 // measure object aperture photometry 203 status = pmSourcePhotometryAper (&source->apMag , model, flux, mask, maskVal);203 status = pmSourcePhotometryAper (&source->apMagRaw, model, flux, mask, maskVal); 204 204 if (!status) { 205 205 psTrace ("psModules.objects", 3, "fail mag : bad Ap Mag"); … … 211 211 if (isfinite (source->apMag) && isPSF && psf) { 212 212 if (psf->growth && (mode & PM_SOURCE_PHOT_GROWTH)) { 213 source->apMag +=pmGrowthCurveCorrect (psf->growth, source->apRadius);213 source->apMag = source->apMagRaw + pmGrowthCurveCorrect (psf->growth, source->apRadius); 214 214 } 215 215 if (mode & PM_SOURCE_PHOT_APCORR) { 216 216 // XXX this should be removed -- we no longer fit for the 'sky bias' 217 // XXX is this happening??? 217 218 rflux = pow (10.0, 0.4*source->psfMag); 219 psAssert (psf->skyBias == 0.0, "sky bias not 0"); 220 psAssert (psf->skySat == 0.0, "sky sat not 0"); 218 221 source->apMag -= PS_SQR(source->apRadius)*rflux * psf->skyBias + psf->skySat / rflux; 219 222 } … … 306 309 307 310 // return source aperture magnitude 308 bool pmSourcePixelWeight (float *pixWeight , pmModel *model, psImage *mask, psImageMaskType maskVal)311 bool pmSourcePixelWeight (float *pixWeightNotBad, float *pixWeightNotPoor, pmModel *model, psImage *mask, psImageMaskType maskVal, psImageMaskType markVal) 309 312 { 310 313 PS_ASSERT_PTR_NON_NULL(pixWeight, false); … … 313 316 314 317 float modelSum = 0; 315 float validSum = 0; 318 float notBadSum = 0; 319 float notPoorSum = 0; 316 320 float sky = 0; 317 321 float value; … … 321 325 int dY, DY, NY; 322 326 323 *pixWeight = 0.0; 327 *pixWeightNotBad = 0.0; 328 *pixWeightNotPoor = 0.0; 324 329 325 330 // we only care about the value of the object model, not the local sky … … 361 366 362 367 // for the full model, add all points 363 value = model->modelFunc (NULL, params, coord) - sky;368 value = fabs(model->modelFunc (NULL, params, coord) - sky); 364 369 modelSum += value; 365 370 366 371 // include count only the unmasked pixels within the image area 367 if (mx < 0) 368 continue; 369 if (my < 0) 370 continue; 371 if (mx >= NX) 372 continue; 373 if (my >= NY) 374 continue; 375 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskVal) 376 continue; 377 378 validSum += value; 372 if (mx < 0) continue; 373 if (my < 0) continue; 374 if (mx >= NX) continue; 375 if (my >= NY) continue; 376 377 if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskVal)) { 378 notBadSum += value; 379 } 380 if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & ~markVal)) { 381 notPoorSum += value; 382 } 379 383 } 380 384 } 381 385 psFree (coord); 382 386 383 if (validSum <= 0) 384 return false; 385 386 *pixWeight = validSum / modelSum; 387 *pixWeightNotBad = notBadSum / modelSum; 388 *pixWeightNotPoor = notPoorSum / modelSum; 389 387 390 return (true); 388 391 } -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourcePhotometry.h
r28692 r28904 53 53 bool pmSourceMagnitudesInit (psMetadata *config); 54 54 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal, psImageMaskType markVal); 55 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *mask, psImageMaskType maskVal); 55 56 bool pmSourcePixelWeight (float *pixWeightNotBad, float *pixWeightNotPoor, pmModel *model, psImage *mask, psImageMaskType maskVal, psImageMaskType markVal); 57 56 58 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psImageMaskType maskVal, const float covarFactor); 57 59
Note:
See TracChangeset
for help on using the changeset viewer.
