Changeset 6571 for trunk/psphot/src/psphotMagnitudes.c
- Timestamp:
- Mar 11, 2006, 5:27:13 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotMagnitudes.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotMagnitudes.c
r6495 r6571 1 1 # include "psphot.h" 2 3 // XXX EAM : the apMag should only be calculated for the brighter sources?4 // XXX EAM : SN limit set by user?5 // XXX EAM : masked region should be (optionally) elliptical6 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, float apRadius) {7 8 int status;9 bool isPSF;10 float x, y;11 float rflux;12 float radius;13 pmModel *model;14 15 switch (source->type) {16 case PM_SOURCE_STAR:17 model = source->modelPSF;18 if (model == NULL) return NULL;19 radius = (apRadius > 0) ? apRadius : model->radius;20 isPSF = true;21 break;22 23 case PM_SOURCE_EXTENDED:24 model = source->modelEXT;25 if (model == NULL) return NULL;26 radius = model->radius;27 isPSF = false;28 break;29 30 default:31 return NULL;32 }33 34 x = model->params->data.F32[2];35 y = model->params->data.F32[3];36 37 // replace source flux38 pmSourceAddModel (source->pixels, source->mask, model, false, false);39 40 // set aperture mask circle of PSF_FIT_RADIUS41 psImageKeepCircle (source->mask, x, y, radius, "OR", PSPHOT_MASK_MARKED);42 43 // measure object photometry44 status = pmSourcePhotometry (&source->fitMag, &source->apMag, model, source->pixels, source->mask);45 46 // for PSFs, correct both apMag and fitMag to same system, consistent with infinite flux star in aperture RADIUS47 if (isPSF && (psf != NULL)) {48 if (psf->growth != NULL) {49 source->apMag += pmGrowthCurveCorrect (psf->growth, model->radius);50 }51 52 rflux = pow (10.0, 0.4*source->fitMag);53 source->apMag -= PS_SQR(model->radius)*rflux * psf->skyBias + psf->skySat / rflux;54 source->fitMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0);55 }56 57 // unmask aperture58 psImageKeepCircle (source->mask, x, y, radius, "AND", ~PSPHOT_MASK_MARKED);59 60 // subtract object, leave local sky61 pmSourceSubModel (source->pixels, source->mask, model, false, false);62 63 if (!status) return NULL;64 return model;65 }66 67 /*68 aprMag' - fitMag = flux*skySat + r^2*rflux*skyBias + ApTrend(x,y)69 (aprMag - flux*skySat - r^2*rflux*skyBias) - fitMAg = ApTrend(x,y)70 (aprMag - flux*skySat - r^2*rflux*skyBias) = fitMAg + ApTrend(x,y)71 72 */73 2 74 3 bool psphotMagnitudes (psMetadata *config, psArray *sources, pmPSF *psf) { … … 88 17 } 89 18 19 // XXX should this function use RADIUS or should it
Note:
See TracChangeset
for help on using the changeset viewer.
