Changeset 36680 for branches/eam_branches/ps2-tc3-20130727/psModules/src/objects/pmSourcePhotometry.c
- Timestamp:
- Apr 21, 2014, 5:42:34 AM (12 years ago)
- Location:
- branches/eam_branches/ps2-tc3-20130727
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psModules (modified) (1 prop)
-
psModules/src/objects (modified) (1 prop)
-
psModules/src/objects/pmSourcePhotometry.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ps2-tc3-20130727
- Property svn:mergeinfo changed
-
branches/eam_branches/ps2-tc3-20130727/psModules
- Property svn:mergeinfo deleted
-
branches/eam_branches/ps2-tc3-20130727/psModules/src/objects
- Property svn:ignore
-
old new 12 12 pmSourceIO_CMF_PS1_V1.v1.c 13 13 pmSourceIO_CMF_PS1_V4.c 14 pmSourceIO_CMF_PS1_V5.c 14 15 pmSourceIO_CMF_PS1_SV1.c 15 16 pmSourceIO_CMF_PS1_SV2.c
-
- Property svn:ignore
-
branches/eam_branches/ps2-tc3-20130727/psModules/src/objects/pmSourcePhotometry.c
r34498 r36680 40 40 #include "pmSourceDiffStats.h" 41 41 #include "pmSourceSatstar.h" 42 #include "pmSourceLensing.h" 42 43 #include "pmSource.h" 43 44 #include "pmSourceFitModel.h" … … 113 114 source->apFluxErr = NAN; 114 115 116 pmModelStatus badModel = PM_MODEL_STATUS_NONE; 117 badModel |= PM_MODEL_STATUS_BADARGS; 118 badModel |= PM_MODEL_STATUS_OFFIMAGE; 119 badModel |= PM_MODEL_STATUS_NAN_CHISQ; 120 badModel |= PM_MODEL_SERSIC_PCM_FAIL_GUESS; 121 badModel |= PM_MODEL_SERSIC_PCM_FAIL_GRID; 122 badModel |= PM_MODEL_PCM_FAIL_GUESS; 123 115 124 // XXXXXX review: 116 125 // Select the 'best' model -- this is used for PSF_QF,_PERFECT & ???. isPSF is true if this … … 162 171 for (int i = 0; i < source->modelFits->n; i++) { 163 172 pmModel *model = source->modelFits->data[i]; 164 if (model->flags & PM_MODEL_STATUS_BADARGS) continue;173 if (model->flags & badModel) continue; 165 174 status = pmSourcePhotometryModel (&model->mag, NULL, model); 166 175 if (model == source->modelEXT) foundEXT = true; … … 902 911 } 903 912 913 bool pmSourceChisqModelFlux (pmSource *source, pmModel *model, psImageMaskType maskVal) 914 { 915 PS_ASSERT_PTR_NON_NULL(source, false); 916 PS_ASSERT_PTR_NON_NULL(model, false); 917 918 float dC = 0.0; 919 int Npix = 0; 920 921 psVector *params = model->params; 922 psImage *image = source->pixels; 923 psImage *modelFlux = source->modelFlux; 924 psImage *mask = source->maskObj; 925 psImage *variance = source->variance; 926 927 float Io = params->data.F32[PM_PAR_I0]; 928 929 for (int iy = 0; iy < image->numRows; iy++) { 930 for (int ix = 0; ix < image->numCols; ix++) { 931 932 // skip pixels which are masked 933 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] & maskVal) continue; 934 935 if (variance->data.F32[iy][ix] <= 0) continue; 936 937 dC += PS_SQR (image->data.F32[iy][ix] - Io*modelFlux->data.F32[iy][ix]) / variance->data.F32[iy][ix]; 938 Npix ++; 939 } 940 } 941 model->nPix = Npix; 942 model->nDOF = Npix - model->nPar; 943 model->chisq = dC; 944 model->chisqNorm = dC / model->nDOF; 945 946 return (true); 947 } 948 904 949 double pmSourceModelWeight(const pmSource *Mi, int term, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal) 905 950 {
Note:
See TracChangeset
for help on using the changeset viewer.
