- Timestamp:
- Apr 17, 2006, 7:10:08 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/rel10_ifa/psModules/src/objects/pmSourcePhotometry.c
r6859 r6864 3 3 * @author EAM, IfA; GLG, MHPCC 4 4 * 5 * @version $Revision: 1.1.2. 4$ $Name: not supported by cvs2svn $6 * @date $Date: 2006-04-1 4 21:43:59$5 * @version $Revision: 1.1.2.5 $ $Name: not supported by cvs2svn $ 6 * @date $Date: 2006-04-17 17:10:08 $ 7 7 * 8 8 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 56 56 57 57 // XXX EAM : masked region should be (optionally) elliptical 58 // XXX curve of growth is corrected to 59 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, bool growthCorr, bool apTrendCorr) 60 { 61 62 int status; 58 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode) 59 { 60 61 int status = false; 63 62 bool isPSF; 64 63 float x, y; … … 67 66 pmModel *model; 68 67 68 source->psfMag = 99.0; 69 source->extMag = 99.0; 70 source->errMag = 99.0; 71 source->apMag = 99.0; 72 69 73 switch (source->type) { 70 74 case PM_SOURCE_TYPE_STAR: 71 75 model = source->modelPSF; 72 76 if (model == NULL) 73 return NULL;77 return false; 74 78 isPSF = true; 75 79 break; … … 78 82 model = source->modelEXT; 79 83 if (model == NULL) 80 return NULL;84 return false; 81 85 isPSF = false; 82 86 break; 83 87 84 88 default: 85 return NULL;89 return false; 86 90 } 87 91 … … 96 100 y = model->params->data.F32[3]; 97 101 102 // measure object model photometry 103 status = pmSourcePhotometryModel (&source->psfMag, source->modelPSF); 104 status = pmSourcePhotometryModel (&source->extMag, source->modelEXT); 105 // for PSFs, correct both apMag and psfMag to same system, consistent with infinite flux star in aperture RADIUS 106 if ((mode & PM_SOURCE_PHOT_APCORR) && isPSF && psf) { 107 // convert to the equivalent 2D model? 108 source->psfMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0); 109 } 110 111 if (SN < AP_MIN_SN) 112 return false; 113 98 114 // replace source flux 99 115 // XXX test to see if source has been subtracted? … … 103 119 psImageKeepCircle (source->mask, x, y, model->radiusTMP, "OR", PM_SOURCE_MASK_MARKED); 104 120 105 // measure object model photometry106 status = pmSourcePhotometryModel (&source->psfMag, source->modelPSF);107 status = pmSourcePhotometryModel (&source->extMag, source->modelEXT);108 109 121 // measure the weight of included pixels 110 status = pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->mask); 122 if (mode & PM_SOURCE_PHOT_WEIGHT) { 123 pmSourcePixelWeight (&source->pixWeight, model, source->pixels, source->mask); 124 } 111 125 112 126 // measure object aperture photometry 113 if (SN > AP_MIN_SN) { 114 status = pmSourcePhotometryAper (&source->apMag, model, source->pixels, source->mask); 115 } else { 116 source->apMag = 99.0; 117 } 127 status = pmSourcePhotometryAper (&source->apMag, model, source->pixels, source->mask); 118 128 119 129 // for PSFs, correct both apMag and psfMag to same system, consistent with infinite flux star in aperture RADIUS 120 if (isPSF && (psf != NULL)) { 121 if (SN > AP_MIN_SN) { 122 if ((psf->growth != NULL) && growthCorr) { 123 source->apMag += pmGrowthCurveCorrect (psf->growth, model->radiusTMP); 124 } 125 if (apTrendCorr) { 126 rflux = pow (10.0, 0.4*source->psfMag); 127 source->apMag -= PS_SQR(model->radiusTMP)*rflux * psf->skyBias + psf->skySat / rflux; 128 } 129 } 130 if (apTrendCorr) { 131 source->psfMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0); 130 if (status && isPSF && psf) { 131 if (psf->growth && (mode & PM_SOURCE_PHOT_GROWTH)) { 132 source->apMag += pmGrowthCurveCorrect (psf->growth, model->radiusTMP); 133 } 134 if (mode & PM_SOURCE_PHOT_APCORR) { 135 rflux = pow (10.0, 0.4*source->psfMag); 136 source->apMag -= PS_SQR(model->radiusTMP)*rflux * psf->skyBias + psf->skySat / rflux; 132 137 } 133 138 } … … 139 144 pmModelSub (source->pixels, source->mask, model, false, false); 140 145 141 if (!status) 142 return NULL; 143 return model; 146 return status; 144 147 } 145 148
Note:
See TracChangeset
for help on using the changeset viewer.
