Changeset 5837 for trunk/psphot/src/psphotMagnitudes.c
- Timestamp:
- Dec 23, 2005, 1:58:45 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotMagnitudes.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotMagnitudes.c
r5828 r5837 1 1 # include "psphot.h" 2 2 3 // XXX EAM : the apMag should only be calculated for the brighter sources 3 // XXX EAM : the apMag should only be calculated for the brighter sources? 4 4 // XXX EAM : SN limit set by user? 5 5 // XXX EAM : masked region should be (optionally) elliptical … … 7 7 8 8 int status; 9 bool isPSF; 9 10 float x, y; 10 11 float rflux; 12 float radius; 11 13 pmModel *model; 12 14 13 // use the correct model (PSF vs FLT) 14 if (psf != NULL) { 15 model = source->modelPSF; 16 } else { 17 model = source->modelFLT; 15 switch (source->type) { 16 case PM_SOURCE_STAR: 17 model = source->modelPSF; 18 if (model == NULL) return NULL; 19 radius = apRadius; 20 isPSF = true; 21 break; 22 23 case PM_SOURCE_GALAXY: 24 model = source->modelFLT; 25 if (model == NULL) return NULL; 26 radius = model->radius; 27 isPSF = false; 28 break; 29 30 default: 31 return NULL; 18 32 } 19 if (model == NULL) return NULL;20 33 21 x = source->peak->x; 22 y = source->peak->y; 23 24 // we have already (psphotApplyPSF) defined pixels at least OUTER_RADIUS from source 25 // we need to mask pixels to measure the aperture magnitude 26 // set aperture mask circle of PSF_FIT_RADIUS 27 psImageKeepCircle (source->mask, x, y, apRadius, "OR", PSPHOT_MASK_MARKED); 34 x = model->params->data.F32[2]; 35 y = model->params->data.F32[3]; 28 36 29 37 // replace source flux 30 38 pmSourceAddModel (source->pixels, source->mask, model, false, false); 39 40 // set aperture mask circle of PSF_FIT_RADIUS 41 psImageKeepCircle (source->mask, x, y, radius, "OR", PSPHOT_MASK_MARKED); 31 42 32 43 // measure object photometry … … 34 45 35 46 // for PSFs, correct both apMag and fitMag to same system, consistent with infinite flux star in aperture RADIUS 36 if ( psf != NULL) {47 if (isPSF && (psf != NULL)) { 37 48 rflux = pow (10.0, 0.4*source->fitMag); 38 49 source->apMag -= rflux * psf->skyBias * (M_PI * PS_SQR(apRadius)); … … 44 55 45 56 // unmask aperture 46 psImageKeepCircle (source->mask, x, y, apRadius, "AND", ~PSPHOT_MASK_MARKED); 57 psImageKeepCircle (source->mask, x, y, radius, "AND", ~PSPHOT_MASK_MARKED); 58 59 if (!status) return NULL; 47 60 return model; 48 }49 50 pmModel *pmSourceSelectModel (pmSource *source) {51 52 pmModel *model;53 54 switch (source->type) {55 56 // use PSF model with stars57 case PM_SOURCE_STAR:58 model = source->modelPSF;59 break;60 61 // use FLT model with galaxies62 case PM_SOURCE_GALAXY:63 model = source->modelFLT;64 break;65 66 // skip defects and poorly fitted stars or galaxies67 default:68 model = NULL;69 }70 return (model);71 61 } 72 62
Note:
See TracChangeset
for help on using the changeset viewer.
