Changeset 36375 for trunk/psModules/src/objects/pmSourcePhotometry.c
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
trunk/psModules
- Property svn:mergeinfo changed
-
trunk/psModules/src/objects/pmSourcePhotometry.c
r34498 r36375 113 113 source->apFluxErr = NAN; 114 114 115 pmModelStatus badModel = PM_MODEL_STATUS_NONE; 116 badModel |= PM_MODEL_STATUS_BADARGS; 117 badModel |= PM_MODEL_STATUS_OFFIMAGE; 118 badModel |= PM_MODEL_STATUS_NAN_CHISQ; 119 badModel |= PM_MODEL_SERSIC_PCM_FAIL_GUESS; 120 badModel |= PM_MODEL_SERSIC_PCM_FAIL_GRID; 121 badModel |= PM_MODEL_PCM_FAIL_GUESS; 122 115 123 // XXXXXX review: 116 124 // Select the 'best' model -- this is used for PSF_QF,_PERFECT & ???. isPSF is true if this … … 162 170 for (int i = 0; i < source->modelFits->n; i++) { 163 171 pmModel *model = source->modelFits->data[i]; 164 if (model->flags & PM_MODEL_STATUS_BADARGS) continue;172 if (model->flags & badModel) continue; 165 173 status = pmSourcePhotometryModel (&model->mag, NULL, model); 166 174 if (model == source->modelEXT) foundEXT = true; … … 902 910 } 903 911 912 bool pmSourceChisqModelFlux (pmSource *source, pmModel *model, psImageMaskType maskVal) 913 { 914 PS_ASSERT_PTR_NON_NULL(source, false); 915 PS_ASSERT_PTR_NON_NULL(model, false); 916 917 float dC = 0.0; 918 int Npix = 0; 919 920 psVector *params = model->params; 921 psImage *image = source->pixels; 922 psImage *modelFlux = source->modelFlux; 923 psImage *mask = source->maskObj; 924 psImage *variance = source->variance; 925 926 float Io = params->data.F32[PM_PAR_I0]; 927 928 for (int iy = 0; iy < image->numRows; iy++) { 929 for (int ix = 0; ix < image->numCols; ix++) { 930 931 // skip pixels which are masked 932 if (mask->data.PS_TYPE_IMAGE_MASK_DATA[iy][ix] & maskVal) continue; 933 934 if (variance->data.F32[iy][ix] <= 0) continue; 935 936 dC += PS_SQR (image->data.F32[iy][ix] - Io*modelFlux->data.F32[iy][ix]) / variance->data.F32[iy][ix]; 937 Npix ++; 938 } 939 } 940 model->nPix = Npix; 941 model->nDOF = Npix - model->nPar; 942 model->chisq = dC; 943 model->chisqNorm = dC / model->nDOF; 944 945 return (true); 946 } 947 904 948 double pmSourceModelWeight(const pmSource *Mi, int term, const pmSourceFitVarMode fitVarMode, const float covarFactor, psImageMaskType maskVal) 905 949 {
Note:
See TracChangeset
for help on using the changeset viewer.
