Changeset 31327
- Timestamp:
- Apr 20, 2011, 10:52:17 AM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110404/psModules/src/objects
- Files:
-
- 4 edited
-
pmGrowthCurveGenerate.c (modified) (1 diff)
-
pmSourceMoments.c (modified) (4 diffs)
-
pmSourcePhotometry.c (modified) (5 diffs)
-
pmSourcePhotometry.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110404/psModules/src/objects/pmGrowthCurveGenerate.c
r29546 r31327 197 197 // mask the given aperture and measure the apMag 198 198 psImageKeepCircle (mask, xc, yc, radius, "OR", markVal); 199 if (!pmSourcePhotometryAper ( &apMag, NULL, NULL, model, pixels, NULL, mask, maskVal)) {199 if (!pmSourcePhotometryAper (NULL, &apMag, NULL, NULL, model, pixels, NULL, mask, maskVal)) { 200 200 psFree (growth); 201 201 psFree (view); -
branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourceMoments.c
r31312 r31327 130 130 Sum = 0.0; // the second pass may include slightly different pixels, re-determine Sum 131 131 132 // float dX = source->moments->Mx - source->peak->xf; 133 // float dY = source->moments->My - source->peak->yf; 134 // float dR = hypot(dX, dY); 135 // float Xo = (dR < 2.0) ? source->moments->Mx : source->peak->xf; 136 // float Yo = (dR < 2.0) ? source->moments->My : source->peak->yf; 137 float Xo = source->moments->Mx; 138 float Yo = source->moments->My; 139 132 140 // center of mass in subimage. Note: the calculation below uses pixel index, so we correct 133 141 // xCM, yCM from pixel coords to pixel index here. 134 psF32 xCM = source->moments->Mx- 0.5 - source->pixels->col0; // coord of peak in subimage135 psF32 yCM = source->moments->My- 0.5 - source->pixels->row0; // coord of peak in subimage142 psF32 xCM = Xo - 0.5 - source->pixels->col0; // coord of peak in subimage 143 psF32 yCM = Yo - 0.5 - source->pixels->row0; // coord of peak in subimage 136 144 137 145 for (psS32 row = 0; row < source->pixels->numRows ; row++) { … … 142 150 psF32 *vPix = source->pixels->data.F32[row]; 143 151 psF32 *vWgt = source->variance->data.F32[row]; 152 144 153 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; 154 // psImageMaskType *vMsk = (source->maskView == NULL) ? NULL : source->maskView->data.PS_TYPE_IMAGE_MASK_DATA[row]; 145 155 146 156 for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) { … … 280 290 psF32 *vPix = source->pixels->data.F32[row]; 281 291 psF32 *vWgt = source->variance->data.F32[row]; 292 282 293 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; 294 // psImageMaskType *vMsk = (source->maskView == NULL) ? NULL : source->maskView->data.PS_TYPE_IMAGE_MASK_DATA[row]; 283 295 284 296 for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) { … … 391 403 psF32 *vPix = source->pixels->data.F32[row]; 392 404 psF32 *vWgt = source->variance->data.F32[row]; 405 393 406 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; 407 // psImageMaskType *vMsk = (source->maskView == NULL) ? NULL : source->maskView->data.PS_TYPE_IMAGE_MASK_DATA[row]; 394 408 395 409 for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) { -
branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourcePhotometry.c
r31312 r31327 102 102 bool isPSF; 103 103 float x, y; 104 float rflux;105 104 float SN; 106 105 pmModel *model; … … 246 245 // XXX correct the apFlux? 247 246 } 248 if (mode & PM_SOURCE_PHOT_APCORR) {249 // XXX this should be removed -- we no longer fit for the 'sky bias'250 // XXX is this happening???251 rflux = pow (10.0, 0.4*source->psfMag);252 psAssert (psf->skyBias == 0.0, "sky bias not 0");253 psAssert (psf->skySat == 0.0, "sky sat not 0");254 source->apMag -= PS_SQR(source->apRadius)*rflux * psf->skyBias + psf->skySat / rflux;255 }256 247 } 257 248 if (mode & PM_SOURCE_PHOT_INTERP) { … … 309 300 310 301 bool status; 311 status = pmSourcePhotometryAper(&source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal); 302 int nPix = 0; 303 status = pmSourcePhotometryAper(&nPix, &source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal); 312 304 if (status) { 313 305 source->mode |= PM_SOURCE_MODE_AP_MAGS; 314 306 } 315 316 307 return status; 317 308 } 318 309 319 310 // return source aperture magnitude 320 bool pmSourcePhotometryAper ( float *apMag, float *apFluxOut, float *apFluxErr, pmModel *model, psImage *image, psImage *variance, psImage *mask, psImageMaskType maskVal)311 bool pmSourcePhotometryAper (int *nPixOut, float *apMag, float *apFluxOut, float *apFluxErr, pmModel *model, psImage *image, psImage *variance, psImage *mask, psImageMaskType maskVal) 321 312 { 322 313 PS_ASSERT_PTR_NON_NULL(apMag, false); … … 331 322 float apFlux = 0; 332 323 float apFluxVar = 0; 324 int nPix = 0; 333 325 334 326 if (DO_SKY) { … … 348 340 apFlux += imData[iy][ix] - sky; 349 341 apFluxVar += varData[iy][ix]; 350 } 351 } 342 nPix ++; 343 } 344 } 345 352 346 if (apFluxOut) *apFluxOut = apFlux; 353 347 if (apFluxErr) *apFluxErr = sqrt(fabs(apFluxVar)); 348 if (nPixOut) *nPixOut = nPix; 354 349 355 350 if (apFlux <= 0) { -
branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourcePhotometry.h
r31153 r31327 45 45 46 46 bool pmSourcePhotometryAper( 47 int *nPixOut, 47 48 float *apMag, 48 49 float *apFluxOut,
Note:
See TracChangeset
for help on using the changeset viewer.
