Changeset 37066 for branches/eam_branches/ipp-ops-20130712/psModules/src/objects/pmSourcePhotometry.c
- Timestamp:
- Jul 17, 2014, 12:30:45 PM (12 years ago)
- Location:
- branches/eam_branches/ipp-ops-20130712/psModules
- Files:
-
- 3 edited
-
. (modified) (1 prop)
-
src/objects (modified) (1 prop)
-
src/objects/pmSourcePhotometry.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-ops-20130712/psModules
- Property svn:mergeinfo deleted
-
branches/eam_branches/ipp-ops-20130712/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 17 pmSourceIO_CMF_PS1_SV3.c 16 18 pmSourceIO_CMF_PS1_DV1.c 17 19 pmSourceIO_CMF_PS1_DV2.c 18 20 pmSourceIO_CMF_PS1_DV3.c 19 21 pmSourceIO_CMF_PS1_DV4.c
-
- Property svn:ignore
-
branches/eam_branches/ipp-ops-20130712/psModules/src/objects/pmSourcePhotometry.c
r34498 r37066 33 33 #include "pmMoments.h" 34 34 #include "pmModelFuncs.h" 35 #include "pmModelClass.h" 35 36 #include "pmModel.h" 36 37 #include "pmModelUtils.h" 37 #include "pmModelClass.h"38 38 #include "pmSourceMasks.h" 39 39 #include "pmSourceExtendedPars.h" 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; … … 321 330 322 331 // measure fitMag 323 flux = model-> modelFlux (model->params);332 flux = model->class->modelFlux (model->params); 324 333 if (flux > 0) { 325 334 mag = -2.5*log10(flux); … … 350 359 351 360 bool status; 352 int nPix = 0; 353 status = pmSourcePhotometryAper(&nPix, &source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal); 361 status = pmSourcePhotometryAper(&source->apNpixels, &source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal); 354 362 if (status) { 355 363 source->mode |= PM_SOURCE_MODE_AP_MAGS; … … 481 489 482 490 // for the full model, add all points 483 value = fabs(model-> modelFunc (NULL, params, coord) - sky);491 value = fabs(model->class->modelFunc (NULL, params, coord) - sky); 484 492 modelSum += value; 485 493 … … 884 892 885 893 // for the full model, add all points 886 float value = model-> modelFunc (NULL, params, coord);894 float value = model->class->modelFunc (NULL, params, coord); 887 895 888 896 // fprintf (stderr, "%d, %d : %f, %f : %f - %f : %f\n", … … 899 907 900 908 psFree (coord); 909 return (true); 910 } 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 901 945 return (true); 902 946 }
Note:
See TracChangeset
for help on using the changeset viewer.
