Changeset 31451
- Timestamp:
- May 5, 2011, 11:02:53 AM (15 years ago)
- Location:
- trunk/psModules
- Files:
-
- 49 edited
- 1 copied
-
src/camera/pmFPAMaskWeight.c (modified) (1 diff)
-
src/imcombine/pmPSFEnvelope.c (modified) (1 diff)
-
src/imcombine/pmSubtractionStamps.c (modified) (1 diff)
-
src/objects/Makefile.am (modified) (1 diff)
-
src/objects/models/pmModel_DEV.c (modified) (1 diff)
-
src/objects/models/pmModel_EXP.c (modified) (1 diff)
-
src/objects/models/pmModel_PGAUSS.c (modified) (1 diff)
-
src/objects/models/pmModel_PS1_V1.c (modified) (1 diff)
-
src/objects/models/pmModel_QGAUSS.c (modified) (1 diff)
-
src/objects/models/pmModel_RGAUSS.c (modified) (1 diff)
-
src/objects/models/pmModel_SERSIC.c (modified) (1 diff)
-
src/objects/pmGrowthCurve.c (modified) (3 diffs)
-
src/objects/pmGrowthCurve.h (modified) (1 diff)
-
src/objects/pmGrowthCurveGenerate.c (modified) (3 diffs)
-
src/objects/pmGrowthCurveGenerate.h (copied) (copied from branches/eam_branches/ipp-20110404/psModules/src/objects/pmGrowthCurveGenerate.h )
-
src/objects/pmPCMdata.c (modified) (2 diffs)
-
src/objects/pmPSF.c (modified) (3 diffs)
-
src/objects/pmPSF.h (modified) (5 diffs)
-
src/objects/pmPSF_IO.c (modified) (11 diffs)
-
src/objects/pmPSFtryFitPSF.c (modified) (2 diffs)
-
src/objects/pmPeaks.c (modified) (3 diffs)
-
src/objects/pmPeaks.h (modified) (2 diffs)
-
src/objects/pmSource.c (modified) (9 diffs)
-
src/objects/pmSource.h (modified) (4 diffs)
-
src/objects/pmSourceIO_CMF_PS1_DV1.c (modified) (2 diffs)
-
src/objects/pmSourceIO_CMF_PS1_DV2.c (modified) (2 diffs)
-
src/objects/pmSourceIO_CMF_PS1_SV1.c (modified) (3 diffs)
-
src/objects/pmSourceIO_CMF_PS1_V1.c (modified) (2 diffs)
-
src/objects/pmSourceIO_CMF_PS1_V2.c (modified) (2 diffs)
-
src/objects/pmSourceIO_CMF_PS1_V3.c (modified) (4 diffs)
-
src/objects/pmSourceIO_CMP.c (modified) (3 diffs)
-
src/objects/pmSourceIO_PS1_CAL_0.c (modified) (5 diffs)
-
src/objects/pmSourceIO_PS1_DEV_0.c (modified) (2 diffs)
-
src/objects/pmSourceIO_PS1_DEV_1.c (modified) (5 diffs)
-
src/objects/pmSourceIO_RAW.c (modified) (2 diffs)
-
src/objects/pmSourceIO_SMPDATA.c (modified) (2 diffs)
-
src/objects/pmSourceIO_SX.c (modified) (1 diff)
-
src/objects/pmSourceMasks.h (modified) (2 diffs)
-
src/objects/pmSourceMatch.c (modified) (2 diffs)
-
src/objects/pmSourceMoments.c (modified) (19 diffs)
-
src/objects/pmSourceOutputs.c (modified) (2 diffs)
-
src/objects/pmSourcePhotometry.c (modified) (14 diffs)
-
src/objects/pmSourcePhotometry.h (modified) (1 diff)
-
src/objects/pmSourceUtils.h (modified) (1 diff)
-
src/psmodules.h (modified) (1 diff)
-
test/objects/tap_pmSource.c (modified) (1 diff)
-
test/objects/tap_pmSourceIO_PS1_DEV_0.c (modified) (2 diffs)
-
test/objects/tap_pmSourceIO_PS1_DEV_1.c (modified) (3 diffs)
-
test/objects/tap_pmSourceIO_SMPDATA.c (modified) (2 diffs)
-
test/objects/tap_pmSourcePhotometry.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAMaskWeight.c
r29544 r31451 587 587 double imageValue, varianceValue; // Image and variance value from interpolation 588 588 psImageMaskType maskValue = 0; // Mask value from interpolation 589 psImageInterpolateStatus status = psImageInterpolate(&imageValue, &varianceValue, &maskValue, x, y, interp); 589 590 // interpolate to pixel center (index + 0.5) 591 psImageInterpolateStatus status = psImageInterpolate(&imageValue, &varianceValue, &maskValue, x + 0.5, y + 0.5, interp); 590 592 if (status == PS_INTERPOLATE_STATUS_ERROR || status == PS_INTERPOLATE_STATUS_OFF) { 591 593 psError(PS_ERR_UNKNOWN, false, "Unable to interpolate readout at %d,%d", x, y); -
trunk/psModules/src/imcombine/pmPSFEnvelope.c
r29543 r31451 380 380 381 381 // measure the source moments: tophat windowing, no pixel S/N cutoff 382 if (!pmSourceMoments(source, maxRadius, 0.0, 0.0, maskVal)) {382 if (!pmSourceMoments(source, maxRadius, 0.0, 0.0, 0.0, maskVal)) { 383 383 // Can't do anything about it; limp along as best we can 384 384 psErrorClear(); -
trunk/psModules/src/imcombine/pmSubtractionStamps.c
r31153 r31451 1197 1197 1198 1198 // fprintf (stderr, "%f,%f : %f %f : %f %f\n", source->peak->xf, source->peak->yf, 1199 // source->psfMag, source->apMag, source->psfMag - source->apMag, source-> errMag);1199 // source->psfMag, source->apMag, source->psfMag - source->apMag, source->psfMagErr); 1200 1200 1201 1201 // XXX this is somewhat arbitrary... 1202 if (source-> errMag> 0.05) continue;1202 if (source->psfMagErr > 0.05) continue; 1203 1203 if (fabs(source->psfMag - source->apMag) > 0.5) continue; 1204 1204 -
trunk/psModules/src/objects/Makefile.am
r31153 r31451 114 114 pmTrend2D.h \ 115 115 pmGrowthCurve.h \ 116 pmGrowthCurveGenerate.h \ 116 117 pmSourceMatch.h \ 117 118 pmDetEff.h \ -
trunk/psModules/src/objects/models/pmModel_DEV.c
r31153 r31451 268 268 float f0 = 1.0; 269 269 float f1, f2; 270 for (z = DZ; z < 50; z += DZ) {270 for (z = DZ; z < 150; z += DZ) { 271 271 f1 = exp(-pow(z,ALPHA)); 272 272 z += DZ; -
trunk/psModules/src/objects/models/pmModel_EXP.c
r31153 r31451 255 255 float f0 = 1.0; 256 256 float f1, f2; 257 for (z = DZ; z < 50; z += DZ) {257 for (z = DZ; z < 150; z += DZ) { 258 258 f1 = exp(-sqrt(z)); 259 259 z += DZ; -
trunk/psModules/src/objects/models/pmModel_PGAUSS.c
r31153 r31451 239 239 float f0 = 1.0; 240 240 float f1, f2; 241 for (z = DZ; z < 50; z += DZ) {241 for (z = DZ; z < 150; z += DZ) { 242 242 f1 = 1.0 / (1 + z + z*z/2.0 + z*z*z/6.0); 243 243 z += DZ; -
trunk/psModules/src/objects/models/pmModel_PS1_V1.c
r31153 r31451 261 261 float f0 = 1.0; 262 262 float f1, f2; 263 for (z = DZ; z < 50; z += DZ) {263 for (z = DZ; z < 150; z += DZ) { 264 264 f1 = 1.0 / (1 + PAR[PM_PAR_7]*z + pow(z, ALPHA)); 265 265 z += DZ; -
trunk/psModules/src/objects/models/pmModel_QGAUSS.c
r31153 r31451 262 262 float f0 = 1.0; 263 263 float f1, f2; 264 for (z = DZ; z < 50; z += DZ) {264 for (z = DZ; z < 150; z += DZ) { 265 265 f1 = 1.0 / (1 + PAR[PM_PAR_7]*z + pow(z, ALPHA)); 266 266 z += DZ; -
trunk/psModules/src/objects/models/pmModel_RGAUSS.c
r31153 r31451 251 251 float f0 = 1.0; 252 252 float f1, f2; 253 for (z = DZ; z < 50; z += DZ) {253 for (z = DZ; z < 150; z += DZ) { 254 254 f1 = 1.0 / (1 + z + pow(z, PAR[PM_PAR_7])); 255 255 z += DZ; -
trunk/psModules/src/objects/models/pmModel_SERSIC.c
r31153 r31451 316 316 float f0 = 1.0; 317 317 float f1, f2; 318 for (z = DZ; z < 50; z += DZ) {318 for (z = DZ; z < 150; z += DZ) { 319 319 // f1 = 1.0 / (1 + PAR[PM_PAR_7]*z + pow(z, 2.25)); 320 320 f1 = exp(-pow(z,PAR[PM_PAR_7])); -
trunk/psModules/src/objects/pmGrowthCurve.c
r29004 r31451 73 73 // Fractional pixel radii are not well defined; use integer pixel radii. Use 1 pixel steps 74 74 // until the scaling factor steps in intervals larger than 1 pixel 75 float Rlin = 1.0 / (fR - 1.0);75 // float Rlin = 1.0 / (fR - 1.0); 76 76 77 77 growth->radius = psVectorAllocEmpty (NPTS, PS_DATA_F32); … … 79 79 // there will be NPTS radii + a few extras 80 80 float radius = minRadius; 81 while (radius < Rlin) {81 while (radius < refRadius) { 82 82 // fprintf (stderr, "r: %f\n", radius); 83 psVectorAppend (growth->radius, radius );83 psVectorAppend (growth->radius, radius - 0.001); 84 84 radius += 1.0; 85 85 } 86 growth->refBin = growth->radius->n - 1; 86 87 while (radius < maxRadius) { 87 88 // fprintf (stderr, "r: %f\n", radius); 88 psVectorAppend (growth->radius, radius );89 psVectorAppend (growth->radius, radius - 0.001); 89 90 radius *= fR; 90 91 radius = (int) (radius + 0.5); … … 96 97 growth->refRadius = refRadius; 97 98 growth->maxRadius = maxRadius; 98 growth->apLoss = 0.0; 99 growth->fitMag = 0.0; 99 growth->fitMag = NAN; 100 growth->refMag = NAN; 101 growth->apRef = NAN; 102 growth->apLoss = NAN; 103 100 104 return growth; 101 105 } -
trunk/psModules/src/objects/pmGrowthCurve.h
r15562 r31451 22 22 psF32 maxRadius; 23 23 psF32 fitMag; 24 psF32 refMag; 24 25 psF32 apRef; // apMag[refRadius] 25 26 psF32 apLoss; // fitMag - apRef 27 int refBin; 26 28 } 27 29 pmGrowthCurve; -
trunk/psModules/src/objects/pmGrowthCurveGenerate.c
r29546 r31451 50 50 51 51 #include "pmSourcePhotometry.h" 52 53 pmGrowthCurve *pmGrowthCurveForPosition (psImage *image, pmPSF *psf, bool ignore, psImageMaskType maskVal, psImageMaskType markVal, float xc, float yc); 52 #include "pmGrowthCurveGenerate.h" 54 53 55 54 /*****************************************************************************/ … … 197 196 // mask the given aperture and measure the apMag 198 197 psImageKeepCircle (mask, xc, yc, radius, "OR", markVal); 199 if (!pmSourcePhotometryAper ( &apMag, NULL, NULL, model, pixels, NULL, mask, maskVal)) {198 if (!pmSourcePhotometryAper (NULL, &apMag, NULL, NULL, model, pixels, NULL, mask, maskVal)) { 200 199 psFree (growth); 201 200 psFree (view); … … 226 225 return growth; 227 226 } 227 228 # define DEBUG 0 229 # if (DEBUG) 230 static FILE *fgr = NULL; 231 # endif 232 233 // we generate the growth curve for the center of the image with the specified psf model 234 bool pmGrowthCurveGenerateFromSources (pmReadout *readout, pmPSF *psf, psArray *sources, bool INTERPOLATE_AP, psImageMaskType maskVal, psImageMaskType markVal) 235 { 236 PS_ASSERT_PTR_NON_NULL(readout, false); 237 PS_ASSERT_PTR_NON_NULL(readout->image, false); 238 239 // maskVal is used to test for rejected pixels, and must include markVal 240 maskVal |= markVal; 241 242 pmSourcePhotometryMode photMode = INTERPOLATE_AP ? PM_SOURCE_PHOT_INTERP : 0; 243 244 // measure the growth curve for each PSF source and average them together 245 psArray *growths = psArrayAllocEmpty (100); 246 247 # if (DEBUG) 248 fgr = fopen ("growth.mags.dat", "w"); 249 # endif 250 251 for (int i = 0; i < sources->n; i++) { 252 253 pmSource *source = sources->data[i]; 254 255 if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue; 256 257 pmGrowthCurve *growth = pmGrowthCurveForSource (source, psf, photMode, maskVal, markVal); 258 if (!growth) continue; 259 260 psArrayAdd (growths, 100, growth); 261 psFree (growth); 262 } 263 psAssert (growths->n, "cannot build growth curve (no valid PSF stars?)"); 264 265 # if (DEBUG) 266 fclose (fgr); 267 # endif 268 269 // just use a simple sample median to get the 'best' value from each growth curve... 270 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN); 271 272 psVector *values = psVectorAlloc (growths->n, PS_DATA_F32); 273 274 // loop over a range of source fluxes 275 // no need to interpolate since we have forced the object center 276 // to 0.5, 0.5 above 277 for (int i = 0; i < psf->growth->radius->n; i++) { 278 279 // median the values for each radial bin 280 values->n = 0; 281 for (int j = 0; j < growths->n; j++) { 282 pmGrowthCurve *growth = growths->data[j]; 283 if (!isfinite(growth->apMag->data.F32[i])) continue; 284 psVectorAppend (values, growth->apMag->data.F32[i] - growth->refMag); 285 } 286 if (values->n == 0) { 287 psf->growth->apMag->data.F32[i] = NAN; 288 } else { 289 if (!psVectorStats (stats, values, NULL, NULL, 0)) { 290 psError(PS_ERR_UNKNOWN, false, "failure to measure stats"); 291 return false; 292 } 293 psf->growth->apMag->data.F32[i] = stats->sampleMedian; 294 } 295 } 296 297 psf->growth->fitMag = psf->growth->apMag->data.F32[psf->growth->radius->n-1]; 298 psf->growth->apRef = psVectorInterpolate (psf->growth->radius, psf->growth->apMag, psf->growth->refRadius); 299 psf->growth->apLoss = psf->growth->fitMag - psf->growth->apRef; 300 301 psLogMsg ("psphot.growth", 4, "GrowthCurve : apLoss : %f (fitMag - apMag @ ref : %f - %f)\n", psf->growth->apLoss, psf->growth->fitMag, psf->growth->apRef); 302 303 psFree (growths); 304 psFree (stats); 305 psFree (values); 306 307 return true; 308 } 309 310 pmGrowthCurve *pmGrowthCurveForSource (pmSource *source, pmPSF *psf, pmSourcePhotometryMode photMode, psImageMaskType maskVal, psImageMaskType markVal) { 311 312 float radius; 313 314 assert (psf->growth); 315 316 float minRadius = psf->growth->radius->data.F32[0]; 317 pmGrowthCurve *growth = pmGrowthCurveAlloc (minRadius, psf->growth->maxRadius, psf->growth->refRadius); 318 319 // measure the fitMag for this source (for normalization) 320 // pmSourcePhotometryModel (&fitMag, NULL, source->psfModel); 321 growth->fitMag = source->psfMag; 322 323 float xc = source->peak->xf; 324 float yc = source->peak->yf; 325 326 // Loop over the range of radii 327 for (int i = 0; i < growth->radius->n; i++) { 328 329 radius = growth->radius->data.F32[i]; 330 331 // mask the given aperture and measure the apMag 332 psImageKeepCircle (source->maskObj, xc, yc, radius, "OR", markVal); 333 334 if (!pmSourceMagnitudes (source, psf, photMode, maskVal, markVal, radius)) { 335 psFree (growth); 336 return NULL; 337 } 338 339 // if (!pmSourcePhotometryAper (NULL, &apMag, NULL, NULL, NULL, source->pixels, NULL, source->maskObj, maskVal)) { 340 // psFree (growth); 341 // return NULL; 342 // } 343 344 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); // clear the circular mask 345 346 growth->apMag->data.F32[i] = source->apMag; 347 } 348 psAssert(growth->refBin >= 0, "invalid growth reference bin"); 349 psAssert(growth->refBin < growth->apMag->n, "invalid growth reference bin"); 350 growth->refMag = growth->apMag->data.F32[growth->refBin]; 351 352 // Loop over the range of radii 353 # if (DEBUG) 354 for (int i = 0; i < growth->radius->n; i++) { 355 fprintf (fgr, "%f %f %f %f %f %f\n", xc, yc, growth->radius->data.F32[i], growth->apMag->data.F32[i], growth->fitMag, growth->refMag); 356 } 357 # endif 358 359 return growth; 360 } -
trunk/psModules/src/objects/pmPCMdata.c
r31153 r31451 263 263 bool pmPCMupdate(pmPCMdata *pcm, pmSource *source, pmSourceFitOptions *fitOptions, pmModel *model) { 264 264 265 bool newWindow = (source->pixels->numRows != pcm->modelFlux->numRows) || (source->pixels->numCols != pcm->modelFlux->numCols); 265 bool sameWindow = (source->pixels->numRows == pcm->modelFlux->numRows); 266 sameWindow &= (source->pixels->numCols == pcm->modelFlux->numCols); 267 sameWindow &= (source->pixels->col0 == pcm->modelFlux->col0); 268 sameWindow &= (source->pixels->row0 == pcm->modelFlux->row0); 266 269 267 270 // re-count the number of unmasked pixels: 268 if ( newWindow) {271 if (!sameWindow) { 269 272 for (psS32 i = 0; i < source->pixels->numRows; i++) { 270 273 for (psS32 j = 0; j < source->pixels->numCols; j++) { … … 346 349 347 350 // has the source pixel window changed? 348 if ( newWindow) {351 if (!sameWindow) { 349 352 350 353 // adjust all supporting images: -
trunk/psModules/src/objects/pmPSF.c
r31153 r31451 73 73 74 74 options->type = 0; 75 76 75 options->stats = NULL; 77 options->fitOptions = NULL; // XXX this has to be set before calling pmPSF fit functions78 76 79 77 options->psfTrendMode = PM_TREND_NONE; … … 90 88 91 89 options->chiFluxTrend = true; 92 90 options->fitOptions = NULL; // XXX this has to be set before calling pmPSF fit functions 91 92 options->fitRadius = NAN; 93 options->apRadius = NAN; 93 94 return options; 94 95 } … … 141 142 142 143 psf->type = options->type; 144 143 145 psf->chisq = 0.0; 144 146 psf->ApResid = 0.0; -
trunk/psModules/src/objects/pmPSF.h
r29004 r31451 31 31 struct pmPSF { 32 32 pmModelType type; ///< PSF Model in use 33 psArray *params; ///< Model parameters (psPolynomial2D) 34 psStats *psfTrendStats; ///< psf parameter trend clipping stats 35 pmTrend2DMode psfTrendMode; 36 psPolynomial1D *ChiTrend; ///< Chisq vs flux fit (correction for systematic errors) 37 pmTrend2D *ApTrend; ///< ApResid vs (x,y) 38 pmTrend2D *FluxScale; ///< Flux for PSF at (x,y) for normalization = 1.0 33 34 float chisq; ///< PSF goodness statistic (unused??) 39 35 float ApResid; ///< apMag - psfMag (for PSF stars) 40 36 float dApResid; ///< scatter of ApResid 41 37 float skyBias; ///< implied residual sky offset from ApResid fit 42 38 float skySat; ///< roll-over of ApResid fit 43 float chisq; ///< PSF goodness statistic (unused??)44 39 int nPSFstars; ///< number of stars used to measure PSF 45 40 int nApResid; ///< number of stars used to measure ApResid 41 42 bool poissonErrorsPhotLMM; ///< use poission errors for non-linear model fitting 43 bool poissonErrorsPhotLin; ///< use poission errors for linear model fitting 44 bool poissonErrorsParams; ///< use poission errors for model parameter fitting 45 46 pmTrend2D *ApTrend; ///< ApResid vs (x,y) 47 pmTrend2D *FluxScale; ///< Flux for PSF at (x,y) for normalization = 1.0 48 psPolynomial1D *ChiTrend; ///< Chisq vs flux fit (correction for systematic errors) 49 50 pmGrowthCurve *growth; ///< apMag vs Radius 51 pmResiduals *residuals; ///< normalized residual image (no spatial variation) 52 53 psArray *params; ///< Model parameters (psPolynomial2D) 54 psStats *psfTrendStats; ///< psf parameter trend clipping stats 55 56 pmTrend2DMode psfTrendMode; 46 57 int trendNx; 47 58 int trendNy; … … 50 61 int fieldXo; 51 62 int fieldYo; 52 bool poissonErrorsPhotLMM; ///< use poission errors for non-linear model fitting53 bool poissonErrorsPhotLin; ///< use poission errors for linear model fitting54 bool poissonErrorsParams; ///< use poission errors for model parameter fitting55 pmGrowthCurve *growth; ///< apMag vs Radius56 pmResiduals *residuals; ///< normalized residual image (no spatial variation)57 63 }; 58 64 … … 60 66 pmModelType type; 61 67 psStats *stats; // psfTrend clipping stats 68 62 69 pmTrend2DMode psfTrendMode; 63 70 int psfTrendNx; … … 67 74 int psfFieldXo; 68 75 int psfFieldYo; 76 69 77 bool poissonErrorsPhotLMM; ///< use poission errors for non-linear model fitting 70 78 bool poissonErrorsPhotLin; ///< use poission errors for linear model fitting 71 79 bool poissonErrorsParams; ///< use poission errors for model parameter fitting 80 81 bool chiFluxTrend; // Fit a trend in Chi2 as a function of flux? 82 pmSourceFitOptions *fitOptions; 83 72 84 float fitRadius; 73 85 float apRadius; 74 bool chiFluxTrend; // Fit a trend in Chi2 as a function of flux?75 pmSourceFitOptions *fitOptions;76 86 } pmPSFOptions; 77 87 … … 94 104 double pmPSF_SXYtoModel (psF32 *fittedPar); 95 105 96 bool pmGrowthCurveGenerate (pmReadout *readout, pmPSF *psf, bool ignore, psImageMaskType maskVal, psImageMaskType mark);97 106 pmPSF *pmPSFBuildSimple (char *typeName, float sxx, float syy, float sxy, ...); 98 107 -
trunk/psModules/src/objects/pmPSF_IO.c
r30031 r31451 63 63 64 64 bool pmPSFmodelReadPSFClump (psMetadata *analysis, psMetadata *header); 65 bool pmPSFmodelRead_ApTrend (pmPSF *psf, pmFPAfile *file); 66 bool pmPSFmodelWrite_ApTrend (pmFPAfile *file, pmPSF *psf); 67 68 bool pmPSFmodelRead_GrowthCurve (pmPSF *psf, pmFPAfile *file); 69 bool pmPSFmodelWrite_GrowthCurve (pmFPAfile *file, pmPSF *psf); 65 70 66 71 bool pmPSFmodelCheckDataStatusForView (const pmFPAview *view, const pmFPAfile *file) … … 197 202 psError(psErrorCodeLast(), false, "Failed to write PSF for chip"); 198 203 return false; 204 } 205 return true; 206 } 207 208 // XXX we save the model term identifiers (item) as S32, but they probably should be more flexible 209 bool pmTrend2DtoTable (psArray *table, pmTrend2D *trend, char *label, int item) { 210 211 if (trend == NULL) return true; 212 213 if (trend->mode == PM_TREND_MAP) { 214 // write the image components into a table: this is needed because they may each be a different size 215 psImageMap *map = trend->map; 216 for (int ix = 0; ix < map->map->numCols; ix++) { 217 for (int iy = 0; iy < map->map->numRows; iy++) { 218 psMetadata *row = psMetadataAlloc (); 219 psMetadataAddS32 (row, PS_LIST_TAIL, label, 0, "", item); 220 psMetadataAddS32 (row, PS_LIST_TAIL, "X_POWER", 0, "", ix); 221 psMetadataAddS32 (row, PS_LIST_TAIL, "Y_POWER", 0, "", iy); 222 psMetadataAddF32 (row, PS_LIST_TAIL, "VALUE", 0, "", map->map->data.F32[iy][ix]); 223 psMetadataAddF32 (row, PS_LIST_TAIL, "ERROR", 0, "", map->error->data.F32[iy][ix]); 224 psMetadataAddU8 (row, PS_LIST_TAIL, "MASK", 0, "", 0); // no cells are masked 225 226 psArrayAdd (table, 100, row); 227 psFree (row); 228 } 229 } 230 } else { 231 // write the polynomial components into a table 232 psPolynomial2D *poly = trend->poly; 233 for (int ix = 0; ix <= poly->nX; ix++) { 234 for (int iy = 0; iy <= poly->nY; iy++) { 235 psMetadata *row = psMetadataAlloc (); 236 psMetadataAddS32 (row, PS_LIST_TAIL, label, 0, "", item); 237 psMetadataAddS32 (row, PS_LIST_TAIL, "X_POWER", 0, "", ix); 238 psMetadataAddS32 (row, PS_LIST_TAIL, "Y_POWER", 0, "", iy); 239 psMetadataAddF32 (row, PS_LIST_TAIL, "VALUE", 0, "", poly->coeff[ix][iy]); 240 psMetadataAddF32 (row, PS_LIST_TAIL, "ERROR", 0, "", poly->coeffErr[ix][iy]); 241 psMetadataAddU8 (row, PS_LIST_TAIL, "MASK", 0, "", poly->coeffMask[ix][iy]); 242 243 psArrayAdd (table, 100, row); 244 psFree (row); 245 } 246 } 247 } 248 return true; 249 } 250 251 // extra trend2D elements from a row 252 bool pmTrend2DfromTableRow (pmTrend2D *trend, psMetadata *row) { 253 254 bool status = false; 255 256 int xPow = psMetadataLookupS32 (&status, row, "X_POWER"); 257 int yPow = psMetadataLookupS32 (&status, row, "Y_POWER"); 258 259 if (trend->mode == PM_TREND_MAP) { 260 psImageMap *map = trend->map; 261 assert (map); 262 assert (map->map); 263 assert (map->error); 264 assert (xPow >= 0); 265 assert (yPow >= 0); 266 assert (xPow < map->map->numCols); 267 assert (yPow < map->map->numRows); 268 map->map->data.F32[yPow][xPow] = psMetadataLookupF32 (&status, row, "VALUE"); 269 map->error->data.F32[yPow][xPow] = psMetadataLookupF32 (&status, row, "ERROR"); 270 } else { 271 psPolynomial2D *poly = trend->poly; 272 assert (poly); 273 assert (xPow >= 0); 274 assert (yPow >= 0); 275 assert (xPow <= poly->nX); 276 assert (yPow <= poly->nY); 277 poly->coeff[xPow][yPow] = psMetadataLookupF32 (&status, row, "VALUE"); 278 poly->coeffErr[xPow][yPow] = psMetadataLookupF32 (&status, row, "ERROR"); 279 poly->coeffMask[xPow][yPow] = psMetadataLookupU8 (&status, row, "MASK"); 199 280 } 200 281 return true; … … 403 484 404 485 if (trend->mode == PM_TREND_MAP) { 405 nX = trend->map->map->numCols;406 nY = trend->map->map->numRows;486 nX = trend->map->map->numCols; 487 nY = trend->map->map->numRows; 407 488 } else { 408 nX = trend->poly->nX;409 nY = trend->poly->nY;489 nX = trend->poly->nX; 490 nY = trend->poly->nY; 410 491 } 411 492 snprintf (name, 9, "PAR%02d_NX", i); … … 428 509 psMetadataAddF32 (header, PS_LIST_TAIL, "SKY_BIAS", PS_DATA_F32, "sky bias level", psf->skyBias); 429 510 511 float PSF_APERTURE = psMetadataLookupF32(&status, roAnalysis, "PSF_APERTURE"); 512 if (status) { 513 psMetadataAddF32 (header, PS_LIST_TAIL, "PSF_APERTURE", PS_DATA_F32, "aperture for psf objects", PSF_APERTURE); 514 } 515 float PSF_FIT_RADIUS = psMetadataLookupF32(&status, roAnalysis, "PSF_FIT_RADIUS"); 516 if (status) { 517 psMetadataAddF32 (header, PS_LIST_TAIL, "PSF_FIT_RADIUS", PS_DATA_F32, "aperture for psf objects", PSF_FIT_RADIUS); 518 } 519 430 520 // build a FITS table of the PSF parameters 431 521 psArray *psfTable = psArrayAllocEmpty (100); 432 522 for (int i = 0; i < nPar; i++) { 433 523 pmTrend2D *trend = psf->params->data[i]; 434 if (trend == NULL) continue; // skip unset parameters (eg, XPOS) 435 436 if (trend->mode == PM_TREND_MAP) { 437 // write the image components into a table: this is needed because they may each be a different size 438 psImageMap *map = trend->map; 439 for (int ix = 0; ix < map->map->numCols; ix++) { 440 for (int iy = 0; iy < map->map->numRows; iy++) { 441 psMetadata *row = psMetadataAlloc (); 442 psMetadataAddS32 (row, PS_LIST_TAIL, "MODEL_TERM", 0, "", i); 443 psMetadataAddS32 (row, PS_LIST_TAIL, "X_POWER", 0, "", ix); 444 psMetadataAddS32 (row, PS_LIST_TAIL, "Y_POWER", 0, "", iy); 445 psMetadataAddF32 (row, PS_LIST_TAIL, "VALUE", 0, "", map->map->data.F32[iy][ix]); 446 psMetadataAddF32 (row, PS_LIST_TAIL, "ERROR", 0, "", map->error->data.F32[iy][ix]); 447 psMetadataAddU8 (row, PS_LIST_TAIL, "MASK", 0, "", 0); // no cells are masked 448 449 psArrayAdd (psfTable, 100, row); 450 psFree (row); 451 } 452 } 453 } else { 454 // write the polynomial components into a table 455 psPolynomial2D *poly = trend->poly; 456 for (int ix = 0; ix <= poly->nX; ix++) { 457 for (int iy = 0; iy <= poly->nY; iy++) { 458 psMetadata *row = psMetadataAlloc (); 459 psMetadataAddS32 (row, PS_LIST_TAIL, "MODEL_TERM", 0, "", i); 460 psMetadataAddS32 (row, PS_LIST_TAIL, "X_POWER", 0, "", ix); 461 psMetadataAddS32 (row, PS_LIST_TAIL, "Y_POWER", 0, "", iy); 462 psMetadataAddF32 (row, PS_LIST_TAIL, "VALUE", 0, "", poly->coeff[ix][iy]); 463 psMetadataAddF32 (row, PS_LIST_TAIL, "ERROR", 0, "", poly->coeffErr[ix][iy]); 464 psMetadataAddU8 (row, PS_LIST_TAIL, "MASK", 0, "", poly->coeffMask[ix][iy]); 465 466 psArrayAdd (psfTable, 100, row); 467 psFree (row); 468 } 469 } 470 } 524 pmTrend2DtoTable (psfTable, trend, "MODEL_TERM", i); 471 525 } 472 526 … … 547 601 } 548 602 603 if (!pmPSFmodelWrite_ApTrend(file, psf)) { 604 psError(psErrorCodeLast(), false, "Unable to write PSF ApTrend"); 605 return false; 606 } 607 608 if (!pmPSFmodelWrite_GrowthCurve(file, psf)) { 609 psError(psErrorCodeLast(), false, "Unable to write PSF Growth Curve"); 610 return false; 611 } 612 549 613 // write a representation of the psf model 550 614 { 551 615 psMetadata *header = psMetadataAlloc (); 552 553 if (0) {554 // set some header keywords to make it clear there are no residuals?555 if (!psFitsWriteBlank (file->fits, header, residName)) {556 psError(psErrorCodeLast(), false, "Unable to write blank PSF residuals.");557 psFree(residName);558 psFree(header);559 return false;560 }561 psFree (residName);562 psFree (header);563 return true;564 }565 616 566 617 int DX = 65; … … 651 702 } 652 703 704 705 653 706 // if this file needs to have a PHU written out, write one 654 707 bool pmPSFmodelWritePHU (const pmFPAview *view, pmFPAfile *file, pmConfig *config) … … 934 987 psf->skyBias = psMetadataLookupF32 (&status, header, "SKY_BIAS"); 935 988 989 if (roAnalysis) { 990 float PSF_APERTURE = psMetadataLookupF32(&status, header, "PSF_APERTURE"); 991 if (status) { 992 psMetadataAddF32 (roAnalysis, PS_LIST_TAIL, "PSF_APERTURE", PS_DATA_F32, "aperture for psf objects", PSF_APERTURE); 993 } 994 float PSF_FIT_RADIUS = psMetadataLookupF32(&status, header, "PSF_FIT_RADIUS"); 995 if (status) { 996 psMetadataAddF32 (roAnalysis, PS_LIST_TAIL, "PSF_FIT_RADIUS", PS_DATA_F32, "aperture for psf objects", PSF_FIT_RADIUS); 997 } 998 } else { 999 psWarning ("unable to read PSF_APERTURE or PSF_FIT_RADIUS"); 1000 } 1001 936 1002 // read the raw table data 937 1003 psArray *table = psFitsReadTable (file->fits); … … 945 1011 for (int i = 0; i < table->n; i++) { 946 1012 psMetadata *row = table->data[i]; 1013 947 1014 int iPar = psMetadataLookupS32 (&status, row, "MODEL_TERM"); 948 int xPow = psMetadataLookupS32 (&status, row, "X_POWER");949 int yPow = psMetadataLookupS32 (&status, row, "Y_POWER");950 1015 951 1016 pmTrend2D *trend = psf->params->data[iPar]; … … 955 1020 } 956 1021 957 if (trend->mode == PM_TREND_MAP) { 958 psImageMap *map = trend->map; 959 assert (map); 960 assert (map->map); 961 assert (map->error); 962 assert (xPow >= 0); 963 assert (yPow >= 0); 964 assert (xPow < map->map->numCols); 965 assert (yPow < map->map->numRows); 966 map->map->data.F32[yPow][xPow] = psMetadataLookupF32 (&status, row, "VALUE"); 967 map->error->data.F32[yPow][xPow] = psMetadataLookupF32 (&status, row, "ERROR"); 968 } else { 969 psPolynomial2D *poly = trend->poly; 970 assert (poly); 971 assert (xPow >= 0); 972 assert (yPow >= 0); 973 assert (xPow <= poly->nX); 974 assert (yPow <= poly->nY); 975 poly->coeff[xPow][yPow] = psMetadataLookupF32 (&status, row, "VALUE"); 976 poly->coeffErr[xPow][yPow] = psMetadataLookupF32 (&status, row, "ERROR"); 977 poly->coeffMask[xPow][yPow] = psMetadataLookupU8 (&status, row, "MASK"); 978 } 1022 pmTrend2DfromTableRow(trend, row); 979 1023 } 980 1024 psFree (header); … … 1063 1107 } 1064 1108 1109 if (!pmPSFmodelRead_ApTrend (psf, file)) { 1110 psError(psErrorCodeLast(), false, "Unable to read PSF ApTrend data."); 1111 return false; 1112 } 1113 1114 if (!pmPSFmodelRead_GrowthCurve(psf, file)) { 1115 psError(psErrorCodeLast(), false, "Unable to read PSF Growth Curve"); 1116 return false; 1117 } 1118 1065 1119 psMetadataAdd (chipAnalysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN, "psphot psf", psf); 1066 1120 psFree (psf); … … 1070 1124 psFree (header); 1071 1125 1126 return true; 1127 } 1128 1129 // write aperture trend to a FITS table 1130 bool pmPSFmodelWrite_ApTrend (pmFPAfile *file, pmPSF *psf) { 1131 1132 pmTrend2D *trend = psf->ApTrend; 1133 if (trend == NULL) { 1134 psWarning ("no PSF ApTrend to write out, skipping"); 1135 return true; 1136 } 1137 1138 // we need to write a header for the table, 1139 psMetadata *header = psMetadataAlloc(); 1140 1141 int nX = 0, nY = 0; 1142 if (trend->mode == PM_TREND_MAP) { 1143 nX = trend->map->map->numCols; 1144 nY = trend->map->map->numRows; 1145 } else { 1146 nX = trend->poly->nX; 1147 nY = trend->poly->nY; 1148 } 1149 psMetadataAddS32 (header, PS_LIST_TAIL, "TREND_NX", 0, "", nX); 1150 psMetadataAddS32 (header, PS_LIST_TAIL, "TREND_NY", 0, "", nY); 1151 char *modeName = pmTrend2DModeToString (trend->mode); 1152 psMetadataAddStr (header, PS_LIST_TAIL, "TREND_MD", 0, "", modeName); 1153 psFree (modeName); 1154 1155 // build a FITS table of the ApTrend (only 1) 1156 psArray *table = psArrayAllocEmpty (100); 1157 pmTrend2DtoTable (table, trend, "APTREND", 0); 1158 1159 // write an empty FITS segment if we have no PSF information 1160 if (table->n == 0) { 1161 psError(PM_ERR_PROG, true, "No PSF data to write."); 1162 psFree(table); 1163 psFree(header); 1164 return false; 1165 } 1166 1167 psTrace ("pmFPAfile", 5, "writing psf ApTrend data %s\n", "AP_TREND"); 1168 if (!psFitsWriteTable(file->fits, header, table, "AP_TREND")) { 1169 psError(psErrorCodeLast(), false, "Error writing psf table data %s\n", "AP_TREND"); 1170 psFree(table); 1171 psFree(header); 1172 return false; 1173 } 1174 1175 psFree (table); 1176 psFree (header); 1177 return true; 1178 } 1179 1180 // read aperture trend to a FITS table 1181 bool pmPSFmodelRead_ApTrend (pmPSF *psf, pmFPAfile *file) { 1182 1183 bool status; 1184 1185 // move fits pointer to AP_TREND section 1186 // advance to the table data extension 1187 if (!psFitsMoveExtNameClean (file->fits, "AP_TREND")) { 1188 psWarning ("no Aperture Trend data in PSF file, skipping"); 1189 return true; 1190 } 1191 1192 psMetadata *header = psFitsReadHeader (NULL, file->fits); 1193 if (!header) { 1194 psError(psErrorCodeLast(), false, "Unable to read AP_TREND header."); 1195 return false; 1196 } 1197 1198 // read the raw table data 1199 psArray *table = psFitsReadTable (file->fits); 1200 if (!table) { 1201 psError(psErrorCodeLast(), false, "Unable to read AP_TREND table."); 1202 psFree(header); 1203 return false; 1204 } 1205 1206 // XXX allow user to set this optionally? 1207 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_STDEV); 1208 1209 psImageBinning *binning = psImageBinningAlloc(); 1210 binning->nXfine = psf->fieldNx; 1211 binning->nYfine = psf->fieldNy; 1212 binning->nXruff = psMetadataLookupS32 (&status, header, "TREND_NX"); 1213 binning->nYruff = psMetadataLookupS32 (&status, header, "TREND_NY"); 1214 psImageBinningSetScale (binning, PS_IMAGE_BINNING_CENTER); 1215 char *modeName = psMetadataLookupStr (&status, header, "TREND_MD"); 1216 if (!status) { 1217 psError(PM_ERR_PROG, true, "inconsistent PSF header: NX & NY defined for AP TREND, but not MD"); 1218 psFree (header); 1219 psFree (stats); 1220 psFree (table); 1221 return false; 1222 } 1223 pmTrend2DMode psfTrendMode = pmTrend2DModeFromString (modeName); 1224 if (psfTrendMode == PM_TREND_NONE) { 1225 psfTrendMode = PM_TREND_POLY_ORD; 1226 } 1227 1228 // measure Trend2D for the current spatial scale 1229 pmTrend2D *apTrend = pmTrend2DNoImageAlloc (PM_TREND_MAP, binning, stats); 1230 1231 // fill in the matching psf->params entries 1232 for (int i = 0; i < table->n; i++) { 1233 psMetadata *row = table->data[i]; 1234 pmTrend2DfromTableRow(apTrend, row); 1235 } 1236 psf->ApTrend = apTrend; 1237 1238 psFree (binning); 1239 psFree (header); 1240 psFree (stats); 1241 psFree (table); 1242 return true; 1243 } 1244 1245 // write aperture trend to a FITS table 1246 bool pmPSFmodelWrite_GrowthCurve (pmFPAfile *file, pmPSF *psf) { 1247 1248 pmGrowthCurve *growth = psf->growth; 1249 if (growth == NULL) { 1250 psWarning ("no PSF Growth Curve to write out, skipping"); 1251 return true; 1252 } 1253 1254 // we need to write a header for the table, 1255 psMetadata *header = psMetadataAlloc(); 1256 1257 psMetadataAddF32 (header, PS_LIST_TAIL, "GROWTH_MIN_RAD", 0, "", growth->radius->data.F32[0]); 1258 psMetadataAddF32 (header, PS_LIST_TAIL, "GROWTH_MAX_RAD", 0, "", growth->maxRadius); 1259 psMetadataAddF32 (header, PS_LIST_TAIL, "GROWTH_REF_RAD", 0, "", growth->refRadius); 1260 psMetadataAddF32 (header, PS_LIST_TAIL, "GROWTH_AP_LOSS", 0, "", growth->apLoss); 1261 psMetadataAddF32 (header, PS_LIST_TAIL, "GROWTH_AP_REF", 0, "", growth->apRef); 1262 psMetadataAddF32 (header, PS_LIST_TAIL, "GROWTH_FIT_MAG", 0, "", growth->fitMag); 1263 1264 // build a FITS table of the ApTrend (only 1) 1265 psArray *table = psArrayAllocEmpty (100); 1266 for (int i = 0; i < growth->apMag->n; i++) { 1267 psMetadata *row = psMetadataAlloc (); 1268 psMetadataAddF32 (row, PS_LIST_TAIL, "RADIUS", 0, "", growth->radius->data.F32[i]); 1269 psMetadataAddF32 (row, PS_LIST_TAIL, "AP_MAG", 0, "", growth->apMag->data.F32[i]); 1270 psArrayAdd (table, 100, row); 1271 psFree (row); 1272 } 1273 1274 // write an empty FITS segment if we have no PSF information 1275 if (table->n == 0) { 1276 psError(PM_ERR_PROG, true, "No PSF data to write."); 1277 psFree(table); 1278 psFree(header); 1279 return false; 1280 } 1281 1282 psTrace ("pmFPAfile", 5, "writing psf Growth Curve data %s\n", "GROWTH_CURVE"); 1283 if (!psFitsWriteTable(file->fits, header, table, "GROWTH_CURVE")) { 1284 psError(psErrorCodeLast(), false, "Error writing psf table data %s\n", "GROWTH_CURVE"); 1285 psFree(table); 1286 psFree(header); 1287 return false; 1288 } 1289 1290 psFree (table); 1291 psFree (header); 1292 return true; 1293 } 1294 1295 // read aperture trend to a FITS table 1296 bool pmPSFmodelRead_GrowthCurve (pmPSF *psf, pmFPAfile *file) { 1297 1298 bool status; 1299 1300 // move fits pointer to AP_TREND section 1301 // advance to the table data extension 1302 if (!psFitsMoveExtNameClean (file->fits, "GROWTH_CURVE")) { 1303 psWarning ("no Growth Curve data in PSF file, skipping"); 1304 return true; 1305 } 1306 1307 psMetadata *header = psFitsReadHeader (NULL, file->fits); 1308 if (!header) { 1309 psError(psErrorCodeLast(), false, "Unable to read GROWTH_CURVE header."); 1310 return false; 1311 } 1312 1313 // read the raw table data 1314 psArray *table = psFitsReadTable (file->fits); 1315 if (!table) { 1316 psError(psErrorCodeLast(), false, "Unable to read GROWTH_CURVE table."); 1317 psFree(header); 1318 return false; 1319 } 1320 1321 float minRadius = psMetadataLookupF32 (&status, header, "GROWTH_MIN_RAD"); if (!status) return false; 1322 float maxRadius = psMetadataLookupF32 (&status, header, "GROWTH_MAX_RAD"); if (!status) return false; 1323 float refRadius = psMetadataLookupF32 (&status, header, "GROWTH_REF_RAD"); if (!status) return false; 1324 1325 psf->growth = pmGrowthCurveAlloc(minRadius, maxRadius, refRadius); 1326 1327 psf->growth->apLoss = psMetadataLookupF32 (&status, header, "GROWTH_AP_LOSS"); if (!status) return false; 1328 psf->growth->apRef = psMetadataLookupF32 (&status, header, "GROWTH_AP_REF"); if (!status) return false; 1329 psf->growth->fitMag = psMetadataLookupF32 (&status, header, "GROWTH_FIT_MAG"); if (!status) return false; 1330 1331 // fill in the matching psf->params entries 1332 for (int i = 0; i < table->n; i++) { 1333 psMetadata *row = table->data[i]; 1334 psf->growth->apMag->data.F32[i] = psMetadataLookupF32 (&status, row, "AP_MAG"); if (!status) return false; 1335 } 1336 1337 psFree (header); 1338 psFree (table); 1072 1339 return true; 1073 1340 } -
trunk/psModules/src/objects/pmPSFtryFitPSF.c
r31153 r31451 122 122 psfTry->fitMag->data.F32[i] = source->psfMag; 123 123 psfTry->metric->data.F32[i] = source->apMag - source->psfMag; 124 psfTry->metricErr->data.F32[i] = source-> errMag;124 psfTry->metricErr->data.F32[i] = source->psfMagErr; 125 125 126 126 // XXX this did not work: modifies shape of psf too much … … 131 131 source->peak->xf, source->peak->yf, 132 132 source->modelPSF->params->data.F32[PM_PAR_XPOS], source->modelPSF->params->data.F32[PM_PAR_YPOS], 133 source->psfMag, source->apMag, source-> errMag,133 source->psfMag, source->apMag, source->psfMagErr, 134 134 source->modelPSF->params->data.F32[PM_PAR_I0], 135 135 source->modelPSF->params->data.F32[PM_PAR_SXX], source->modelPSF->params->data.F32[PM_PAR_SXY], -
trunk/psModules/src/objects/pmPeaks.c
r31153 r31451 150 150 tmp->x = x; 151 151 tmp->y = y; 152 tmp->xf = x; 153 tmp->yf = y; 154 tmp->dx = NAN; 155 tmp->dy = NAN; 152 156 tmp->detValue = value; 153 157 tmp->rawFlux = value; // set this by default: it is up to the user to supply a better value … … 155 159 tmp->smoothFlux = value; // set this by default: it is up to the user to supply a better value 156 160 tmp->smoothFluxStdev = NAN; 157 // tmp->SN = 0;158 tmp->xf = x;159 tmp->yf = y;160 161 tmp->assigned = false; 161 162 tmp->type = type; … … 166 167 psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__); 167 168 return(tmp); 169 } 170 171 // copy to an already allocated peak 172 bool pmPeakCopy(pmPeak *out, pmPeak *in) 173 { 174 out->x = in->x; 175 out->y = in->y; 176 out->xf = in->xf; 177 out->yf = in->yf; 178 out->dx = in->dx; 179 out->dy = in->dy; 180 out->detValue = in->detValue; 181 out->rawFlux = in->rawFlux; 182 out->rawFluxStdev = in->rawFluxStdev; 183 out->smoothFlux = in->smoothFlux; 184 out->smoothFluxStdev = in->smoothFluxStdev; 185 out->assigned = in->assigned; 186 out->type = in->type; 187 188 return true; 168 189 } 169 190 -
trunk/psModules/src/objects/pmPeaks.h
r31153 r31451 69 69 float smoothFlux; ///< peak flux in smoothed signal image 70 70 float smoothFluxStdev; ///< peak stdev in smoothed signal image 71 // float SNestimated; ///< S/N estimated from the detection image72 71 bool assigned; ///< is peak assigned to a source? 73 72 pmPeakType type; ///< Description of peak. … … 89 88 90 89 bool psMemCheckPeak(psPtr ptr); 90 91 bool pmPeakCopy(pmPeak *out, pmPeak *in); 91 92 92 93 /** pmPeaksInVector() -
trunk/psModules/src/objects/pmSource.c
r31153 r31451 116 116 source->psfImage = NULL; 117 117 source->moments = NULL; 118 source->blends = NULL;119 118 source->modelPSF = NULL; 120 119 source->modelEXT = NULL; … … 124 123 source->mode2 = PM_SOURCE_MODE_DEFAULT; 125 124 source->tmpFlags = 0; 126 source->extpars = NULL;127 source->diffStats = NULL;128 source->radialAper = NULL;129 source->parent = NULL;130 131 source->region = psRegionSet(NAN, NAN, NAN, NAN);132 psMemSetDeallocator(source, (psFreeFunc) sourceFree);133 125 134 126 // default values are NAN 135 127 source->psfMag = NAN; 128 source->psfMagErr = NAN; 136 129 source->psfFlux = NAN; 137 130 source->psfFluxErr = NAN; 138 131 source->extMag = NAN; 139 source->errMag = NAN;140 132 source->apMag = NAN; 141 133 source->apMagRaw = NAN; … … 143 135 source->apFlux = NAN; 144 136 source->apFluxErr = NAN; 145 source->sky = NAN; 146 source->skyErr = NAN; 137 147 138 source->pixWeightNotBad = NAN; 148 139 source->pixWeightNotPoor = NAN; … … 151 142 source->crNsigma = NAN; 152 143 source->extNsigma = NAN; 144 source->sky = NAN; 145 source->skyErr = NAN; 146 147 source->region = psRegionSet(NAN, NAN, NAN, NAN); 148 source->blends = NULL; 149 source->extpars = NULL; 150 source->diffStats = NULL; 151 source->radialAper = NULL; 152 source->parent = NULL; 153 source->imageID = -1; 154 155 psMemSetDeallocator(source, (psFreeFunc) sourceFree); 153 156 154 157 psTrace("psModules.objects", 10, "---- end ----\n"); … … 172 175 if (in->peak != NULL) { 173 176 source->peak = pmPeakAlloc (in->peak->x, in->peak->y, in->peak->detValue, in->peak->type); 174 source->peak->xf = in->peak->xf; 175 source->peak->yf = in->peak->yf; 176 source->peak->rawFlux = in->peak->rawFlux; 177 source->peak->rawFluxStdev = in->peak->rawFluxStdev; 178 source->peak->smoothFlux = in->peak->smoothFlux; 179 source->peak->smoothFluxStdev = in->peak->smoothFluxStdev; 180 // source->peak->SN = in->peak->SN; 177 pmPeakCopy(source->peak, in->peak); 181 178 } 182 179 … … 195 192 196 193 // the maskObj is a unique mask array; create a new mask image 197 source->maskObj = in->maskObj ? psImageCopy (NULL, in->maskObj, PS_TYPE_IMAGE_MASK) : NULL; 198 199 source->type = in->type; 200 source->mode = in->mode; 201 source->imageID = in->imageID; 194 source->maskObj = in->maskObj ? psImageCopy (NULL, in->maskObj, PS_TYPE_IMAGE_MASK) : NULL; 195 196 // NOTE : because of the const id element, we cannot just assign *source = *in 197 198 source->type = in->type; 199 source->mode = in->mode; 200 source->mode2 = in->mode2; 201 source->tmpFlags = in->tmpFlags; 202 source->psfMag = in->psfMag; 203 source->psfMagErr = in->psfMagErr; 204 source->psfFlux = in->psfFlux; 205 source->psfFluxErr = in->psfFluxErr; 206 source->extMag = in->extMag; 207 source->apMag = in->apMag; 208 source->apMagRaw = in->apMagRaw; 209 source->apRadius = in->apRadius; 210 source->apFlux = in->apFlux; 211 source->apFluxErr = in->apFluxErr; 212 source->pixWeightNotBad = in->pixWeightNotBad; 213 source->pixWeightNotPoor = in->pixWeightNotPoor; 214 source->psfChisq = in->psfChisq; 215 source->crNsigma = in->crNsigma; 216 source->extNsigma = in->extNsigma; 217 source->sky = in->sky; 218 source->skyErr = in->skyErr; 219 220 source->region = in->region; 202 221 203 222 return(source); … … 266 285 extend |= (mySource->maskObj == NULL); 267 286 extend |= (mySource->maskView == NULL); 287 288 // if ((fabs(x - 2020) < 5) && (fabs(y - 366) < 5)) { 289 // if (extend) { 290 // fprintf (stderr, "extend T, %f, %f : %f, %f vs %f, %f : %f, %f\n", 291 // newRegion.x0, newRegion.y0, newRegion.x1, newRegion.y1, 292 // mySource->region.x0, mySource->region.y0, mySource->region.x1, mySource->region.y1); 293 // } else { 294 // fprintf (stderr, "extend F, %f, %f : %f, %f vs %f, %f : %f, %f\n", 295 // newRegion.x0, newRegion.y0, newRegion.x1, newRegion.y1, 296 // mySource->region.x0, mySource->region.y0, mySource->region.x1, mySource->region.y1); 297 // } 298 // } 268 299 269 300 if (extend) { … … 486 517 // create vectors with Sx, Sy values in window 487 518 // clip sources based on S/N 488 for (psS32 i = 0 ; i < sources->n; i++)519 for (psS32 i = 0; i < sources->n; i++) 489 520 { 490 521 pmSource *tmpSrc = (pmSource *) sources->data[i]; … … 1175 1206 if (!source->moments) return false; // can't if there are no moments 1176 1207 if (!source->moments->nPixels) return false; // can't if the moments were not measured 1177 if (source->mode & &PM_SOURCE_MODE_MOMENTS_FAILURE) return false; // can't if the moments failed...1208 if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) return false; // can't if the moments failed... 1178 1209 1179 1210 if (source->mode & PM_SOURCE_MODE_SATSTAR) return true; // moments are best for SATSTARs -
trunk/psModules/src/objects/pmSource.h
r31153 r31451 80 80 pmSourceMode2 mode2; ///< analysis flags set for object. 81 81 pmSourceTmpF tmpFlags; ///< internal-only flags 82 psArray *blends; ///< collection of sources thought to be confused with object 82 83 83 float psfMag; ///< calculated from flux in modelPSF 84 float psfMagErr; ///< error in psfMag 84 85 float psfFlux; ///< calculated from flux in modelPSF 85 float psfFluxErr; ///< calculated from flux in modelPSF 86 float extMag; ///< calculated from flux in modelEXT 87 float errMag; ///< error in psfMag OR extMag (depending on type) 86 float psfFluxErr; ///< error in psfFlux 87 float extMag; ///< calculated from flux in modelEXT -- NOTE this is not actually used 88 88 float apMag; ///< apMag corresponding to psfMag or extMag (depending on type) 89 89 float apMagRaw; ///< raw mag in given aperture … … 98 98 float crNsigma; ///< Nsigma deviation from PSF to CR 99 99 float extNsigma; ///< Nsigma deviation from PSF to EXT 100 float sky, skyErr; ///< The sky and its error at the center of the object 100 float sky; ///< The sky at the center of the object 101 float skyErr; ///< The sky error at the center of the object 102 101 103 psRegion region; ///< area on image covered by selected pixels 104 psArray *blends; ///< collection of sources thought to be confused with object 102 105 pmSourceExtendedPars *extpars; ///< extended source parameters 103 106 pmSourceDiffStats *diffStats; ///< extra parameters for difference detections … … 254 257 float sigma, ///< size of Gaussian window function (<= 0.0 -> skip window) 255 258 float minSN, ///< minimum pixel significance 259 float minKronRadius, ///< minimum pixel significance 256 260 psImageMaskType maskVal 257 261 ); … … 273 277 float xGuess, float yGuess); 274 278 279 float pmSourceMinKronRadius(psArray *sources, float PSF_SN_LIM); 280 275 281 pmModel *pmSourceGetModel (bool *isPSF, const pmSource *source); 276 282 -
trunk/psModules/src/objects/pmSourceIO_CMF_PS1_DV1.c
r31153 r31451 125 125 psMetadataAdd (row, PS_LIST_TAIL, "PLTSCALE", PS_DATA_F32, "plate scale at source (arcsec/pixel)", outputs.pltScale); 126 126 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG", PS_DATA_F32, "PSF fit instrumental magnitude", source->psfMag); 127 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source-> errMag);127 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source->psfMagErr); 128 128 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX", PS_DATA_F32, "PSF fit instrumental magnitude", source->psfFlux); 129 129 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX_SIG",PS_DATA_F32, "Sigma of PSF instrumental magnitude", source->psfFluxErr); … … 256 256 257 257 source->psfMag = psMetadataLookupF32 (&status, row, "PSF_INST_MAG"); 258 source-> errMag= psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");258 source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG"); 259 259 source->apMag = psMetadataLookupF32 (&status, row, "AP_MAG"); 260 260 261 261 // XXX this scaling is incorrect: does not include the 2 \pi AREA factor 262 262 PAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN; 263 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source-> errMag: NAN;263 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN; 264 264 265 265 pmPSF_AxesToModel (PAR, axes); -
trunk/psModules/src/objects/pmSourceIO_CMF_PS1_DV2.c
r31153 r31451 124 124 psMetadataAdd (row, PS_LIST_TAIL, "PLTSCALE", PS_DATA_F32, "plate scale at source (arcsec/pixel)", outputs.pltScale); 125 125 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG", PS_DATA_F32, "PSF fit instrumental magnitude", source->psfMag); 126 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source-> errMag);126 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source->psfMagErr); 127 127 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX", PS_DATA_F32, "PSF fit instrumental magnitude", source->psfFlux); 128 128 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX_SIG",PS_DATA_F32, "Sigma of PSF instrumental magnitude", source->psfFluxErr); … … 274 274 275 275 source->psfMag = psMetadataLookupF32 (&status, row, "PSF_INST_MAG"); 276 source-> errMag= psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");276 source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG"); 277 277 source->apMag = psMetadataLookupF32 (&status, row, "AP_MAG"); 278 278 279 279 // XXX this scaling is incorrect: does not include the 2 \pi AREA factor 280 280 PAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN; 281 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source-> errMag: NAN;281 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN; 282 282 283 283 pmPSF_AxesToModel (PAR, axes); -
trunk/psModules/src/objects/pmSourceIO_CMF_PS1_SV1.c
r31153 r31451 125 125 psMetadataAdd (row, PS_LIST_TAIL, "PLTSCALE", PS_DATA_F32, "plate scale at source (arcsec/pixel)", outputs.pltScale); 126 126 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG", PS_DATA_F32, "PSF fit instrumental magnitude", source->psfMag); 127 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source-> errMag);127 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source->psfMagErr); 128 128 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX", PS_DATA_F32, "PSF fit instrumental flux (counts)", source->psfFlux); 129 129 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX_SIG",PS_DATA_F32, "Sigma of PSF instrumental flux", source->psfFluxErr); … … 273 273 // XXX use these to determine PAR[PM_PAR_I0]? 274 274 source->psfMag = psMetadataLookupF32 (&status, row, "PSF_INST_MAG"); 275 source-> errMag= psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");275 source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG"); 276 276 source->apMag = psMetadataLookupF32 (&status, row, "AP_MAG"); 277 277 278 278 // XXX this scaling is incorrect: does not include the 2 \pi AREA factor 279 279 PAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN; 280 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source-> errMag: NAN;280 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN; 281 281 282 282 pmPSF_AxesToModel (PAR, axes); … … 720 720 sprintf (keyword1, "RMIN_%02d", i); 721 721 sprintf (keyword2, "RMAX_%02d", i); 722 psMetadataAddF32 ( imageHeader, PS_LIST_TAIL, keyword1, PS_META_REPLACE, "min radius for SB profile", radMin->data.F32[i]);723 psMetadataAddF32 ( imageHeader, PS_LIST_TAIL, keyword2, PS_META_REPLACE, "min radius for SB profile", radMax->data.F32[i]);722 psMetadataAddF32 (outhead, PS_LIST_TAIL, keyword1, PS_META_REPLACE, "min radius for SB profile", radMin->data.F32[i]); 723 psMetadataAddF32 (outhead, PS_LIST_TAIL, keyword2, PS_META_REPLACE, "min radius for SB profile", radMax->data.F32[i]); 724 724 } 725 725 -
trunk/psModules/src/objects/pmSourceIO_CMF_PS1_V1.c
r31153 r31451 118 118 psMetadataAdd (row, PS_LIST_TAIL, "PLTSCALE", PS_DATA_F32, "plate scale at source (arcsec/pixel)", outputs.pltScale); 119 119 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG", PS_DATA_F32, "PSF fit instrumental magnitude", source->psfMag); 120 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source-> errMag);120 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source->psfMagErr); 121 121 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG", PS_DATA_F32, "magnitude in standard aperture", source->apMag); 122 122 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS", PS_DATA_F32, "radius used for aperture mags", outputs.apRadius); … … 241 241 // XXX use these to determine PAR[PM_PAR_I0]? 242 242 source->psfMag = psMetadataLookupF32 (&status, row, "PSF_INST_MAG"); 243 source-> errMag= psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");243 source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG"); 244 244 source->apMag = psMetadataLookupF32 (&status, row, "AP_MAG"); 245 245 246 246 // XXX this scaling is incorrect: does not include the 2 \pi AREA factor 247 247 PAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN; 248 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source-> errMag: NAN;248 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN; 249 249 250 250 pmPSF_AxesToModel (PAR, axes); -
trunk/psModules/src/objects/pmSourceIO_CMF_PS1_V2.c
r31153 r31451 116 116 psMetadataAdd (row, PS_LIST_TAIL, "PLTSCALE", PS_DATA_F32, "plate scale at source (arcsec/pixel)", outputs.pltScale); 117 117 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG", PS_DATA_F32, "PSF fit instrumental magnitude", source->psfMag); 118 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source-> errMag);118 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source->psfMagErr); 119 119 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG", PS_DATA_F32, "magnitude in standard aperture", source->apMag); 120 120 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS", PS_DATA_F32, "radius used for aperture mags", outputs.apRadius); … … 247 247 // XXX use these to determine PAR[PM_PAR_I0]? 248 248 source->psfMag = psMetadataLookupF32 (&status, row, "PSF_INST_MAG"); 249 source-> errMag= psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");249 source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG"); 250 250 source->apMag = psMetadataLookupF32 (&status, row, "AP_MAG"); 251 251 252 252 // XXX this scaling is incorrect: does not include the 2 \pi AREA factor 253 253 PAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN; 254 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source-> errMag: NAN;254 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN; 255 255 256 256 pmPSF_AxesToModel (PAR, axes); -
trunk/psModules/src/objects/pmSourceIO_CMF_PS1_V3.c
r31153 r31451 116 116 psMetadataAdd (row, PS_LIST_TAIL, "PLTSCALE", PS_DATA_F32, "plate scale at source (arcsec/pixel)", outputs.pltScale); 117 117 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG", PS_DATA_F32, "PSF fit instrumental magnitude", source->psfMag); 118 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source-> errMag);118 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", source->psfMagErr); 119 119 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX", PS_DATA_F32, "PSF fit instrumental flux (counts)", source->psfFlux); 120 120 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX_SIG",PS_DATA_F32, "Sigma of PSF instrumental flux", source->psfFluxErr); … … 161 161 psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_INNER", PS_DATA_F32, "Kron Flux (in 2.5 R1)", moments.Kinner); 162 162 psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_OUTER", PS_DATA_F32, "Kron Flux (in 2.5 R1)", moments.Kouter); 163 164 // Do NOT write these : not consistent with the definition of PS1_V3 in Ohana/src/libautocode/dev/cmf-ps1-v3.d 163 165 // psMetadataAdd (row, PS_LIST_TAIL, "KRON_CORE_FLUX", PS_DATA_F32, "Kron Flux (in 1.0 R1)", moments.KronCore); 164 // psMetadataAdd (row, PS_LIST_TAIL, "KRON_CORE_ERROR", PS_DATA_F32, "Kron Error (in 1.0 R1)", moments.KronCoreErr);166 // psMetadataAdd (row, PS_LIST_TAIL, "KRON_CORE_ERROR", PS_DATA_F32, "Kron Error (in 1.0 R1)", moments.KronCoreErr); 165 167 psMetadataAdd (row, PS_LIST_TAIL, "FLAGS", PS_DATA_U32, "psphot analysis flags", source->mode); 166 168 psMetadataAdd (row, PS_LIST_TAIL, "FLAGS2", PS_DATA_U32, "psphot analysis flags", source->mode2); … … 270 272 // XXX use these to determine PAR[PM_PAR_I0]? 271 273 source->psfMag = psMetadataLookupF32 (&status, row, "PSF_INST_MAG"); 272 source-> errMag= psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");274 source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG"); 273 275 source->apMag = psMetadataLookupF32 (&status, row, "AP_MAG"); 274 276 275 277 // XXX this scaling is incorrect: does not include the 2 \pi AREA factor 276 278 PAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN; 277 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source-> errMag: NAN;279 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN; 278 280 279 281 pmPSF_AxesToModel (PAR, axes); … … 292 294 293 295 // we no longer sort by S/N, only flux 294 // if (isfinite (source-> errMag) && (source->errMag> 0.0)) {295 // source->peak->SN = 1.0 / source-> errMag;296 // if (isfinite (source->psfMagErr) && (source->psfMagErr > 0.0)) { 297 // source->peak->SN = 1.0 / source->psfMagErr; 296 298 // } else { 297 299 // source->peak->SN = sqrt(source->peak->flux); // an alternate proxy: various functions sort by peak S/N -
trunk/psModules/src/objects/pmSourceIO_CMP.c
r29004 r31451 137 137 axes = pmPSF_ModelToAxes (PAR, 20.0); 138 138 139 float errMag = isfinite(source->errMag) ? source->errMag: 999;139 float psfMagErr = isfinite(source->psfMagErr) ? source->psfMagErr : 999; 140 140 141 141 psLineInit (line); … … 143 143 psLineAdd (line, "%6.1f ", PAR[PM_PAR_YPOS]); 144 144 psLineAdd (line, "%6.3f ", PS_MIN (99.0, source->psfMag + ZERO_POINT)); 145 psLineAdd (line, "%03d ", PS_MIN (999, (int) errMag));145 psLineAdd (line, "%03d ", PS_MIN (999, (int)psfMagErr)); 146 146 psLineAdd (line, "%2d ", type); 147 147 psLineAdd (line, "%3.1f ", lsky); … … 280 280 source->psfMag = atof (array->data[2]); 281 281 source->extMag = atof (array->data[6]); 282 source-> errMag= atof (array->data[3]) / 1000.0;282 source->psfMagErr = atof (array->data[3]) / 1000.0; 283 283 source->apMag = atof (array->data[7]); 284 284 axes.major = atof (array->data[8]); -
trunk/psModules/src/objects/pmSourceIO_PS1_CAL_0.c
r31153 r31451 71 71 psF32 xPos, yPos; 72 72 psF32 xErr, yErr; 73 psF32 errMag, chisq;73 psF32 psfMagErr, chisq; 74 74 75 75 pmChip *chip = readout->parent->parent; … … 121 121 chisq = model->chisq; 122 122 123 // need to determine the PSF photometry error: source-> errMagis the error on the 'best' model mag.124 errMag= model->dparams->data.F32[PM_PAR_I0] / model->params->data.F32[PM_PAR_I0];123 // need to determine the PSF photometry error: source->psfMagErr is the error on the 'best' model mag. 124 psfMagErr = model->dparams->data.F32[PM_PAR_I0] / model->params->data.F32[PM_PAR_I0]; 125 125 } else { 126 126 xPos = source->peak->xf; … … 132 132 axes.theta = NAN; 133 133 chisq = NAN; 134 errMag= NAN;134 psfMagErr = NAN; 135 135 } 136 136 … … 167 167 psMetadataAdd (row, PS_LIST_TAIL, "Y_PSF_SIG", PS_DATA_F32, "Sigma in PSF y coordinate", yErr); 168 168 psMetadataAdd (row, PS_LIST_TAIL, "CAL_PSF_MAG", PS_DATA_F32, "Calibrated Magnitude from PSF Fit", calMag); 169 psMetadataAdd (row, PS_LIST_TAIL, "CAL_PSF_MAG_SIG", PS_DATA_F32, "Calibrated Magnitude Error", errMag);169 psMetadataAdd (row, PS_LIST_TAIL, "CAL_PSF_MAG_SIG", PS_DATA_F32, "Calibrated Magnitude Error", psfMagErr); 170 170 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG", PS_DATA_F32, "PSF fit instrumental magnitude", source->psfMag); 171 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", errMag);171 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", psfMagErr); 172 172 psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", peakMag); 173 173 psMetadataAdd (row, PS_LIST_TAIL, "SKY", PS_DATA_F32, "Sky level", source->sky); … … 284 284 // XXX use these to determine PAR[PM_PAR_I0]? 285 285 source->psfMag = psMetadataLookupF32 (&status, row, "PSF_INST_MAG"); 286 source-> errMag= psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");286 source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG"); 287 287 PAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN; 288 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source-> errMag: NAN;288 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN; 289 289 290 290 pmPSF_AxesToModel (PAR, axes); -
trunk/psModules/src/objects/pmSourceIO_PS1_DEV_0.c
r31153 r31451 113 113 psMetadataAdd (row, PS_LIST_TAIL, "Y_PSF_SIG", PS_DATA_F32, "Sigma in PSF y coordinate", yErr); 114 114 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG", PS_DATA_F32, "PSF fit instrumental magnitude", PS_MIN (99.0, source->psfMag)); 115 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", PS_MIN (99.0, source-> errMag));115 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", PS_MIN (99.0, source->psfMagErr)); 116 116 psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", PS_MIN (99.0, peakMag)); 117 117 psMetadataAdd (row, PS_LIST_TAIL, "SKY", PS_DATA_F32, "Sky level", source->sky); … … 212 212 // XXX use these to determine PAR[PM_PAR_I0]? 213 213 source->psfMag = psMetadataLookupF32 (&status, row, "PSF_INST_MAG"); 214 source-> errMag= psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");214 source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG"); 215 215 216 216 pmPSF_AxesToModel (PAR, axes); -
trunk/psModules/src/objects/pmSourceIO_PS1_DEV_1.c
r31153 r31451 70 70 psF32 xPos, yPos; 71 71 psF32 xErr, yErr; 72 psF32 errMag, chisq;72 psF32 psfMagErr, chisq; 73 73 74 74 // let's write these out in S/N order … … 103 103 chisq = model->chisq; 104 104 105 // need to determine the PSF photometry error: source-> errMagis the error on the 'best' model mag.106 errMag= model->dparams->data.F32[PM_PAR_I0] / model->params->data.F32[PM_PAR_I0];105 // need to determine the PSF photometry error: source->psfMagErr is the error on the 'best' model mag. 106 psfMagErr = model->dparams->data.F32[PM_PAR_I0] / model->params->data.F32[PM_PAR_I0]; 107 107 } else { 108 108 xPos = source->peak->xf; … … 114 114 axes.theta = NAN; 115 115 chisq = NAN; 116 errMag= NAN;116 psfMagErr = NAN; 117 117 } 118 118 … … 128 128 psMetadataAdd (row, PS_LIST_TAIL, "Y_PSF_SIG", PS_DATA_F32, "Sigma in PSF y coordinate", yErr); 129 129 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG", PS_DATA_F32, "PSF fit instrumental magnitude", source->psfMag); 130 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", errMag);130 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_MAG_SIG", PS_DATA_F32, "Sigma of PSF instrumental magnitude", psfMagErr); 131 131 psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", peakMag); 132 132 psMetadataAdd (row, PS_LIST_TAIL, "SKY", PS_DATA_F32, "Sky level", source->sky); … … 253 253 // XXX use these to determine PAR[PM_PAR_I0]? 254 254 source->psfMag = psMetadataLookupF32 (&status, row, "PSF_INST_MAG"); 255 source-> errMag= psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG");255 source->psfMagErr = psMetadataLookupF32 (&status, row, "PSF_INST_MAG_SIG"); 256 256 PAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? pow(10.0, -0.4*source->psfMag) : NAN; 257 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source-> errMag: NAN;257 dPAR[PM_PAR_I0] = (isfinite(source->psfMag)) ? PAR[PM_PAR_I0] * source->psfMagErr : NAN; 258 258 259 259 pmPSF_AxesToModel (PAR, axes); -
trunk/psModules/src/objects/pmSourceIO_RAW.c
r31153 r31451 110 110 fprintf (f, "%7.1f %7.1f %7.1f %8.4f %7.4f %7.4f ", 111 111 PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], source->sky, 112 source->psfMag, source-> errMag, dPos);112 source->psfMag, source->psfMagErr, dPos); 113 113 114 114 for (j = 4; j < model->params->n; j++) { … … 174 174 fprintf (f, "%7.1f %7.1f %7.1f %8.4f %7.4f %7.4f ", 175 175 PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], source->sky, 176 source->extMag, source-> errMag, dPos);176 source->extMag, source->psfMagErr, dPos); 177 177 178 178 for (j = 4; j < model->params->n; j++) { -
trunk/psModules/src/objects/pmSourceIO_SMPDATA.c
r31153 r31451 106 106 psMetadataAdd (row, PS_LIST_TAIL, "Y_PIX", PS_DATA_F32, "", yPos); 107 107 psMetadataAdd (row, PS_LIST_TAIL, "MAG_RAW", PS_DATA_F32, "", PS_MIN (99.0, source->psfMag + ZERO_POINT)); 108 psMetadataAdd (row, PS_LIST_TAIL, "MAG_ERR", PS_DATA_F32, "", PS_MIN (999, 1000*source-> errMag));108 psMetadataAdd (row, PS_LIST_TAIL, "MAG_ERR", PS_DATA_F32, "", PS_MIN (999, 1000*source->psfMagErr)); 109 109 psMetadataAdd (row, PS_LIST_TAIL, "MAG_GAL", PS_DATA_F32, "", PS_MIN (99.0, source->extMag + ZERO_POINT)); 110 110 psMetadataAdd (row, PS_LIST_TAIL, "MAG_AP", PS_DATA_F32, "", PS_MIN (99.0, source->apMag + ZERO_POINT)); … … 194 194 source->psfMag = psMetadataLookupF32 (&status, row, "MAG_RAW") - ZERO_POINT; 195 195 source->extMag = psMetadataLookupF32 (&status, row, "MAG_GAL") - ZERO_POINT; 196 source-> errMag= psMetadataLookupF32 (&status, row, "MAG_ERR") * 0.001;196 source->psfMagErr = psMetadataLookupF32 (&status, row, "MAG_ERR") * 0.001; 197 197 source->apMag = psMetadataLookupF32 (&status, row, "MAG_AP") - ZERO_POINT; 198 198 -
trunk/psModules/src/objects/pmSourceIO_SX.c
r29004 r31451 88 88 psLineAdd (line, "%11.3f", PAR[PM_PAR_YPOS]); 89 89 psLineAdd (line, "%9.4f", source->psfMag); 90 psLineAdd (line, "%9.4f", source-> errMag);90 psLineAdd (line, "%9.4f", source->psfMagErr); 91 91 psLineAdd (line, "%13.4f", source->sky); 92 92 psLineAdd (line, "%9.2f", axes.major); -
trunk/psModules/src/objects/pmSourceMasks.h
r31153 r31451 14 14 PM_SOURCE_MODE_PSFSTAR = 0x00000040, ///< Source used to define PSF model 15 15 PM_SOURCE_MODE_SATSTAR = 0x00000080, ///< Source model peak is above saturation 16 PM_SOURCE_MODE_BLEND = 0x00000100, ///< Source is a blend with other source rs16 PM_SOURCE_MODE_BLEND = 0x00000100, ///< Source is a blend with other sources 17 17 PM_SOURCE_MODE_EXTERNAL = 0x00000200, ///< Source based on supplied input position 18 18 PM_SOURCE_MODE_BADPSF = 0x00000400, ///< Failed to get good estimate of object's PSF … … 51 51 PM_SOURCE_MODE2_ON_BURNTOOL = 0x00000020, ///< > 25% of (PSF-weighted) pixels land on burntool 52 52 PM_SOURCE_MODE2_ON_CONVPOOR = 0x00000040, ///< > 25% of (PSF-weighted) pixels land on convpoor 53 54 PM_SOURCE_MODE2_PASS1_SRC = 0x00000080, ///< source detected in first pass analysis 53 55 } pmSourceMode2; 54 56 -
trunk/psModules/src/objects/pmSourceMatch.c
r29004 r31451 88 88 pmSource *source = sources->data[i]; // Source of interest 89 89 if (!source || (source->mode & SOURCE_MASK) || !isfinite(source->psfMag) || 90 !isfinite(source-> errMag) || source->psfMag > SOURCE_FAINTEST) {90 !isfinite(source->psfMagErr) || source->psfMag > SOURCE_FAINTEST) { 91 91 continue; 92 92 } … … 102 102 (*y)->data.F32[num] = ySrc; 103 103 (*mag)->data.F32[num] = source->psfMag; 104 (*magErr)->data.F32[num] = source-> errMag;104 (*magErr)->data.F32[num] = source->psfMagErr; 105 105 (*indices)->data.S32[num] = i; 106 106 num++; -
trunk/psModules/src/objects/pmSourceMoments.c
r31153 r31451 66 66 // if mode & EXTERNAL or mode2 & MATCHED, do not re-calculate the centroid (use peak as centroid) 67 67 68 bool pmSourceMoments(pmSource *source, psF32 radius, psF32 sigma, psF32 minSN, psImageMaskType maskVal)68 bool pmSourceMoments(pmSource *source, float radius, float sigma, float minSN, float minKronRadius, psImageMaskType maskVal) 69 69 { 70 70 PS_ASSERT_PTR_NON_NULL(source, false); … … 74 74 75 75 // this function assumes the sky has been well-subtracted for the image 76 psF32sky = 0.0;76 float sky = 0.0; 77 77 78 78 if (source->moments == NULL) { … … 80 80 } 81 81 82 psF32Sum = 0.0;83 psF32Var = 0.0;84 psF32SumCore = 0.0;85 psF32VarCore = 0.0;86 psF32R2 = PS_SQR(radius);87 psF32minSN2 = PS_SQR(minSN);88 psF32rsigma2 = 0.5 / PS_SQR(sigma);82 float Sum = 0.0; 83 float Var = 0.0; 84 float SumCore = 0.0; 85 float VarCore = 0.0; 86 float R2 = PS_SQR(radius); 87 float minSN2 = PS_SQR(minSN); 88 float rsigma2 = 0.5 / PS_SQR(sigma); 89 89 90 90 // a note about coordinates: coordinates of objects throughout psphot refer to the primary … … 109 109 // Xn = SUM (x - xc)^n * (z - sky) 110 110 111 psF32 RF = 0.0; 112 psF32 RH = 0.0; 113 psF32 RS = 0.0; 114 psF32 XX = 0.0; 115 psF32 XY = 0.0; 116 psF32 YY = 0.0; 117 psF32 XXX = 0.0; 118 psF32 XXY = 0.0; 119 psF32 XYY = 0.0; 120 psF32 YYY = 0.0; 121 psF32 XXXX = 0.0; 122 psF32 XXXY = 0.0; 123 psF32 XXYY = 0.0; 124 psF32 XYYY = 0.0; 125 psF32 YYYY = 0.0; 111 float RFW = 0.0; 112 float RHW = 0.0; 113 114 float RF = 0.0; 115 float RH = 0.0; 116 float RS = 0.0; 117 float XX = 0.0; 118 float XY = 0.0; 119 float YY = 0.0; 120 float XXX = 0.0; 121 float XXY = 0.0; 122 float XYY = 0.0; 123 float YYY = 0.0; 124 float XXXX = 0.0; 125 float XXXY = 0.0; 126 float XXYY = 0.0; 127 float XYYY = 0.0; 128 float YYYY = 0.0; 126 129 127 130 Sum = 0.0; // the second pass may include slightly different pixels, re-determine Sum 131 132 // float dX = source->moments->Mx - source->peak->xf; 133 // float dY = source->moments->My - source->peak->yf; 134 // float dR = hypot(dX, dY); 135 // float Xo = (dR < 2.0) ? source->moments->Mx : source->peak->xf; 136 // float Yo = (dR < 2.0) ? source->moments->My : source->peak->yf; 137 float Xo = source->moments->Mx; 138 float Yo = source->moments->My; 128 139 129 140 // center of mass in subimage. Note: the calculation below uses pixel index, so we correct 130 141 // xCM, yCM from pixel coords to pixel index here. 131 psF32 xCM = source->moments->Mx- 0.5 - source->pixels->col0; // coord of peak in subimage132 psF32 yCM = source->moments->My- 0.5 - source->pixels->row0; // coord of peak in subimage142 float xCM = Xo - 0.5 - source->pixels->col0; // coord of peak in subimage 143 float yCM = Yo - 0.5 - source->pixels->row0; // coord of peak in subimage 133 144 134 145 for (psS32 row = 0; row < source->pixels->numRows ; row++) { 135 146 136 psF32yDiff = row - yCM;147 float yDiff = row - yCM; 137 148 if (fabs(yDiff) > radius) continue; 138 149 139 psF32 *vPix = source->pixels->data.F32[row]; 140 psF32 *vWgt = source->variance->data.F32[row]; 150 float *vPix = source->pixels->data.F32[row]; 151 float *vWgt = source->variance->data.F32[row]; 152 141 153 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; 154 // psImageMaskType *vMsk = (source->maskView == NULL) ? NULL : source->maskView->data.PS_TYPE_IMAGE_MASK_DATA[row]; 142 155 143 156 for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) { … … 151 164 if (isnan(*vPix)) continue; 152 165 153 psF32xDiff = col - xCM;166 float xDiff = col - xCM; 154 167 if (fabs(xDiff) > radius) continue; 155 168 156 169 // radius is just a function of (xDiff, yDiff) 157 psF32r2 = PS_SQR(xDiff) + PS_SQR(yDiff);170 float r2 = PS_SQR(xDiff) + PS_SQR(yDiff); 158 171 if (r2 > R2) continue; 159 172 160 psF32fDiff = *vPix - sky;161 psF32pDiff = fDiff;162 psF32wDiff = *vWgt;173 float fDiff = *vPix - sky; 174 float pDiff = fDiff; 175 float wDiff = *vWgt; 163 176 164 177 // skip pixels below specified significance level. this is allowed, but should be … … 171 184 // weighting over weights the sky for faint sources 172 185 if (sigma > 0.0) { 173 psF32z = r2 * rsigma2;186 float z = r2 * rsigma2; 174 187 assert (z >= 0.0); 175 psF32weight = exp(-z);188 float weight = exp(-z); 176 189 177 190 wDiff *= weight; … … 182 195 183 196 // Kron Flux uses the 1st radial moment (NOT Gaussian windowed?) 184 psF32 r = sqrt(r2); 185 psF32 rf = r * fDiff; 186 psF32 rh = sqrt(r) * fDiff; 187 psF32 rs = fDiff; 188 189 psF32 x = xDiff * pDiff; 190 psF32 y = yDiff * pDiff; 191 192 psF32 xx = xDiff * x; 193 psF32 xy = xDiff * y; 194 psF32 yy = yDiff * y; 195 196 psF32 xxx = xDiff * xx / r; 197 psF32 xxy = xDiff * xy / r; 198 psF32 xyy = xDiff * yy / r; 199 psF32 yyy = yDiff * yy / r; 200 201 psF32 xxxx = xDiff * xxx / r2; 202 psF32 xxxy = xDiff * xxy / r2; 203 psF32 xxyy = xDiff * xyy / r2; 204 psF32 xyyy = xDiff * yyy / r2; 205 psF32 yyyy = yDiff * yyy / r2; 197 float r = sqrt(r2); 198 float rf = r * fDiff; 199 float rh = sqrt(r) * fDiff; 200 float rs = fDiff; 201 202 float rfw = r * pDiff; 203 float rhw = sqrt(r) * pDiff; 204 205 float x = xDiff * pDiff; 206 float y = yDiff * pDiff; 207 208 float xx = xDiff * x; 209 float xy = xDiff * y; 210 float yy = yDiff * y; 211 212 float xxx = xDiff * xx / r; 213 float xxy = xDiff * xy / r; 214 float xyy = xDiff * yy / r; 215 float yyy = yDiff * yy / r; 216 217 float xxxx = xDiff * xxx / r2; 218 float xxxy = xDiff * xxy / r2; 219 float xxyy = xDiff * xyy / r2; 220 float xyyy = xDiff * yyy / r2; 221 float yyyy = yDiff * yyy / r2; 206 222 207 223 RF += rf; 208 224 RH += rh; 209 225 RS += rs; 226 227 RFW += rfw; 228 RHW += rhw; 210 229 211 230 XX += xx; … … 244 263 source->moments->Myyyy = YYYY/Sum; 245 264 246 // Calculate the Kron magnitude (make this block optional?) 247 float radKinner = 1.0*source->moments->Mrf; 248 float radKron = 2.5*source->moments->Mrf; 249 float radKouter = 4.0*source->moments->Mrf; 265 // if Mrf (first radial moment) is very small, we are getting into low-significance 266 // territory. saturate at minKronRadius. conversely, if Mrf is > radius, we are clearly 267 // making an error. saturate at radius. 268 float kronRefRadius = MIN(radius, MAX(minKronRadius, source->moments->Mrf)); 269 270 float radKinner = 1.0*kronRefRadius; 271 float radKron = 2.5*kronRefRadius; 272 float radKouter = 4.0*kronRefRadius; 250 273 251 274 int nKronPix = 0; … … 259 282 for (psS32 row = 0; row < source->pixels->numRows ; row++) { 260 283 261 psF32yDiff = row - yCM;284 float yDiff = row - yCM; 262 285 if (fabs(yDiff) > radKouter) continue; 263 286 264 psF32 *vPix = source->pixels->data.F32[row]; 265 psF32 *vWgt = source->variance->data.F32[row]; 287 float *vPix = source->pixels->data.F32[row]; 288 float *vWgt = source->variance->data.F32[row]; 289 266 290 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; 291 // psImageMaskType *vMsk = (source->maskView == NULL) ? NULL : source->maskView->data.PS_TYPE_IMAGE_MASK_DATA[row]; 267 292 268 293 for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) { … … 276 301 if (isnan(*vPix)) continue; 277 302 278 psF32xDiff = col - xCM;303 float xDiff = col - xCM; 279 304 if (fabs(xDiff) > radKouter) continue; 280 305 281 306 // radKron is just a function of (xDiff, yDiff) 282 psF32r2 = PS_SQR(xDiff) + PS_SQR(yDiff);283 284 psF32pDiff = *vPix - sky;285 psF32wDiff = *vWgt;307 float r2 = PS_SQR(xDiff) + PS_SQR(yDiff); 308 309 float pDiff = *vPix - sky; 310 float wDiff = *vWgt; 286 311 287 312 // skip pixels below specified significance level. this is allowed, but should be … … 290 315 if (PS_SQR(pDiff) < minSN2*wDiff) continue; 291 316 292 psF32r = sqrt(r2);317 float r = sqrt(r2); 293 318 if (r < radKron) { 294 319 Sum += pDiff; … … 335 360 } 336 361 337 bool pmSourceMomentsGetCentroid(pmSource *source, psF32 radius, psF32 sigma, psF32minSN, psImageMaskType maskVal, float xGuess, float yGuess) {362 bool pmSourceMomentsGetCentroid(pmSource *source, float radius, float sigma, float minSN, psImageMaskType maskVal, float xGuess, float yGuess) { 338 363 339 364 // First Pass: calculate the first moments (these are subtracted from the coordinates below) … … 342 367 // .. etc 343 368 344 psF32sky = 0.0;345 346 psF32peakPixel = -PS_MAX_F32;369 float sky = 0.0; 370 371 float peakPixel = -PS_MAX_F32; 347 372 psS32 numPixels = 0; 348 psF32Sum = 0.0;349 psF32Var = 0.0;350 psF32X1 = 0.0;351 psF32Y1 = 0.0;352 psF32R2 = PS_SQR(radius);353 psF32minSN2 = PS_SQR(minSN);354 psF32rsigma2 = 0.5 / PS_SQR(sigma);373 float Sum = 0.0; 374 float Var = 0.0; 375 float X1 = 0.0; 376 float Y1 = 0.0; 377 float R2 = PS_SQR(radius); 378 float minSN2 = PS_SQR(minSN); 379 float rsigma2 = 0.5 / PS_SQR(sigma); 355 380 356 381 float xPeak = xGuess - source->pixels->col0; // coord of peak in subimage … … 358 383 359 384 // we are guaranteed to have a valid pixel and variance at this location (right? right?) 360 // psF32weightNorm = source->pixels->data.F32[yPeak][xPeak] / sqrt (source->variance->data.F32[yPeak][xPeak]);385 // float weightNorm = source->pixels->data.F32[yPeak][xPeak] / sqrt (source->variance->data.F32[yPeak][xPeak]); 361 386 // psAssert (isfinite(source->pixels->data.F32[yPeak][xPeak]), "peak must be on valid pixel"); 362 387 // psAssert (isfinite(source->variance->data.F32[yPeak][xPeak]), "peak must be on valid pixel"); … … 370 395 for (psS32 row = 0; row < source->pixels->numRows ; row++) { 371 396 372 psF32yDiff = row + 0.5 - yPeak;397 float yDiff = row + 0.5 - yPeak; 373 398 if (fabs(yDiff) > radius) continue; 374 399 375 psF32 *vPix = source->pixels->data.F32[row]; 376 psF32 *vWgt = source->variance->data.F32[row]; 400 float *vPix = source->pixels->data.F32[row]; 401 float *vWgt = source->variance->data.F32[row]; 402 377 403 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; 404 // psImageMaskType *vMsk = (source->maskView == NULL) ? NULL : source->maskView->data.PS_TYPE_IMAGE_MASK_DATA[row]; 378 405 379 406 for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) { … … 387 414 if (isnan(*vPix)) continue; 388 415 389 psF32xDiff = col + 0.5 - xPeak;416 float xDiff = col + 0.5 - xPeak; 390 417 if (fabs(xDiff) > radius) continue; 391 418 392 419 // radius is just a function of (xDiff, yDiff) 393 psF32r2 = PS_SQR(xDiff) + PS_SQR(yDiff);420 float r2 = PS_SQR(xDiff) + PS_SQR(yDiff); 394 421 if (r2 > R2) continue; 395 422 396 psF32pDiff = *vPix - sky;397 psF32wDiff = *vWgt;423 float pDiff = *vPix - sky; 424 float wDiff = *vWgt; 398 425 399 426 // skip pixels below specified significance level. for a PSFs, this … … 408 435 // weighting over weights the sky for faint sources 409 436 if (sigma > 0.0) { 410 psF32z = r2*rsigma2;437 float z = r2*rsigma2; 411 438 assert (z >= 0.0); 412 psF32weight = exp(-z);439 float weight = exp(-z); 413 440 414 441 wDiff *= weight; … … 419 446 Sum += pDiff; 420 447 421 psF32xWght = xDiff * pDiff;422 psF32yWght = yDiff * pDiff;448 float xWght = xDiff * pDiff; 449 float yWght = yDiff * pDiff; 423 450 424 451 X1 += xWght; … … 477 504 return true; 478 505 } 506 507 float pmSourceMinKronRadius(psArray *sources, float PSF_SN_LIM) { 508 509 psVector *radii = psVectorAllocEmpty(100, PS_TYPE_F32); 510 511 for (int i = 0; i < sources->n; i++) { 512 pmSource *src = sources->data[i]; // Source of interest 513 if (!src || !src->moments) { 514 continue; 515 } 516 517 if (src->mode & PM_SOURCE_MODE_BLEND) { 518 continue; 519 } 520 521 if (!src->moments->nPixels) continue; 522 523 if (src->moments->SN < PSF_SN_LIM) continue; 524 525 // XXX put in Mxx,Myy cut based on clump location 526 527 psVectorAppend(radii, src->moments->Mrf); 528 } 529 530 // find the peak in this image 531 psStats *stats = psStatsAlloc (PS_STAT_SAMPLE_MEDIAN); 532 533 if (!psVectorStats (stats, radii, NULL, NULL, 0)) { 534 psError(PS_ERR_UNKNOWN, false, "Unable to get image statistics.\n"); 535 psFree(stats); 536 return NAN; 537 } 538 539 float minRadius = stats->sampleMedian; 540 541 psFree(radii); 542 psFree(stats); 543 return minRadius; 544 } 545 -
trunk/psModules/src/objects/pmSourceOutputs.c
r31153 r31451 98 98 outputs->xPos = PAR[PM_PAR_XPOS]; 99 99 outputs->yPos = PAR[PM_PAR_YPOS]; 100 if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) { 100 if ((source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) && !(source->mode & PM_SOURCE_MODE_EXTMODEL)) { 101 // we only do non-linear PSF fits for non-extended objects 101 102 outputs->xErr = dPAR[PM_PAR_XPOS]; 102 103 outputs->yErr = dPAR[PM_PAR_YPOS]; 103 104 } else { 104 outputs->xErr = fwhmMajor * source-> errMag/ 2.35;105 outputs->yErr = fwhmMinor * source-> errMag/ 2.35;105 outputs->xErr = fwhmMajor * source->psfMagErr / 2.35; 106 outputs->yErr = fwhmMinor * source->psfMagErr / 2.35; 106 107 } 107 if (isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SX X]) && isfinite(PAR[PM_PAR_SXX])) {108 if (isfinite(PAR[PM_PAR_SXX]) && isfinite(PAR[PM_PAR_SXY]) && isfinite(PAR[PM_PAR_SYY])) { 108 109 axes = pmPSF_ModelToAxes (PAR, 20.0); 109 110 outputs->psfMajor = axes.major; … … 125 126 outputs->xPos = source->moments->Mx; 126 127 outputs->yPos = source->moments->My; 127 outputs->xErr = fwhmMajor * source-> errMag/ 2.35;128 outputs->yErr = fwhmMinor * source-> errMag/ 2.35;128 outputs->xErr = fwhmMajor * source->psfMagErr / 2.35; 129 outputs->yErr = fwhmMinor * source->psfMagErr / 2.35; 129 130 } else { 130 131 outputs->xPos = source->peak->xf; -
trunk/psModules/src/objects/pmSourcePhotometry.c
r31153 r31451 82 82 - apMag : only if S/N > AP_MIN_SN 83 83 : is optionally corrected for curve-of-growth if: 84 - the source is a STAR (PSF)85 84 - the option is selected (mode & PM_SOURCE_PHOT_GROWTH) 86 85 - psfMag : all sources with non-NULL modelPSF 87 86 : is optionally corrected for aperture residual if: 88 - the source is a STAR (PSF)89 87 - the option is selected (mode & PM_SOURCE_PHOT_APCORR) 90 91 88 - extMag : all sources with non-NULL modelEXT 92 89 **/ … … 100 97 101 98 int status = false; 102 bool isPSF;103 99 float x, y; 104 float rflux;105 100 float SN; 106 pmModel *model;107 101 108 102 source->psfMag = NAN; 109 103 source->extMag = NAN; 110 source-> errMag= NAN;104 source->psfMagErr = NAN; 111 105 source->apMag = NAN; 112 106 source->apMagRaw = NAN; … … 114 108 source->apFluxErr = NAN; 115 109 116 // we must have a valid model 117 // XXX allow aperture magnitudes for sources without a model 118 model = pmSourceGetModel (&isPSF, source); 119 if (model == NULL) { 120 psTrace ("psModules.objects", 3, "fail mag : no valid model"); 110 // XXXXXX review: 111 // Select the 'best' model -- this is used for PSF_QF,_PERFECT & ???. isPSF is true if this 112 // object is a PSF (not extended). We must have a valid model. XXX NOTE: allow aperture 113 // magnitudes for sources without a model 114 115 // select the psf model 116 pmModel *modelPSF = source->modelPSF; 117 if (modelPSF == NULL) { 118 psTrace ("psModules.objects", 3, "fail mag : no valid PSF model"); 121 119 return false; 122 120 } 123 121 124 // XXX handle negative flux, low-significance125 if (model ->dparams->data.F32[PM_PAR_I0] > 0) {126 SN = fabs(model ->params->data.F32[PM_PAR_I0] / model->dparams->data.F32[PM_PAR_I0]);127 source-> errMag= 1.0 / SN;122 // get the error on the PSF model magnitude 123 if (modelPSF->dparams->data.F32[PM_PAR_I0] > 0) { 124 SN = fabs(modelPSF->params->data.F32[PM_PAR_I0] / modelPSF->dparams->data.F32[PM_PAR_I0]); 125 source->psfMagErr = 1.0 / SN; 128 126 } else { 129 127 SN = NAN; 130 source->errMag = NAN; 131 } 132 x = model->params->data.F32[PM_PAR_XPOS]; 133 y = model->params->data.F32[PM_PAR_YPOS]; 128 source->psfMagErr = NAN; 129 } 130 // the source position is used to recenter the aperture for ap photometry 131 x = modelPSF->params->data.F32[PM_PAR_XPOS]; 132 y = modelPSF->params->data.F32[PM_PAR_YPOS]; 134 133 135 134 // measure PSF model photometry 136 // XXX TEST: do not use flux scale 137 // XXX NOTE: turn this back on? 138 if (0 && psf->FluxScale) { 139 // the source peak pixel is guaranteed to be on the image, and only minimally different from the source center 140 double fluxScale = pmTrend2DEval (psf->FluxScale, (float)source->peak->x, (float)source->peak->y); 141 psAssert (isfinite(fluxScale), "how can the flux scale be invalid? source at %d, %d\n", source->peak->x, source->peak->y); 142 psAssert (fluxScale > 0.0, "how can the flux scale be negative? source at %d, %d\n", source->peak->x, source->peak->y); 143 source->psfFlux = fluxScale * source->modelPSF->params->data.F32[PM_PAR_I0]; 144 source->psfFluxErr = fluxScale * source->modelPSF->dparams->data.F32[PM_PAR_I0]; 145 source->psfMag = -2.5*log10(source->psfFlux); 146 } else { 147 status = pmSourcePhotometryModel (&source->psfMag, &source->psfFlux, source->modelPSF); 148 source->psfFluxErr = source->psfFlux * (source->modelPSF->dparams->data.F32[PM_PAR_I0] / source->modelPSF->params->data.F32[PM_PAR_I0]); 149 } 135 status = pmSourcePhotometryModel (&source->psfMag, &source->psfFlux, modelPSF); 136 source->psfFluxErr = source->psfFlux * source->psfMagErr; 137 138 # if (0) 139 // XXX NOTE: old code to use the flux scale. test & turn this back on? if so, need to save with psf model 140 // the source peak pixel is guaranteed to be on the image, and only minimally different from the source center 141 double fluxScale = pmTrend2DEval (psf->FluxScale, (float)source->peak->x, (float)source->peak->y); 142 psAssert (isfinite(fluxScale), "how can the flux scale be invalid? source at %d, %d\n", source->peak->x, source->peak->y); 143 psAssert (fluxScale > 0.0, "how can the flux scale be negative? source at %d, %d\n", source->peak->x, source->peak->y); 144 source->psfFlux = fluxScale * modelPSF->params->data.F32[PM_PAR_I0]; 145 source->psfFluxErr = fluxScale * modelPSF->dparams->data.F32[PM_PAR_I0]; 146 source->psfMag = -2.5*log10(source->psfFlux); 147 # endif 150 148 151 149 if (mode == PM_SOURCE_PHOT_PSFONLY) { … … 153 151 } 154 152 153 // get the EXT model photometry (all EXT models) 155 154 // if we have a collection of model fits, check if one of them is a pointer to modelEXT 156 155 if (source->modelFits) { … … 173 172 } 174 173 175 // for PSFs, correct both apMag and psfMag to same system, consistent with infinite flux star in aperture RADIUS 176 // XXX add a flag for "ap_mag is corrected?" 177 if ((mode & PM_SOURCE_PHOT_APCORR) && isPSF && psf && psf->ApTrend) { 174 // Correct psfMag to match aperture magnitude system (NOTE : Growth curve is already applied to ApTrend) 175 if ((mode & PM_SOURCE_PHOT_APCORR) && psf && psf->ApTrend) { 178 176 // the source peak pixel is guaranteed to be on the image, and only minimally different from the source center 179 177 double apTrend = pmTrend2DEval (psf->ApTrend, (float)source->peak->x, (float)source->peak->y); 180 178 source->psfMag += apTrend; 181 } 182 183 // measure the contribution of included pixels 179 source->psfFlux *= pow(10.0, -0.4*apTrend); 180 source->psfFluxErr *= pow(10.0, -0.4*apTrend); 181 } 182 183 // measure the contribution of included pixels to the PSF model fit 184 184 if (mode & PM_SOURCE_PHOT_WEIGHT) { 185 pmSourcePixelWeight (source, model , source->maskObj, maskVal, radius);185 pmSourcePixelWeight (source, modelPSF, source->maskObj, maskVal, radius); 186 186 } 187 187 … … 217 217 y += dy; 218 218 219 if (!psImageShiftMask(&flux, &mask, source->pixels, source->maskObj, maskVal, dx, dy, 220 NAN, 0xff, PS_INTERPOLATE_BIQUADRATIC)) { 219 // if (!psImageShiftMask(&flux, &mask, source->pixels, source->maskObj, maskVal, dx, dy, NAN, 0xff, PS_INTERPOLATE_LANCZOS2)) { 220 // if (!psImageShiftMask(&flux, &mask, source->pixels, source->maskObj, maskVal, dx, dy, NAN, 0xff, PS_INTERPOLATE_BIQUADRATIC)) { 221 if (!psImageShiftMask(&flux, &mask, source->pixels, source->maskObj, maskVal, dx, dy, NAN, 0xff, PS_INTERPOLATE_BILINEAR)) { 221 222 // Not much we can do about it 222 223 psErrorClear(); … … 232 233 233 234 // measure object aperture photometry 234 status = pmSourcePhotometryAperSource (source, model , flux, variance, mask, maskVal);235 status = pmSourcePhotometryAperSource (source, modelPSF, flux, variance, mask, maskVal); 235 236 if (!status) { 236 237 psTrace ("psModules.objects", 3, "fail mag : bad Ap Mag"); … … 241 242 // detection limits (esp near bright neighbors) 242 243 source->apMag = source->apMagRaw; 243 if (isfinite (source->apMag) && isPSF &&psf) {244 if (isfinite (source->apMag) && psf) { 244 245 if (psf->growth && (mode & PM_SOURCE_PHOT_GROWTH)) { 245 source->apMag = source->apMagRaw + pmGrowthCurveCorrect (psf->growth, source->apRadius); 246 // XXX correct the apFlux? 247 } 248 if (mode & PM_SOURCE_PHOT_APCORR) { 249 // XXX this should be removed -- we no longer fit for the 'sky bias' 250 // XXX is this happening??? 251 rflux = pow (10.0, 0.4*source->psfMag); 252 psAssert (psf->skyBias == 0.0, "sky bias not 0"); 253 psAssert (psf->skySat == 0.0, "sky sat not 0"); 254 source->apMag -= PS_SQR(source->apRadius)*rflux * psf->skyBias + psf->skySat / rflux; 246 float apOffset = pmGrowthCurveCorrect (psf->growth, source->apRadius); 247 source->apMag = source->apMagRaw + apOffset; 248 source->apFlux *= pow(10.0, -0.4*apOffset); 249 source->apFluxErr *= pow(10.0, -0.4*apOffset); 255 250 } 256 251 } … … 309 304 310 305 bool status; 311 status = pmSourcePhotometryAper(&source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal); 312 306 int nPix = 0; 307 status = pmSourcePhotometryAper(&nPix, &source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal); 308 if (status) { 309 source->mode |= PM_SOURCE_MODE_AP_MAGS; 310 } 313 311 return status; 314 312 } 315 313 316 314 // return source aperture magnitude 317 bool pmSourcePhotometryAper ( float *apMag, float *apFluxOut, float *apFluxErr, pmModel *model, psImage *image, psImage *variance, psImage *mask, psImageMaskType maskVal)315 bool pmSourcePhotometryAper (int *nPixOut, float *apMag, float *apFluxOut, float *apFluxErr, pmModel *model, psImage *image, psImage *variance, psImage *mask, psImageMaskType maskVal) 318 316 { 319 317 PS_ASSERT_PTR_NON_NULL(apMag, false); … … 328 326 float apFlux = 0; 329 327 float apFluxVar = 0; 328 int nPix = 0; 330 329 331 330 if (DO_SKY) { … … 345 344 apFlux += imData[iy][ix] - sky; 346 345 apFluxVar += varData[iy][ix]; 347 } 348 } 346 nPix ++; 347 } 348 } 349 349 350 if (apFluxOut) *apFluxOut = apFlux; 350 351 if (apFluxErr) *apFluxErr = sqrt(fabs(apFluxVar)); 352 if (nPixOut) *nPixOut = nPix; 351 353 352 354 if (apFlux <= 0) { … … 412 414 psImageMaskType maskBad = maskVal; 413 415 maskBad &= ~maskSuspect; 416 417 psImageMaskType maskPoor = maskVal | maskSuspect; 414 418 415 419 // measure modelSum and validSum. this function is applied to a sources' subimage. the … … 446 450 447 451 // count pixels which are masked with an mask bit (bad or poor) 448 if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & mask Val)) {452 if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskPoor)) { 449 453 notPoorSum += value; 450 454 } … … 487 491 488 492 if (isfinite(source->pixWeightNotBad) && isfinite(source->pixWeightNotPoor)) { 489 psAssert (source->pixWeightNot Bad <= source->pixWeightNotPoor, "error: all bad pixels should also be poor");493 psAssert (source->pixWeightNotPoor <= source->pixWeightNotBad, "error: all bad pixels should also be poor"); 490 494 } 491 495 -
trunk/psModules/src/objects/pmSourcePhotometry.h
r31153 r31451 45 45 46 46 bool pmSourcePhotometryAper( 47 int *nPixOut, 47 48 float *apMag, 48 49 float *apFluxOut, -
trunk/psModules/src/objects/pmSourceUtils.h
r14652 r31451 38 38 39 39 /// @} 40 # endif /* PM_ MODEL_CLASS_H */40 # endif /* PM_SOURCE_UTILS_H */ -
trunk/psModules/src/psmodules.h
r30623 r31451 148 148 #include <pmModelUtils.h> 149 149 #include <pmSourcePhotometry.h> 150 #include <pmGrowthCurveGenerate.h> 150 151 #include <pmSourceVisual.h> 151 152 #include <pmSourceMatch.h> -
trunk/psModules/test/objects/tap_pmSource.c
r31153 r31451 91 91 ok(isnan(src->psfMag), "pmSourceAlloc() pmSource->psfMag correctly"); 92 92 ok(isnan(src->extMag), "pmSourceAlloc() pmSource->extMag correctly"); 93 ok(isnan(src-> errMag), "pmSourceAlloc() pmSource->errMagcorrectly");93 ok(isnan(src->psfMagErr), "pmSourceAlloc() pmSource->psfMagErr correctly"); 94 94 ok(isnan(src->apMag), "pmSourceAlloc() pmSource->apMag correctly"); 95 95 ok(isnan(src->sky), "pmSourceAlloc() pmSource->sky correctly"); -
trunk/psModules/test/objects/tap_pmSourceIO_PS1_DEV_0.c
r21223 r31451 167 167 model->dparams->data.F32[PM_PAR_YPOS] = TEST_BASE_Y_ERR + (float) i; 168 168 src->psfMag = TEST_BASE_PSF_MAG + (float) i; 169 src-> errMag= TEST_BASE_ERR_MAG + (float) i;169 src->psfMagErr = TEST_BASE_ERR_MAG + (float) i; 170 170 src->peak->flux = TEST_BASE_PEAK_FLUX + (float) i; 171 171 src->sky = TEST_BASE_SKY + (float) i; … … 215 215 ok(src->psfMag == (TEST_BASE_PSF_MAG + (float) i), "pmSourcesRead_PS1_DEV_0() set src->psfMag correctly (is %.2f, should be %.2f)", 216 216 src->psfMag, (TEST_BASE_PSF_MAG + (float) i)); 217 ok(src-> errMag == (TEST_BASE_ERR_MAG + (float) i), "pmSourcesRead_PS1_DEV_0() set src->errMagcorrectly (is %.2f, should be %.2f)",218 src-> errMag, (TEST_BASE_ERR_MAG + (float) i));217 ok(src->psfMagErr == (TEST_BASE_ERR_MAG + (float) i), "pmSourcesRead_PS1_DEV_0() set src->psfMagErr correctly (is %.2f, should be %.2f)", 218 src->psfMagErr, (TEST_BASE_ERR_MAG + (float) i)); 219 219 220 220 // XXX: Source code always sets src->modelPSF. Is that right? -
trunk/psModules/test/objects/tap_pmSourceIO_PS1_DEV_1.c
r24852 r31451 196 196 model->dparams->data.F32[PM_PAR_YPOS] = TEST_BASE_Y_ERR + (float) i; 197 197 src->psfMag = TEST_BASE_PSF_MAG + (float) i; 198 src-> errMag= TEST_BASE_ERR_MAG + (float) i;198 src->psfMagErr = TEST_BASE_ERR_MAG + (float) i; 199 199 src->peak->flux = TEST_BASE_PEAK_FLUX + (float) i; 200 200 src->sky = TEST_BASE_SKY + (float) i; … … 203 203 sources->data[i] = (psPtr *) src; 204 204 src->psfMag = TEST_BASE_PSF_MAG + (float) i; 205 src-> errMag= TEST_BASE_ERR_MAG + (float) i;205 src->psfMagErr = TEST_BASE_ERR_MAG + (float) i; 206 206 src->sky = TEST_BASE_SKY + (float) i; 207 207 src->skyErr = TEST_BASE_SKY_ERR + (float) i; … … 280 280 ok(src->psfMag == (TEST_BASE_PSF_MAG + (float) i), "pmSourcesRead_PS1_DEV_1() set src->psfMag correctly (is %.2f, should be %.2f)", 281 281 src->psfMag, (TEST_BASE_PSF_MAG + (float) i)); 282 ok(src-> errMag == (TEST_BASE_ERR_MAG + (float) i), "pmSourcesRead_PS1_DEV_1() set src->errMagcorrectly (is %.2f, should be %.2f)",283 src-> errMag, (TEST_BASE_ERR_MAG + (float) i));282 ok(src->psfMagErr == (TEST_BASE_ERR_MAG + (float) i), "pmSourcesRead_PS1_DEV_1() set src->psfMagErr correctly (is %.2f, should be %.2f)", 283 src->psfMagErr, (TEST_BASE_ERR_MAG + (float) i)); 284 284 285 285 // XXX: Source code always sets src->modelPSF. Is that right? -
trunk/psModules/test/objects/tap_pmSourceIO_SMPDATA.c
r21223 r31451 167 167 model->dparams->data.F32[PM_PAR_YPOS] = TEST_BASE_Y_ERR + (float) i; 168 168 src->psfMag = TEST_BASE_PSF_MAG + (float) i; 169 src-> errMag= TEST_BASE_ERR_MAG + (float) i;169 src->psfMagErr = TEST_BASE_ERR_MAG + (float) i; 170 170 src->peak->flux = TEST_BASE_PEAK_FLUX + (float) i; 171 171 src->sky = TEST_BASE_SKY + (float) i; … … 226 226 src->psfMag, (TEST_BASE_PSF_MAG + (float) i)); 227 227 float tmpF = 0.001 * PS_MIN(999, (1000 * (TEST_BASE_ERR_MAG + (float) i))); 228 ok(src-> errMag == tmpF, "pmSourcesRead_SMPDATA() set src->errMagcorrectly (is %.2f, should be %.2f)",229 src-> errMag, tmpF);228 ok(src->psfMagErr == tmpF, "pmSourcesRead_SMPDATA() set src->psfMagErr correctly (is %.2f, should be %.2f)", 229 src->psfMagErr, tmpF); 230 230 tmpF = PS_MIN(99.0, (TEST_BASE_EXT_MAG + ZERO_POINT)) - ZERO_POINT; 231 231 ok(src->extMag == tmpF, "pmSourcesRead_SMPDATA() set src->extMag correctly (is %.2f, should be %.2f)", -
trunk/psModules/test/objects/tap_pmSourcePhotometry.c
r25754 r31451 103 103 ok_float_tol(source->psfMag, fitMag, 0.0002, "source fitMag is %f", source->psfMag); 104 104 ok_float_tol(source->apMag, apMag, 0.0002, "source apMag is %f", source->apMag); 105 ok_float(source-> errMag, 0.001, "source errMag is %f", source->errMag);105 ok_float(source->psfMagErr, 0.001, "source psfMagErr is %f", source->psfMagErr); 106 106 float refMag = source->apMag; 107 107
Note:
See TracChangeset
for help on using the changeset viewer.
