Changeset 36860
- Timestamp:
- Jun 13, 2014, 8:47:47 AM (12 years ago)
- Location:
- trunk/psModules/src/objects
- Files:
-
- 7 edited
-
pmModelFuncs.h (modified) (1 diff)
-
pmSource.c (modified) (4 diffs)
-
pmSource.h (modified) (1 diff)
-
pmSourceIO_CMF.c.in (modified) (6 diffs)
-
pmSourceOutputs.c (modified) (3 diffs)
-
pmSourceOutputs.h (modified) (1 diff)
-
pmSourcePhotometry.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmModelFuncs.h
r36375 r36860 110 110 typedef psF64 (*pmModelRadius)(const psVector *params, double flux); 111 111 112 // This function returns the FWHM given the supplied sigma (major or minor) 113 typedef psF64 (*pmModelSetFWHM)(const psVector *params, double sigma); 114 112 115 // This function provides the model guess parameters based on the details of 113 116 // the given source. -
trunk/psModules/src/objects/pmSource.c
r36747 r36860 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" … … 146 146 source->apMagRaw = NAN; 147 147 source->apRadius = NAN; 148 source->apNpixels = 0; 148 149 source->apFlux = NAN; 149 150 source->apFluxErr = NAN; … … 237 238 source->apMagRaw = in->apMagRaw; 238 239 source->apRadius = in->apRadius; 240 source->apNpixels = in->apNpixels; 239 241 source->apFlux = in->apFlux; 240 242 source->apFluxErr = in->apFluxErr; … … 987 989 if (!isfinite(oldI0)) return false; 988 990 989 bool useReff = pmModelUseReff (model->type);991 bool useReff = model->class->useReff; 990 992 pmModelParamsToAxes (&axes, PAR[PM_PAR_SXX], PAR[PM_PAR_SXY], PAR[PM_PAR_SYY], useReff); 991 993 -
trunk/psModules/src/objects/pmSource.h
r36747 r36860 97 97 float apMagRaw; ///< raw mag in given aperture 98 98 float apRadius; ///< radius for aperture magnitude 99 int apNpixels; ///< number of unmasked pixels in aperture 99 100 float apFlux; ///< apFlux corresponding to psfMag or extMag (depending on type) 100 101 float apFluxErr; ///< apFluxErr corresponding to psfMag or extMag (depending on type) -
trunk/psModules/src/objects/pmSourceIO_CMF.c.in
r36758 r36860 37 37 #include "pmMoments.h" 38 38 #include "pmModelFuncs.h" 39 #include "pmModelClass.h" 39 40 #include "pmModel.h" 40 41 #include "pmModelUtils.h" 41 #include "pmModelClass.h"42 42 #include "pmSourceMasks.h" 43 43 #include "pmSourceExtendedPars.h" … … 142 142 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG", PS_DATA_F32, "magnitude in standard aperture", source->apMag); 143 143 @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RAW", PS_DATA_F32, "magnitude in reported aperture", source->apMagRaw); 144 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS", PS_DATA_F32, "radius used for aperture mags", outputs.apRadius);144 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS", PS_DATA_F32, "radius used for aperture mags", source->apRadius); 145 145 @>PS1_DV1,>PS1_V3,>PS1_SV1@ psMetadataAdd (row, PS_LIST_TAIL, "AP_FLUX", PS_DATA_F32, "instrumental flux in standard aperture", source->apFlux); 146 146 @>PS1_DV1,>PS1_V3,>PS1_SV1@ psMetadataAdd (row, PS_LIST_TAIL, "AP_FLUX_SIG", PS_DATA_F32, "aperture flux error", source->apFluxErr); 147 @>PS1_V4,>PS1_SV2,>PS1_DV3@ psMetadataAdd (row, PS_LIST_TAIL, "AP_NPIX", PS_DATA_S32, "aperture unmasked pixels", source->apNpixels); 147 148 148 149 @<PS1_V3,PS1_SV1,PS1_DV?@ psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", outputs.peakMag); … … 163 164 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "EXT_NSIGMA", PS_DATA_F32, "Nsigma deviations from PSF to EXT", source->extNsigma); 164 165 166 // PSF shape parameters: 165 167 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_MAJOR", PS_DATA_F32, "PSF width (major axis)", outputs.psfMajor); 166 168 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_MINOR", PS_DATA_F32, "PSF width (minor axis)", outputs.psfMinor); 167 169 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_THETA", PS_DATA_F32, "PSF orientation angle", outputs.psfTheta); 170 @>PS1_V4,>PS1_SV2,>PS1_DV3@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_CORE", PS_DATA_F32, "k term if defined", outputs.psfCore); 171 172 // I use a look-up table and linear interpolation to map PSF_MAJOR,PSF_MINOR + PSF_CORE to FWHM values 173 @>PS1_V4,>PS1_SV2,>PS1_DV3@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_FWHM_MAJ", PS_DATA_F32, "PSF FWHM (major axis)", outputs.psfMajorFWHM); 174 @>PS1_V4,>PS1_SV2,>PS1_DV3@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_FWHM_MIN", PS_DATA_F32, "PSF FWHM (minor axis)", outputs.psfMinorFWHM); 175 176 // psf data quality 168 177 @ALL@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_QF", PS_DATA_F32, "PSF coverage/quality factor (bad)", source->pixWeightNotBad); 169 178 @>PS1_V2,PS1_SV?,>PS1_DV1@ psMetadataAdd (row, PS_LIST_TAIL, "PSF_QF_PERFECT", PS_DATA_F32, "PSF coverage/quality factor (poor)", source->pixWeightNotPoor); … … 344 353 @ALL@ axes.theta = psMetadataLookupF32 (&status, row, "PSF_THETA"); 345 354 @ALL@ axes.theta = axes.theta * PS_RAD_DEG; 355 356 @>PS1_V4,>PS1_SV2,>PS1_DV3@ if (model->params->n >= PM_PAR_7) { 357 @>PS1_V4,>PS1_SV2,>PS1_DV3@ PAR[PM_PAR_7] = psMetadataLookupF32 (&status, row, "PSF_CORE"); 358 @>PS1_V4,>PS1_SV2,>PS1_DV3@ } 346 359 347 360 @ALL@ PAR[PM_PAR_SKY] = psMetadataLookupF32 (&status, row, "SKY"); … … 383 396 @ALL@ source->crNsigma = psMetadataLookupF32 (&status, row, "CR_NSIGMA"); 384 397 @ALL@ source->extNsigma = psMetadataLookupF32 (&status, row, "EXT_NSIGMA"); 385 @ALL@ source->apRadius = psMetadataLookupS32 (&status, row, "AP_MAG_RADIUS"); 398 @ALL@ source->apRadius = psMetadataLookupF32 (&status, row, "AP_MAG_RADIUS"); 399 @>PS1_V4,>PS1_SV2,>PS1_DV3@ source->apNpixels = psMetadataLookupS32 (&status, row, "AP_NPIX"); 386 400 387 401 // note that some older versions used PSF_PROBABILITY: this was not well defined. … … 982 996 psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_THETA_ERR", 0, "EXT angle err (SXY, isnan)", dPAR[PM_PAR_SXY]); 983 997 } else { 984 psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model-> type);998 psEllipseAxes axes = pmPSF_ModelToAxes (PAR, model->class->useReff); 985 999 psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MAJ", 0, "EXT width (major axis), length for trail", axes.major); 986 1000 psMetadataAddF32 (row, PS_LIST_TAIL, "EXT_WIDTH_MIN", 0, "EXT width (minor axis), sigma for trail", axes.minor); -
trunk/psModules/src/objects/pmSourceOutputs.c
r36623 r36860 26 26 #include "pmMoments.h" 27 27 #include "pmModelFuncs.h" 28 #include "pmModelClass.h" 28 29 #include "pmModel.h" 29 30 #include "pmModelUtils.h" 30 #include "pmModelClass.h"31 31 #include "pmSourceMasks.h" 32 32 #include "pmSourceExtendedPars.h" … … 108 108 } 109 109 if (isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXY]) && isfinite(PAR[PM_PAR_SYY])) { 110 axes = pmPSF_ModelToAxes (PAR, model-> type);110 axes = pmPSF_ModelToAxes (PAR, model->class->useReff); 111 111 outputs->psfMajor = axes.major; 112 112 outputs->psfMinor = axes.minor; 113 113 outputs->psfTheta = axes.theta*PS_DEG_RAD; 114 115 // some models (PS1_V1, QGAUSS) have an extra 'core' parameter 116 outputs->psfCore = NAN; 117 if (model->type == pmModelClassGetType ("PS_MODEL_PS1_V1")) { 118 outputs->psfCore = PAR[PM_PAR_7]; 119 } 120 if (model->type == pmModelClassGetType ("PS_MODEL_QGAUSS")) { 121 outputs->psfCore = PAR[PM_PAR_7]; 122 } 123 124 outputs->psfMajorFWHM = model->class->modelSetFWHM(model->params, axes.major); 125 outputs->psfMinorFWHM = model->class->modelSetFWHM(model->params, axes.minor); 114 126 } else { 115 127 outputs->psfMajor = NAN; 116 128 outputs->psfMinor = NAN; 117 129 outputs->psfTheta = NAN; 130 outputs->psfCore = NAN; 118 131 } 119 132 outputs->chisq = model->chisq; 120 133 outputs->nDOF = model->nDOF; 121 134 outputs->nPix = model->nPix; 122 outputs->apRadius = source->apRadius;123 135 } else { 124 136 bool useMoments = pmSourcePositionUseMoments(source); … … 138 150 outputs->psfMinor = NAN; 139 151 outputs->psfTheta = NAN; 152 outputs->psfCore = NAN; 140 153 outputs->chisq = NAN; 141 154 outputs->nDOF = 0; 142 155 outputs->nPix = 0; 143 outputs->apRadius = NAN;144 156 } 145 157 -
trunk/psModules/src/objects/pmSourceOutputs.h
r33690 r36860 26 26 float psfMinor; 27 27 float psfTheta; 28 float psfCore; 29 float psfMajorFWHM; 30 float psfMinorFWHM; 28 31 float chisq; 29 float apRadius;30 32 int nPix; 31 33 int nDOF; -
trunk/psModules/src/objects/pmSourcePhotometry.c
r36623 r36860 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" … … 330 330 331 331 // measure fitMag 332 flux = model-> modelFlux (model->params);332 flux = model->class->modelFlux (model->params); 333 333 if (flux > 0) { 334 334 mag = -2.5*log10(flux); … … 359 359 360 360 bool status; 361 int nPix = 0; 362 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); 363 362 if (status) { 364 363 source->mode |= PM_SOURCE_MODE_AP_MAGS; … … 490 489 491 490 // for the full model, add all points 492 value = fabs(model-> modelFunc (NULL, params, coord) - sky);491 value = fabs(model->class->modelFunc (NULL, params, coord) - sky); 493 492 modelSum += value; 494 493 … … 893 892 894 893 // for the full model, add all points 895 float value = model-> modelFunc (NULL, params, coord);894 float value = model->class->modelFunc (NULL, params, coord); 896 895 897 896 // fprintf (stderr, "%d, %d : %f, %f : %f - %f : %f\n",
Note:
See TracChangeset
for help on using the changeset viewer.
