- Timestamp:
- Mar 31, 2006, 4:47:20 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/objects/pmSourcePhotometry.c
r6556 r6751 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.1.2. 2$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-0 3-09 03:14:23$5 * @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-04-01 02:47:20 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 55 55 // XXX EAM : masked region should be (optionally) elliptical 56 56 // XXX curve of growth is corrected to 57 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, float apRadius)57 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, bool growthCorr, bool apTrendCorr) 58 58 { 59 59 … … 62 62 float x, y; 63 63 float rflux; 64 float radius;65 64 float SN; 66 65 pmModel *model; … … 71 70 if (model == NULL) 72 71 return NULL; 73 radius = (apRadius > 0) ? apRadius : model->radius;74 72 isPSF = true; 75 73 break; … … 79 77 if (model == NULL) 80 78 return NULL; 81 radius = model->radius;82 79 isPSF = false; 83 80 break; … … 101 98 pmModelAdd (source->pixels, source->mask, model, false, false); 102 99 103 // set aperture mask circle to scaledradius104 psImageKeepCircle (source->mask, x, y, model->radius , "OR", PM_SOURCE_MASK_MARKED);100 // set aperture mask circle to model radius 101 psImageKeepCircle (source->mask, x, y, model->radiusTMP, "OR", PM_SOURCE_MASK_MARKED); 105 102 106 103 // measure object model photometry … … 110 107 // measure object aperture photometry 111 108 if (SN > AP_MIN_SN) { 112 status = pmSourcePhotometryAper (&source->apMag, model, source->pixels, source->mask);109 status = pmSourcePhotometryAper (&source->apMag, model, source->pixels, source->mask); 113 110 } else { 114 111 source->apMag = 99.0; … … 118 115 if (isPSF && (psf != NULL)) { 119 116 if (SN > AP_MIN_SN) { 120 if ( psf->growth != NULL) {121 source->apMag += pmGrowthCurveCorrect (psf->growth, radius);117 if ((psf->growth != NULL) && growthCorr) { 118 source->apMag += pmGrowthCurveCorrect (psf->growth, model->radiusTMP); 122 119 } 123 rflux = pow (10.0, 0.4*source->psfMag); 124 source->apMag -= PS_SQR(model->radius)*rflux * psf->skyBias + psf->skySat / rflux; 125 } 126 source->psfMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0); 120 if (apTrendCorr) { 121 rflux = pow (10.0, 0.4*source->psfMag); 122 source->apMag -= PS_SQR(model->radiusTMP)*rflux * psf->skyBias + psf->skySat / rflux; 123 } 124 } 125 if (apTrendCorr) { 126 source->psfMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0); 127 } 127 128 } 128 129 129 130 // unmask aperture 130 psImageKeepCircle (source->mask, x, y, model->radius , "AND", ~PM_SOURCE_MASK_MARKED);131 psImageKeepCircle (source->mask, x, y, model->radiusTMP, "AND", ~PM_SOURCE_MASK_MARKED); 131 132 132 133 // subtract object, leave local sky … … 168 169 } 169 170 171 # define DO_SKY 0 170 172 // return source aperture magnitude 171 173 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask) 172 174 { 173 174 175 float apSum = 0; 176 float sky = 0; 175 177 *apMag = 99.0; 176 178 … … 179 181 } 180 182 181 float sky = model->params->data.F32[0]; 183 if (DO_SKY) { 184 sky = model->params->data.F32[0]; 185 } else { 186 sky = 0; 187 } 182 188 183 189 // measure apMag … … 191 197 if (apSum <= 0) 192 198 return false; 199 193 200 *apMag = -2.5*log10(apSum); 194 195 201 return (true); 196 202 }
Note:
See TracChangeset
for help on using the changeset viewer.
