Changeset 28643
- Timestamp:
- Jul 9, 2010, 10:56:32 AM (16 years ago)
- Location:
- branches/eam_branches/ipp-20100621
- Files:
-
- 6 added
- 1 deleted
- 99 edited
-
psModules/src/camera/pmFPAfileIO.c (modified) (1 diff)
-
psModules/src/camera/pmReadoutFake.c (modified) (1 diff)
-
psModules/src/camera/pmReadoutFake.h (modified) (1 diff)
-
psModules/src/config/pmConfig.c (modified) (1 diff)
-
psModules/src/detrend/pmMaskStats.c (modified) (2 diffs)
-
psModules/src/extras/pmVisual.c (modified) (3 diffs)
-
psModules/src/imcombine/pmPSFEnvelope.c (modified) (2 diffs)
-
psModules/src/imcombine/pmSubtractionStamps.c (modified) (1 diff)
-
psModules/src/objects/Makefile.am (modified) (4 diffs)
-
psModules/src/objects/models/pmModel_DEV.c (added)
-
psModules/src/objects/models/pmModel_DEV.h (added)
-
psModules/src/objects/models/pmModel_EXP.c (added)
-
psModules/src/objects/models/pmModel_EXP.h (added)
-
psModules/src/objects/models/pmModel_GAUSS.c (modified) (5 diffs)
-
psModules/src/objects/models/pmModel_PGAUSS.c (modified) (3 diffs)
-
psModules/src/objects/models/pmModel_PS1_V1.c (modified) (4 diffs)
-
psModules/src/objects/models/pmModel_QGAUSS.c (modified) (3 diffs)
-
psModules/src/objects/models/pmModel_RGAUSS.c (modified) (4 diffs)
-
psModules/src/objects/models/pmModel_SERSIC.c (modified) (11 diffs)
-
psModules/src/objects/pmDetEff.c (modified) (1 diff)
-
psModules/src/objects/pmDetEff.h (modified) (1 diff)
-
psModules/src/objects/pmFootprint.c (modified) (1 diff)
-
psModules/src/objects/pmFootprint.h (modified) (1 diff)
-
psModules/src/objects/pmFootprintArrayGrow.c (modified) (1 diff)
-
psModules/src/objects/pmFootprintArraysMerge.c (modified) (1 diff)
-
psModules/src/objects/pmFootprintAssignPeaks.c (modified) (1 diff)
-
psModules/src/objects/pmFootprintCullPeaks.c (modified) (1 diff)
-
psModules/src/objects/pmFootprintFind.c (modified) (1 diff)
-
psModules/src/objects/pmFootprintFindAtPoint.c (modified) (1 diff)
-
psModules/src/objects/pmFootprintIDs.c (modified) (1 diff)
-
psModules/src/objects/pmFootprintSpans.c (modified) (1 diff)
-
psModules/src/objects/pmFootprintSpans.h (modified) (1 diff)
-
psModules/src/objects/pmGrowthCurve.c (modified) (1 diff)
-
psModules/src/objects/pmGrowthCurveGenerate.c (modified) (1 diff)
-
psModules/src/objects/pmModel.c (modified) (1 diff)
-
psModules/src/objects/pmModel.h (modified) (3 diffs)
-
psModules/src/objects/pmModelClass.c (modified) (3 diffs)
-
psModules/src/objects/pmModelClass.h (modified) (1 diff)
-
psModules/src/objects/pmModelFuncs.h (added)
-
psModules/src/objects/pmModelUtils.c (modified) (1 diff)
-
psModules/src/objects/pmMoments.c (modified) (1 diff)
-
psModules/src/objects/pmMoments.h (modified) (2 diffs)
-
psModules/src/objects/pmPSF.c (modified) (3 diffs)
-
psModules/src/objects/pmPSF.h (modified) (4 diffs)
-
psModules/src/objects/pmPSF_IO.c (modified) (1 diff)
-
psModules/src/objects/pmPSFtry.c (modified) (1 diff)
-
psModules/src/objects/pmPSFtryFitEXT.c (modified) (3 diffs)
-
psModules/src/objects/pmPSFtryFitPSF.c (modified) (3 diffs)
-
psModules/src/objects/pmPSFtryMakePSF.c (modified) (1 diff)
-
psModules/src/objects/pmPSFtryMetric.c (modified) (1 diff)
-
psModules/src/objects/pmPSFtryModel.c (modified) (2 diffs)
-
psModules/src/objects/pmPeaks.c (modified) (1 diff)
-
psModules/src/objects/pmPeaks.h (modified) (1 diff)
-
psModules/src/objects/pmPhotObj.c (modified) (1 diff)
-
psModules/src/objects/pmPhotObj.h (modified) (1 diff)
-
psModules/src/objects/pmSource.c (modified) (3 diffs)
-
psModules/src/objects/pmSource.h (modified) (1 diff)
-
psModules/src/objects/pmSourceContour.c (modified) (1 diff)
-
psModules/src/objects/pmSourceFitModel.c (modified) (4 diffs)
-
psModules/src/objects/pmSourceFitModel.h (modified) (2 diffs)
-
psModules/src/objects/pmSourceFitSet.c (modified) (5 diffs)
-
psModules/src/objects/pmSourceFitSet.h (modified) (1 diff)
-
psModules/src/objects/pmSourceGroup.h (deleted)
-
psModules/src/objects/pmSourceGroups.c (modified) (1 diff)
-
psModules/src/objects/pmSourceGroups.h (modified) (1 diff)
-
psModules/src/objects/pmSourceIO.c (modified) (4 diffs)
-
psModules/src/objects/pmSourceIO.h (modified) (1 diff)
-
psModules/src/objects/pmSourceIO_CMF_PS1_DV1.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_CMF_PS1_SV1.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_CMF_PS1_V1.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_CMF_PS1_V2.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_CMF_PS1_V3.c (added)
-
psModules/src/objects/pmSourceIO_CMP.c (modified) (1 diff)
-
psModules/src/objects/pmSourceIO_MatchedRefs.c (modified) (1 diff)
-
psModules/src/objects/pmSourceIO_OBJ.c (modified) (1 diff)
-
psModules/src/objects/pmSourceIO_PS1_CAL_0.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO_PS1_DEV_0.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_PS1_DEV_1.c (modified) (4 diffs)
-
psModules/src/objects/pmSourceIO_RAW.c (modified) (1 diff)
-
psModules/src/objects/pmSourceIO_SMPDATA.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceIO_SX.c (modified) (1 diff)
-
psModules/src/objects/pmSourceMatch.c (modified) (1 diff)
-
psModules/src/objects/pmSourceMatch.h (modified) (1 diff)
-
psModules/src/objects/pmSourceMoments.c (modified) (10 diffs)
-
psModules/src/objects/pmSourcePhotometry.c (modified) (3 diffs)
-
psModules/src/objects/pmSourcePlotApResid.c (modified) (1 diff)
-
psModules/src/objects/pmSourcePlotMoments.c (modified) (1 diff)
-
psModules/src/objects/pmSourcePlotPSFModel.c (modified) (1 diff)
-
psModules/src/objects/pmSourceSky.c (modified) (1 diff)
-
psModules/src/objects/pmSourceUtils.c (modified) (1 diff)
-
psModules/src/objects/pmSourceVisual.c (modified) (1 diff)
-
psModules/src/objects/pmSpan.h (modified) (1 diff)
-
psModules/src/objects/pmTrend2D.h (modified) (1 diff)
-
psModules/src/psmodules.h (modified) (2 diffs)
-
psphot/src/psphot.h (modified) (2 diffs)
-
psphot/src/psphotBlendFit.c (modified) (12 diffs)
-
psphot/src/psphotChoosePSF.c (modified) (2 diffs)
-
psphot/src/psphotExtendedSourceFits.c (modified) (3 diffs)
-
psphot/src/psphotFindDetections.c (modified) (1 diff)
-
psphot/src/psphotFitSet.c (modified) (1 diff)
-
psphot/src/psphotReadout.c (modified) (1 diff)
-
psphot/src/psphotSetThreads.c (modified) (1 diff)
-
psphot/src/psphotSourceFits.c (modified) (14 diffs)
-
psphot/src/psphotSourceSize.c (modified) (3 diffs)
-
psphot/src/psphotSourceStats.c (modified) (3 diffs)
-
psphot/src/psphotVisual.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100621/psModules/src/camera/pmFPAfileIO.c
r28340 r28643 24 24 #include "pmFPAfileFitsIO.h" 25 25 #include "pmFPAfileFringeIO.h" 26 27 #include "pmTrend2D.h" 28 #include "pmResiduals.h" 29 #include "pmGrowthCurve.h" 26 30 #include "pmSpan.h" 31 #include "pmFootprintSpans.h" 27 32 #include "pmFootprint.h" 28 33 #include "pmPeaks.h" 29 34 #include "pmMoments.h" 30 #include "pmResiduals.h" 31 #include "pmGrowthCurve.h" 32 #include "pmTrend2D.h" 35 #include "pmModelFuncs.h" 36 #include "pmModel.h" 37 #include "pmSourceMasks.h" 38 #include "pmSourceExtendedPars.h" 39 #include "pmSourceDiffStats.h" 40 #include "pmSource.h" 41 #include "pmSourceFitModel.h" 33 42 #include "pmPSF.h" 34 #include "pm Model.h"35 #include "pmSource.h" 43 #include "pmPSFtry.h" 44 36 45 #include "pmSourceIO.h" 37 #include "pmResiduals.h"38 46 #include "pmPSF_IO.h" 47 39 48 #include "pmAstrometryModel.h" 40 49 #include "pmAstrometryRefstars.h" -
branches/eam_branches/ipp-20100621/psModules/src/camera/pmReadoutFake.c
r28405 r28643 10 10 #include "pmFPA.h" 11 11 12 #include "pmMoments.h" 12 13 #include "pmTrend2D.h" 13 14 #include "pmResiduals.h" 14 15 #include "pmGrowthCurve.h" 15 #include "pmTrend2D.h"16 #include "pmPSF.h"17 #include "pmModel.h"18 #include "pmModelClass.h"19 16 #include "pmSpan.h" 17 #include "pmFootprintSpans.h" 20 18 #include "pmFootprint.h" 21 19 #include "pmPeaks.h" 20 #include "pmMoments.h" 21 #include "pmModelFuncs.h" 22 #include "pmModel.h" 23 #include "pmModelUtils.h" 24 #include "pmModelClass.h" 25 #include "pmSourceMasks.h" 26 #include "pmSourceExtendedPars.h" 27 #include "pmSourceDiffStats.h" 22 28 #include "pmSource.h" 23 #include "pmSourceUtils.h" 24 #include "pmModelUtils.h" 29 #include "pmSourceFitModel.h" 30 #include "pmPSF.h" 31 #include "pmPSFtry.h" 32 25 33 #include "pmSourceGroups.h" 26 27 34 #include "pmReadoutFake.h" 28 35 -
branches/eam_branches/ipp-20100621/psModules/src/camera/pmReadoutFake.h
r26450 r28643 2 2 #define PM_READOUT_FAKE_H 3 3 4 #include <pslib.h>5 #include <pmHDU.h>6 #include <pmFPA.h>7 8 #include <pmMoments.h>9 #include <pmResiduals.h>10 #include <pmGrowthCurve.h>11 #include <pmTrend2D.h>12 #include <pmPSF.h>13 #include <pmSourceMasks.h>4 // #include <pslib.h> 5 // #include <pmHDU.h> 6 // #include <pmFPA.h> 7 // 8 // #include <pmMoments.h> 9 // #include <pmResiduals.h> 10 // #include <pmGrowthCurve.h> 11 // #include <pmTrend2D.h> 12 // #include <pmPSF.h> 13 // #include <pmSourceMasks.h> 14 14 15 15 /// Set threading -
branches/eam_branches/ipp-20100621/psModules/src/config/pmConfig.c
r28435 r28643 655 655 if ((argNum = psArgumentGet(*argc, argv, "-visual-all"))) { 656 656 pmVisualSetLevel(".", 10); 657 psArgumentRemove(argNum, argc, argv); 657 658 } 658 659 if ((argNum = psArgumentGet(*argc, argv, "-visual-levels"))) { 659 660 pmVisualPrintLevels(stdout); 661 psArgumentRemove(argNum, argc, argv); 660 662 } 661 663 -
branches/eam_branches/ipp-20100621/psModules/src/detrend/pmMaskStats.c
r28100 r28643 7 7 8 8 #include <pslib.h> 9 #include <psmodules.h>10 9 11 10 #include "pmHDU.h" … … 16 15 #include "pmFPAAstrometry.h" 17 16 17 #include "pmMaskStats.h" 18 18 19 19 #define ESCAPE { \ -
branches/eam_branches/ipp-20100621/psModules/src/extras/pmVisual.c
r28129 r28643 21 21 #include "pmAstrometryObjects.h" 22 22 #include "pmSubtractionStamps.h" 23 23 24 #include "pmTrend2D.h" 25 #include "pmResiduals.h" 26 #include "pmGrowthCurve.h" 27 #include "pmSpan.h" 28 #include "pmFootprintSpans.h" 29 #include "pmFootprint.h" 30 #include "pmPeaks.h" 31 #include "pmMoments.h" 32 #include "pmModelFuncs.h" 33 #include "pmModel.h" 34 #include "pmSourceMasks.h" 35 #include "pmSourceExtendedPars.h" 36 #include "pmSourceDiffStats.h" 37 #include "pmSource.h" 38 #include "pmSourceFitModel.h" 24 39 #include "pmPSF.h" 25 40 #include "pmPSFtry.h" 26 #include "pmSource.h" 41 27 42 #include "pmFPAExtent.h" 28 29 # if (HAVE_KAPA)30 # include <kapa.h>31 # include "pmVisual.h"32 # include "pmKapaPlots.h"33 # define KAPAX 70034 # define KAPAY 70035 43 36 44 #include "pmAstrometryVisual.h" … … 38 46 #include "pmStackVisual.h" 39 47 #include "pmSourceVisual.h" 48 49 # if (HAVE_KAPA) 50 # include <kapa.h> 51 #include "pmVisual.h" 52 #include "pmKapaPlots.h" 53 54 # define KAPAX 700 55 # define KAPAY 700 40 56 41 57 //#define TESTING … … 102 118 103 119 /* Wait up to 1.0 second for a response, then continue */ 104 timeout.tv_sec = 2;120 timeout.tv_sec = 10; 105 121 timeout.tv_usec = 0; 106 122 -
branches/eam_branches/ipp-20100621/psModules/src/imcombine/pmPSFEnvelope.c
r28332 r28643 10 10 #include "pmHDU.h" 11 11 #include "pmFPA.h" 12 #include "pmReadoutFake.h" 13 14 #include "pmMoments.h" 12 13 #include "pmTrend2D.h" 15 14 #include "pmResiduals.h" 16 15 #include "pmGrowthCurve.h" 17 #include "pmTrend2D.h"18 #include "pmPSF.h"19 #include "pmModel.h"20 #include "pmModelClass.h"21 #include "pmModelUtils.h"22 16 #include "pmSpan.h" 17 #include "pmFootprintSpans.h" 23 18 #include "pmFootprint.h" 24 19 #include "pmPeaks.h" 20 #include "pmMoments.h" 21 #include "pmModelFuncs.h" 22 #include "pmModel.h" 23 #include "pmModelUtils.h" 24 #include "pmModelClass.h" 25 #include "pmSourceMasks.h" 26 #include "pmSourceExtendedPars.h" 27 #include "pmSourceDiffStats.h" 25 28 #include "pmSource.h" 26 #include "pmSourceUtils.h"27 29 #include "pmSourceFitModel.h" 30 #include "pmPSF.h" 28 31 #include "pmPSFtry.h" 29 32 30 33 #include "pmReadoutFake.h" 31 34 #include "pmPSFEnvelope.h" 32 35 #include "pmStackVisual.h" … … 410 413 options->chiFluxTrend = false; // All sources have similar flux, so fitting a trend often fails 411 414 412 pmSourceFitModelInit(SOURCE_FIT_ITERATIONS, 0.01, VARIANCE_VAL, true); 415 // options which modify the behavior of the model fitting 416 options->fitOptions = pmSourceFitOptionsAlloc(); 417 options->fitOptions->nIter = SOURCE_FIT_ITERATIONS; 418 options->fitOptions->tol = 0.01; 419 options->fitOptions->poissonErrors = true; 420 options->fitOptions->weight = VARIANCE_VAL; 421 options->fitOptions->mode = PM_SOURCE_FIT_PSF; 422 413 423 pmModelClassSetLimits(PM_MODEL_LIMITS_STRICT); // Important for getting a good stack target PSF 414 424 -
branches/eam_branches/ipp-20100621/psModules/src/imcombine/pmSubtractionStamps.c
r27402 r28643 7 7 #include <pslib.h> 8 8 9 #include "pmErrorCodes.h" 10 #include "pmHDU.h" 11 #include "pmFPA.h" 12 9 13 // All these includes required to get stamps out of an array of pmSources 10 #include "pmMoments.h" 14 #include "pmTrend2D.h" 15 #include "pmResiduals.h" 16 #include "pmGrowthCurve.h" 11 17 #include "pmSpan.h" 18 #include "pmFootprintSpans.h" 12 19 #include "pmFootprint.h" 13 20 #include "pmPeaks.h" 14 #include "pmResiduals.h" 15 #include "pmHDU.h" 16 #include "pmFPA.h" 17 #include "pmGrowthCurve.h" 18 #include "pmTrend2D.h" 19 #include "pmPSF.h" 21 #include "pmMoments.h" 22 #include "pmModelFuncs.h" 20 23 #include "pmModel.h" 24 #include "pmSourceMasks.h" 25 #include "pmSourceExtendedPars.h" 26 #include "pmSourceDiffStats.h" 21 27 #include "pmSource.h" 22 #include "pmErrorCodes.h"23 28 24 29 #include "pmSubtraction.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/Makefile.am
r28013 r28643 43 43 pmSourceIO_CMF_PS1_V1.c \ 44 44 pmSourceIO_CMF_PS1_V2.c \ 45 pmSourceIO_CMF_PS1_V3.c \ 45 46 pmSourceIO_CMF_PS1_SV1.c \ 46 47 pmSourceIO_CMF_PS1_DV1.c \ … … 71 72 models/pmModel_QGAUSS.c \ 72 73 models/pmModel_RGAUSS.c \ 73 models/pmModel_SERSIC.c 74 models/pmModel_SERSIC.c \ 75 models/pmModel_EXP.c \ 76 models/pmModel_DEV.c 74 77 75 78 pkginclude_HEADERS = \ … … 80 83 pmPeaks.h \ 81 84 pmMoments.h \ 85 pmModelFuncs.h \ 82 86 pmModel.h \ 83 87 pmModelClass.h \ … … 111 115 models/pmModel_QGAUSS.h \ 112 116 models/pmModel_RGAUSS.h \ 113 models/pmModel_SERSIC.h 117 models/pmModel_SERSIC.h \ 118 models/pmModel_EXP.h \ 119 models/pmModel_DEV.h 114 120 115 121 CLEANFILES = *~ -
branches/eam_branches/ipp-20100621/psModules/src/objects/models/pmModel_GAUSS.c
r26916 r28643 21 21 #include <stdio.h> 22 22 #include <pslib.h> 23 23 #include "pmHDU.h" 24 #include "pmFPA.h" 25 26 #include "pmTrend2D.h" 27 #include "pmResiduals.h" 28 #include "pmGrowthCurve.h" 29 #include "pmSpan.h" 30 #include "pmFootprintSpans.h" 31 #include "pmFootprint.h" 32 #include "pmPeaks.h" 24 33 #include "pmMoments.h" 25 #include "pmPeaks.h" 34 #include "pmModelFuncs.h" 35 #include "pmModel.h" 36 #include "pmModelUtils.h" 37 #include "pmModelClass.h" 38 #include "pmSourceMasks.h" 39 #include "pmSourceExtendedPars.h" 40 #include "pmSourceDiffStats.h" 26 41 #include "pmSource.h" 27 #include "pmModel.h" 42 #include "pmSourceFitModel.h" 43 #include "pmPSF.h" 44 #include "pmPSFtry.h" 45 #include "pmDetections.h" 46 28 47 #include "pmModel_GAUSS.h" 29 48 49 # define PM_MODEL_NPARAM 7 30 50 # define PM_MODEL_FUNC pmModelFunc_GAUSS 31 51 # define PM_MODEL_FLUX pmModelFlux_GAUSS … … 83 103 dPAR[PM_PAR_XPOS] = q*(2*px/PAR[PM_PAR_SXX] + Y*PAR[PM_PAR_SXY]); 84 104 dPAR[PM_PAR_YPOS] = q*(2*py/PAR[PM_PAR_SYY] + X*PAR[PM_PAR_SXY]); 105 85 106 // the extra factor of 2 below is needed to avoid excessive swings 86 107 dPAR[PM_PAR_SXX] = +4.0*q*px*px/PAR[PM_PAR_SXX]; … … 102 123 return true; 103 124 } 104 psAssert(nParam >= 0 && nParam < = PM_PAR_7, "Parameter index is out of bounds");125 psAssert(nParam >= 0 && nParam < PM_MODEL_NPARAM, "Parameter index is out of bounds"); 105 126 106 127 // we need to calculate the limits for SXY specially … … 347 368 // this test is invalid if the parameters are derived 348 369 // from the PSF model 370 // XXX how is this used? it prevents forced photometry from ever being 'successful' 349 371 bool PM_MODEL_FIT_STATUS (pmModel *model) 350 372 { … … 394 416 return; 395 417 } 396 397 # undef PM_MODEL_FUNC398 # undef PM_MODEL_FLUX399 # undef PM_MODEL_GUESS400 # undef PM_MODEL_LIMITS401 # undef PM_MODEL_RADIUS402 # undef PM_MODEL_FROM_PSF403 # undef PM_MODEL_PARAMS_FROM_PSF404 # undef PM_MODEL_FIT_STATUS405 # undef PM_MODEL_SET_LIMITS -
branches/eam_branches/ipp-20100621/psModules/src/objects/models/pmModel_PGAUSS.c
r27565 r28643 21 21 #include <stdio.h> 22 22 #include <pslib.h> 23 23 #include "pmHDU.h" 24 #include "pmFPA.h" 25 26 #include "pmTrend2D.h" 27 #include "pmResiduals.h" 28 #include "pmGrowthCurve.h" 29 #include "pmSpan.h" 30 #include "pmFootprintSpans.h" 31 #include "pmFootprint.h" 32 #include "pmPeaks.h" 24 33 #include "pmMoments.h" 25 #include "pmPeaks.h" 34 #include "pmModelFuncs.h" 35 #include "pmModel.h" 36 #include "pmModelUtils.h" 37 #include "pmModelClass.h" 38 #include "pmSourceMasks.h" 39 #include "pmSourceExtendedPars.h" 40 #include "pmSourceDiffStats.h" 26 41 #include "pmSource.h" 27 #include "pmModel.h" 42 #include "pmSourceFitModel.h" 43 #include "pmPSF.h" 44 #include "pmPSFtry.h" 45 #include "pmDetections.h" 46 28 47 #include "pmModel_PGAUSS.h" 29 48 49 # define PM_MODEL_NPARAM 7 30 50 # define PM_MODEL_FUNC pmModelFunc_PGAUSS 31 51 # define PM_MODEL_FLUX pmModelFlux_PGAUSS … … 103 123 return true; 104 124 } 105 psAssert(nParam >= 0 && nParam < = PM_PAR_7, "Parameter index is out of bounds");125 psAssert(nParam >= 0 && nParam < PM_MODEL_NPARAM, "Parameter index is out of bounds"); 106 126 107 127 // we need to calculate the limits for SXY specially … … 448 468 return; 449 469 } 450 451 # undef PM_MODEL_FUNC452 # undef PM_MODEL_FLUX453 # undef PM_MODEL_GUESS454 # undef PM_MODEL_LIMITS455 # undef PM_MODEL_RADIUS456 # undef PM_MODEL_FROM_PSF457 # undef PM_MODEL_PARAMS_FROM_PSF458 # undef PM_MODEL_FIT_STATUS459 # undef PM_MODEL_SET_LIMITS -
branches/eam_branches/ipp-20100621/psModules/src/objects/models/pmModel_PS1_V1.c
r27565 r28643 22 22 #include <stdio.h> 23 23 #include <pslib.h> 24 24 #include "pmHDU.h" 25 #include "pmFPA.h" 26 27 #include "pmTrend2D.h" 28 #include "pmResiduals.h" 29 #include "pmGrowthCurve.h" 30 #include "pmSpan.h" 31 #include "pmFootprintSpans.h" 32 #include "pmFootprint.h" 33 #include "pmPeaks.h" 25 34 #include "pmMoments.h" 26 #include "pmPeaks.h" 35 #include "pmModelFuncs.h" 36 #include "pmModel.h" 37 #include "pmModelUtils.h" 38 #include "pmModelClass.h" 39 #include "pmSourceMasks.h" 40 #include "pmSourceExtendedPars.h" 41 #include "pmSourceDiffStats.h" 27 42 #include "pmSource.h" 28 #include "pmModel.h" 43 #include "pmSourceFitModel.h" 44 #include "pmPSF.h" 45 #include "pmPSFtry.h" 46 #include "pmDetections.h" 47 29 48 #include "pmModel_PS1_V1.h" 30 49 50 # define PM_MODEL_NPARAM 8 31 51 # define PM_MODEL_FUNC pmModelFunc_PS1_V1 32 52 # define PM_MODEL_FLUX pmModelFlux_PS1_V1 … … 122 142 return true; 123 143 } 124 psAssert(nParam >= 0 && nParam < = PM_PAR_7, "Parameter index is out of bounds");144 psAssert(nParam >= 0 && nParam < PM_MODEL_NPARAM, "Parameter index is out of bounds"); 125 145 126 146 // we need to calculate the limits for SXY specially … … 222 242 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy); 223 243 PAR[PM_PAR_SXY] = shape.sxy; 224 PAR[PM_PAR_7] = 1.0;244 PAR[PM_PAR_7] = 0.5; 225 245 226 246 return(true); … … 468 488 return; 469 489 } 470 471 # undef PM_MODEL_FUNC472 # undef PM_MODEL_FLUX473 # undef PM_MODEL_GUESS474 # undef PM_MODEL_LIMITS475 # undef PM_MODEL_RADIUS476 # undef PM_MODEL_FROM_PSF477 # undef PM_MODEL_PARAMS_FROM_PSF478 # undef PM_MODEL_FIT_STATUS479 # undef PM_MODEL_SET_LIMITS480 # undef ALPHA481 # undef ALPHA_M -
branches/eam_branches/ipp-20100621/psModules/src/objects/models/pmModel_QGAUSS.c
r27565 r28643 22 22 #include <stdio.h> 23 23 #include <pslib.h> 24 24 #include "pmHDU.h" 25 #include "pmFPA.h" 26 27 #include "pmTrend2D.h" 28 #include "pmResiduals.h" 29 #include "pmGrowthCurve.h" 30 #include "pmSpan.h" 31 #include "pmFootprintSpans.h" 32 #include "pmFootprint.h" 33 #include "pmPeaks.h" 25 34 #include "pmMoments.h" 26 #include "pmPeaks.h" 35 #include "pmModelFuncs.h" 36 #include "pmModel.h" 37 #include "pmModelUtils.h" 38 #include "pmModelClass.h" 39 #include "pmSourceMasks.h" 40 #include "pmSourceExtendedPars.h" 41 #include "pmSourceDiffStats.h" 27 42 #include "pmSource.h" 28 #include "pmModel.h" 43 #include "pmSourceFitModel.h" 44 #include "pmPSF.h" 45 #include "pmPSFtry.h" 46 #include "pmDetections.h" 47 29 48 #include "pmModel_QGAUSS.h" 30 49 50 # define PM_MODEL_NPARAM 8 31 51 # define PM_MODEL_FUNC pmModelFunc_QGAUSS 32 52 # define PM_MODEL_FLUX pmModelFlux_QGAUSS … … 123 143 return true; 124 144 } 125 psAssert(nParam >= 0 && nParam < = PM_PAR_7, "Parameter index is out of bounds");145 psAssert(nParam >= 0 && nParam < PM_MODEL_NPARAM, "Parameter index is out of bounds"); 126 146 127 147 // we need to calculate the limits for SXY specially … … 469 489 return; 470 490 } 471 472 # undef PM_MODEL_FUNC473 # undef PM_MODEL_FLUX474 # undef PM_MODEL_GUESS475 # undef PM_MODEL_LIMITS476 # undef PM_MODEL_RADIUS477 # undef PM_MODEL_FROM_PSF478 # undef PM_MODEL_PARAMS_FROM_PSF479 # undef PM_MODEL_FIT_STATUS480 # undef PM_MODEL_SET_LIMITS481 # undef ALPHA482 # undef ALPHA_M -
branches/eam_branches/ipp-20100621/psModules/src/objects/models/pmModel_RGAUSS.c
r27565 r28643 22 22 #include <stdio.h> 23 23 #include <pslib.h> 24 24 #include "pmHDU.h" 25 #include "pmFPA.h" 26 27 #include "pmTrend2D.h" 28 #include "pmResiduals.h" 29 #include "pmGrowthCurve.h" 30 #include "pmSpan.h" 31 #include "pmFootprintSpans.h" 32 #include "pmFootprint.h" 33 #include "pmPeaks.h" 25 34 #include "pmMoments.h" 26 #include "pmPeaks.h" 35 #include "pmModelFuncs.h" 36 #include "pmModel.h" 37 #include "pmModelUtils.h" 38 #include "pmModelClass.h" 39 #include "pmSourceMasks.h" 40 #include "pmSourceExtendedPars.h" 41 #include "pmSourceDiffStats.h" 27 42 #include "pmSource.h" 28 #include "pmModel.h" 43 #include "pmSourceFitModel.h" 44 #include "pmPSF.h" 45 #include "pmPSFtry.h" 46 #include "pmDetections.h" 47 29 48 #include "pmModel_RGAUSS.h" 30 49 50 # define PM_MODEL_NPARAM 8 31 51 # define PM_MODEL_FUNC pmModelFunc_RGAUSS 32 52 # define PM_MODEL_FLUX pmModelFlux_RGAUSS … … 112 132 return true; 113 133 } 114 psAssert(nParam >= 0 && nParam < = PM_PAR_7, "Parameter index is out of bounds");134 psAssert(nParam >= 0 && nParam < PM_MODEL_NPARAM, "Parameter index is out of bounds"); 115 135 116 136 // we need to calculate the limits for SXY specially … … 209 229 PAR[PM_PAR_XPOS] = peak->xf; 210 230 PAR[PM_PAR_YPOS] = peak->yf; 211 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx);212 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy);231 PAR[PM_PAR_SXX] = PS_MAX(0.5, shape.sx); 232 PAR[PM_PAR_SYY] = PS_MAX(0.5, shape.sy); 213 233 PAR[PM_PAR_SXY] = shape.sxy; 214 PAR[PM_PAR_7] = 2.25;234 PAR[PM_PAR_7] = 1.5; 215 235 216 236 return(true); … … 463 483 return; 464 484 } 465 466 # undef PM_MODEL_FUNC467 # undef PM_MODEL_FLUX468 # undef PM_MODEL_GUESS469 # undef PM_MODEL_LIMITS470 # undef PM_MODEL_RADIUS471 # undef PM_MODEL_FROM_PSF472 # undef PM_MODEL_PARAMS_FROM_PSF473 # undef PM_MODEL_FIT_STATUS474 # undef PM_MODEL_SET_LIMITS -
branches/eam_branches/ipp-20100621/psModules/src/objects/models/pmModel_SERSIC.c
r26916 r28643 18 18 * PM_PAR_7 7 - normalized sersic parameter 19 19 20 note that a standard sersic model uses exp(-K*(z^(1/ n) - 1). the additional elements (K,20 note that a standard sersic model uses exp(-K*(z^(1/2n) - 1). the additional elements (K, 21 21 the -1 offset) are absorbed in this model by the normalization, the exponent, and the 22 22 radial scale. We fit the elements in this form, then re-normalize them on output. … … 25 25 #include <stdio.h> 26 26 #include <pslib.h> 27 27 #include "pmHDU.h" 28 #include "pmFPA.h" 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 35 #include "pmFootprint.h" 36 #include "pmPeaks.h" 28 37 #include "pmMoments.h" 29 #include "pmPeaks.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 30 45 #include "pmSource.h" 31 #include "pmModel.h" 46 #include "pmSourceFitModel.h" 47 #include "pmPSF.h" 48 #include "pmPSFtry.h" 49 #include "pmDetections.h" 50 32 51 #include "pmModel_SERSIC.h" 33 52 53 # define PM_MODEL_NPARAM 8 34 54 # define PM_MODEL_FUNC pmModelFunc_SERSIC 35 55 # define PM_MODEL_FLUX pmModelFlux_SERSIC … … 47 67 48 68 // Lax parameter limits 49 static float paramsMinLax[] = { -1.0e3, 1.0e-2, -100, -100, 0.0 5, 0.05, -1.0, 0.05 };69 static float paramsMinLax[] = { -1.0e3, 1.0e-2, -100, -100, 0.001, 0.001, -1.0, 0.05 }; 50 70 static float paramsMaxLax[] = { 1.0e5, 1.0e8, 1.0e4, 1.0e4, 100, 100, 1.0, 4.0 }; 51 71 … … 84 104 assert (z >= 0); 85 105 86 psF32 f2 = pow(z,PAR[PM_PAR_7]); 87 psF32 f1 = exp(-f2); 106 float index = 0.5 / PAR[PM_PAR_7]; 107 float bn = 1.9992*index - 0.3271; 108 float Io = exp(bn); 109 110 psF32 f2 = bn*pow(z,PAR[PM_PAR_7]); 111 psF32 f1 = Io*exp(-f2); 88 112 psF32 z0 = PAR[PM_PAR_I0]*f1; 89 113 psF32 f0 = PAR[PM_PAR_SKY] + z0; … … 98 122 99 123 // gradient is infinite for z = 0; saturate at z = 0.01 100 psF32 z1 = (z < 0.01) ? z0* PAR[PM_PAR_7]*pow(0.01,PAR[PM_PAR_7] - 1.0) : z0*PAR[PM_PAR_7]*pow(z,PAR[PM_PAR_7] - 1.0);124 psF32 z1 = (z < 0.01) ? z0*bn*PAR[PM_PAR_7]*pow(0.01,PAR[PM_PAR_7] - 1.0) : z0*bn*PAR[PM_PAR_7]*pow(z,PAR[PM_PAR_7] - 1.0); 101 125 102 126 dPAR[PM_PAR_SKY] = +1.0; 103 127 dPAR[PM_PAR_I0] = +f1; 104 dPAR[PM_PAR_7] = (z == 0.0) ? 0.0 : -z0*f2*log(z);128 dPAR[PM_PAR_7] = (z < 0.01) ? -1.5*z0*pow(0.01,PAR[PM_PAR_7])*log(0.01) : -1.5*z0*f2*log(z); 105 129 106 130 assert (isfinite(z1)); … … 111 135 dPAR[PM_PAR_SXX] = +2.0*z1*px*px/PAR[PM_PAR_SXX]; 112 136 dPAR[PM_PAR_SYY] = +2.0*z1*py*py/PAR[PM_PAR_SYY]; 113 dPAR[PM_PAR_SXY] = -1.0*z1*X*Y;114 137 dPAR[PM_PAR_SXY] = -1.0*z1*X*Y; 115 138 } … … 127 150 return true; 128 151 } 129 psAssert(nParam >= 0 && nParam < = PM_PAR_7, "Parameter index is out of bounds");152 psAssert(nParam >= 0 && nParam < PM_MODEL_NPARAM, "Parameter index is out of bounds"); 130 153 131 154 // we need to calculate the limits for SXY specially … … 219 242 if (!isfinite(shape.sxy)) return false; 220 243 244 // the other parameters depend on the guess for PAR_7 245 if (0) { 246 } else { 247 PAR[PM_PAR_7] = 0.25; 248 // PAR[PM_PAR_7] = 0.125; 249 // PAR[PM_PAR_7] = 0.5; 250 } 251 252 float index = 0.5 / PAR[PM_PAR_7]; 253 float bn = 1.9992*index - 0.3271; 254 // float fR = 1.0 / (sqrt(2.0) * pow (bn, index)); 255 float Io = exp(0.5*bn); 256 257 float Sxx = PS_MAX(0.5, shape.sx); 258 float Syy = PS_MAX(0.5, shape.sy); 259 221 260 PAR[PM_PAR_SKY] = 0.0; 222 PAR[PM_PAR_I0] = peak->flux ;261 PAR[PM_PAR_I0] = peak->flux / Io; 223 262 PAR[PM_PAR_XPOS] = peak->xf; 224 263 PAR[PM_PAR_YPOS] = peak->yf; 225 PAR[PM_PAR_SXX] = PS_MAX(0.5, M_SQRT2*shape.sx);226 PAR[PM_PAR_SYY] = PS_MAX(0.5, M_SQRT2*shape.sy);264 PAR[PM_PAR_SXX] = Sxx; 265 PAR[PM_PAR_SYY] = Syy; 227 266 PAR[PM_PAR_SXY] = shape.sxy; 228 PAR[PM_PAR_7] = 0.5;229 267 230 268 return(true); … … 254 292 float f1, f2; 255 293 for (z = DZ; z < 50; z += DZ) { 256 f1 = 1.0 / (1 + PAR[PM_PAR_7]*z + pow(z, 2.25)); 294 // f1 = 1.0 / (1 + PAR[PM_PAR_7]*z + pow(z, 2.25)); 295 f1 = exp(-pow(z,PAR[PM_PAR_7])); 257 296 z += DZ; 258 f2 = 1.0 / (1 + PAR[PM_PAR_7]*z + pow(z, 2.25));297 f2 = exp(-pow(z,PAR[PM_PAR_7])); 259 298 norm += f0 + 4*f1 + f2; 260 299 f0 = f2; … … 287 326 288 327 psEllipseAxes axes = psEllipseShapeToAxes (shape, 20.0); 289 psF64 sigma = axes.major; 290 291 psF64 limit = flux / PAR[PM_PAR_I0]; 292 293 psF64 z = pow (-log(limit), (1.0 / PAR[PM_PAR_7])); 294 psAssert (isfinite(z), "fix this code: z should not be nan for %f", PAR[PM_PAR_7]); 295 296 psF64 radius = sigma * sqrt (2.0 * z); 297 psAssert (isfinite(radius), "fix this code: radius should not be nan for %f, %f", PAR[PM_PAR_7], sigma); 298 299 if (isnan(radius)) 300 psAbort("error in code: radius is NaN"); 301 328 329 // f = Io exp(-z^n) -> z^n = ln(Io/f) 330 psF64 zn = log(PAR[PM_PAR_I0] / flux); 331 psF64 radius = axes.major * sqrt (2.0) * pow(zn, 0.5 / PAR[PM_PAR_7]); 332 333 psAssert (isfinite(radius), "fix this code: z should not be nan for %f", PAR[PM_PAR_7]); 302 334 return (radius); 303 335 } … … 448 480 return; 449 481 } 450 451 # undef PM_MODEL_FUNC452 # undef PM_MODEL_FLUX453 # undef PM_MODEL_GUESS454 # undef PM_MODEL_LIMITS455 # undef PM_MODEL_RADIUS456 # undef PM_MODEL_FROM_PSF457 # undef PM_MODEL_PARAMS_FROM_PSF458 # undef PM_MODEL_FIT_STATUS459 # undef PM_MODEL_SET_LIMITS -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmDetEff.c
r25477 r28643 3 3 #endif 4 4 5 #include <string.h> 5 6 #include <pslib.h> 7 #include "pmHDU.h" 8 #include "pmFPA.h" 6 9 10 #include "pmTrend2D.h" 11 #include "pmResiduals.h" 12 #include "pmGrowthCurve.h" 13 #include "pmSpan.h" 14 #include "pmFootprintSpans.h" 15 #include "pmFootprint.h" 16 #include "pmPeaks.h" 17 #include "pmMoments.h" 18 #include "pmModelFuncs.h" 19 #include "pmModel.h" 20 #include "pmModelUtils.h" 21 #include "pmModelClass.h" 22 #include "pmSourceMasks.h" 23 #include "pmSourceExtendedPars.h" 24 #include "pmSourceDiffStats.h" 25 #include "pmSource.h" 26 #include "pmSourceFitModel.h" 27 #include "pmPSF.h" 28 #include "pmPSFtry.h" 29 #include "pmDetections.h" 7 30 #include "pmDetEff.h" 8 9 31 10 32 static void detEffFree(pmDetEff *de) -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmDetEff.h
r25383 r28643 1 1 #ifndef PM_DET_EFF_H 2 2 #define PM_DET_EFF_H 3 4 #include <pslib.h>5 #include <string.h>6 7 #include "pmFPA.h"8 3 9 4 #define PM_DETEFF_ANALYSIS "DETEFF" // Location of detection efficiency on pmReadout.analysis -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmFootprint.c
r27672 r28643 19 19 #include <pslib.h> 20 20 #include "pmSpan.h" 21 #include "pmFootprintSpans.h" 21 22 #include "pmFootprint.h" 22 23 #include "pmPeaks.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmFootprint.h
r27672 r28643 10 10 #ifndef PM_FOOTPRINT_H 11 11 #define PM_FOOTPRINT_H 12 13 #include <pslib.h>14 #include "pmSpan.h"15 #include "pmFootprintSpans.h"16 12 17 13 typedef struct { -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmFootprintArrayGrow.c
r21183 r28643 18 18 #include <pslib.h> 19 19 #include "pmSpan.h" 20 #include "pmFootprintSpans.h" 20 21 #include "pmFootprint.h" 21 22 #include "pmPeaks.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmFootprintArraysMerge.c
r24274 r28643 18 18 #include <pslib.h> 19 19 #include "pmSpan.h" 20 #include "pmFootprintSpans.h" 20 21 #include "pmFootprint.h" 21 22 #include "pmPeaks.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmFootprintAssignPeaks.c
r20937 r28643 18 18 #include <pslib.h> 19 19 #include "pmSpan.h" 20 #include "pmFootprintSpans.h" 20 21 #include "pmFootprint.h" 21 22 #include "pmPeaks.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmFootprintCullPeaks.c
r27672 r28643 19 19 #include <pslib.h> 20 20 #include "pmSpan.h" 21 #include "pmFootprintSpans.h" 21 22 #include "pmFootprint.h" 22 #include "pmFootprintSpans.h"23 23 #include "pmPeaks.h" 24 24 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmFootprintFind.c
r20937 r28643 19 19 #include <pslib.h> 20 20 #include "pmSpan.h" 21 #include "pmFootprintSpans.h" 21 22 #include "pmFootprint.h" 22 23 #include "pmPeaks.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmFootprintFindAtPoint.c
r27672 r28643 19 19 #include <pslib.h> 20 20 #include "pmSpan.h" 21 #include "pmFootprintSpans.h" 21 22 #include "pmFootprint.h" 22 23 #include "pmPeaks.h" 23 #include "pmFootprintSpans.h"24 24 25 25 /************************************************************************************************************/ -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmFootprintIDs.c
r27672 r28643 19 19 #include <pslib.h> 20 20 #include "pmSpan.h" 21 #include "pmFootprintSpans.h" 21 22 #include "pmFootprint.h" 22 23 #include "pmPeaks.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmFootprintSpans.c
r27672 r28643 19 19 #include <pslib.h> 20 20 #include "pmSpan.h" 21 #include "pmFootprintSpans.h" 21 22 #include "pmFootprint.h" 22 23 #include "pmPeaks.h" 23 #include "pmFootprintSpans.h"24 24 25 25 static void pmStartSpanFree(pmStartSpan *sspan) { -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmFootprintSpans.h
r27672 r28643 10 10 #ifndef PM_FOOTPRINT_SPANS_H 11 11 #define PM_FOOTPRINT_SPANS_H 12 13 #include <pslib.h>14 #include "pmSpan.h"15 12 16 13 /* We define two helper structures used in building the pmFootprints: -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmGrowthCurve.c
r20937 r28643 20 20 #include "pmHDU.h" 21 21 #include "pmFPA.h" 22 23 #include "pmTrend2D.h" 24 #include "pmResiduals.h" 25 #include "pmGrowthCurve.h" 22 26 #include "pmSpan.h" 27 #include "pmFootprintSpans.h" 23 28 #include "pmFootprint.h" 24 29 #include "pmPeaks.h" 25 30 #include "pmMoments.h" 26 #include "pmResiduals.h" 27 #include "pmGrowthCurve.h" 28 #include "pmTrend2D.h" 31 #include "pmModelFuncs.h" 32 #include "pmModel.h" 33 #include "pmModelUtils.h" 34 #include "pmModelClass.h" 35 #include "pmSourceMasks.h" 36 #include "pmSourceExtendedPars.h" 37 #include "pmSourceDiffStats.h" 38 #include "pmSource.h" 39 #include "pmSourceFitModel.h" 29 40 #include "pmPSF.h" 30 #include "pmModel.h" 31 #include "pmSource.h" 41 #include "pmPSFtry.h" 42 #include "pmDetections.h" 43 32 44 #include "psVectorBracket.h" 33 45 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmGrowthCurveGenerate.c
r27531 r28643 24 24 #include "pmHDU.h" 25 25 #include "pmFPA.h" 26 #include "pmFPAMaskWeight.h" 27 #include "psVectorBracket.h" 28 #include "pmErrorCodes.h" 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 26 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 27 35 #include "pmFootprint.h" 28 36 #include "pmPeaks.h" 29 37 #include "pmMoments.h" 30 #include "pmResiduals.h" 31 #include "pmGrowthCurve.h" 32 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 33 47 #include "pmPSF.h" 34 #include "pmModel.h" 35 #include "pmSource.h" 36 #include "pmModelClass.h" 37 #include "pmModelUtils.h" 48 #include "pmPSFtry.h" 49 #include "pmDetections.h" 50 38 51 #include "pmSourcePhotometry.h" 39 #include "pmFPAMaskWeight.h"40 #include "psVectorBracket.h"41 #include "pmErrorCodes.h"42 52 43 53 pmGrowthCurve *pmGrowthCurveForPosition (psImage *image, pmPSF *psf, bool ignore, psImageMaskType maskVal, psImageMaskType markVal, float xc, float yc); -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmModel.c
r25754 r28643 23 23 #include "pmHDU.h" 24 24 #include "pmFPA.h" 25 26 #include "pmTrend2D.h" 25 27 #include "pmResiduals.h" 26 28 #include "pmGrowthCurve.h" 27 #include "pmTrend2D.h" 28 #include "pmPSF.h" 29 #include "pmSpan.h" 30 #include "pmFootprintSpans.h" 31 #include "pmFootprint.h" 32 #include "pmPeaks.h" 33 #include "pmMoments.h" 34 #include "pmModelFuncs.h" 29 35 #include "pmModel.h" 30 36 #include "pmModelClass.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmModel.h
r26916 r28643 14 14 # define PM_MODEL_H 15 15 16 #include <pslib.h>17 #include "pmPSF.h"18 19 16 /// @addtogroup Objects Object Detection / Analysis Functions 20 17 /// @{ … … 22 19 /* pointers for the functions types below are supplied to each pmModel, and can be used by 23 20 the programmer without needing to know the model class */ 24 25 typedef enum {26 PM_MODEL_STATUS_NONE = 0x00, ///< model fit not yet attempted, no other info27 PM_MODEL_STATUS_FITTED = 0x01, ///< model fit completed28 PM_MODEL_STATUS_NONCONVERGE = 0x02, ///< model fit did not converge29 PM_MODEL_STATUS_OFFIMAGE = 0x04, ///< model fit drove out of range30 PM_MODEL_STATUS_BADARGS = 0x08, ///< model fit called with invalid args31 PM_MODEL_STATUS_LIMITS = 0x10 ///< model parameters hit limits32 } pmModelStatus;33 34 typedef enum {35 PM_MODEL_OP_NONE = 0x00,36 PM_MODEL_OP_FUNC = 0x01,37 PM_MODEL_OP_RES0 = 0x02,38 PM_MODEL_OP_RES1 = 0x04,39 PM_MODEL_OP_FULL = 0x07,40 PM_MODEL_OP_SKY = 0x08,41 PM_MODEL_OP_CENTER = 0x10,42 PM_MODEL_OP_NORM = 0x20,43 PM_MODEL_OP_NOISE = 0x40,44 } pmModelOpMode;45 46 /// Parameter limit types47 typedef enum {48 PM_MODEL_LIMITS_NONE, ///< Apply no limits: suitable for debugging49 PM_MODEL_LIMITS_IGNORE, ///< Ignore all limits: fit can go to town50 PM_MODEL_LIMITS_LAX, ///< Lax limits: attempting to reproduce even bad data51 PM_MODEL_LIMITS_MODERATE, ///< Moderate limits: cope with mildly bad data52 PM_MODEL_LIMITS_STRICT, ///< Strict limits: insist on good quality data53 } pmModelLimitsType;54 55 typedef struct pmModel pmModel;56 typedef struct pmSource pmSource;57 58 // This function is the model chi-square minimization function for this model.59 typedef psMinimizeLMChi2Func pmModelFunc;60 61 // This function sets the parameter limits for this model.62 typedef psMinimizeLMLimitFunc pmModelLimits;63 64 // This function returns the integrated flux for the given model parameters.65 typedef psF64 (*pmModelFlux)(const psVector *params);66 67 // This function returns the radius at which the given model and parameters68 // achieves the given flux.69 typedef psF64 (*pmModelRadius)(const psVector *params, double flux);70 71 // This function provides the model guess parameters based on the details of72 // the given source.73 typedef bool (*pmModelGuessFunc)(pmModel *model, pmSource *source);74 75 // This function constructs the PSF model for the given source based on the76 // supplied psf and the EXT model for the object.77 typedef bool (*pmModelFromPSFFunc)(pmModel *modelPSF, pmModel *modelEXT, const pmPSF *psf);78 79 // This function sets the model parameters based on the PSF for a given coordinate and central80 // intensity81 typedef bool (*pmModelParamsFromPSF)(pmModel *model, const pmPSF *psf, float Xo, float Yo, float Io);82 83 // This function returns the success / failure status of the given model fit84 typedef bool (*pmModelFitStatusFunc)(pmModel *model);85 86 // This function sets the parameter limits for the given model87 typedef bool (*pmModelSetLimitsFunc)(pmModelLimitsType type);88 21 89 22 /** pmModel data structure … … 122 55 pmModelSetLimitsFunc modelSetLimits; 123 56 }; 124 125 /** Symbolic names for the elements of [d]params126 * Note: these are #defines not enums as a given element of [d]params127 * may/will correspond to different parameters in different contexts128 */129 #define PM_PAR_SKY 0 ///< Sky130 #define PM_PAR_I0 1 ///< Central intensity131 #define PM_PAR_XPOS 2 ///< X centre of object132 #define PM_PAR_YPOS 3 ///< Y centre of object133 #define PM_PAR_SXX 4 ///< shape X^2 moment134 #define PM_PAR_SYY 5 ///< shape Y^2 moment135 #define PM_PAR_SXY 6 ///< shape XY moment136 #define PM_PAR_7 7 ///< ??? Unknown parameter137 #define PM_PAR_8 8 ///< ??? Unknown parameter138 57 139 58 /** pmModelAlloc() -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmModelClass.c
r25754 r28643 23 23 #include "pmHDU.h" 24 24 #include "pmFPA.h" 25 26 #include "pmTrend2D.h" 27 #include "pmResiduals.h" 28 #include "pmGrowthCurve.h" 25 29 #include "pmSpan.h" 30 #include "pmFootprintSpans.h" 26 31 #include "pmFootprint.h" 27 32 #include "pmPeaks.h" 28 33 #include "pmMoments.h" 29 #include "pmResiduals.h" 30 #include "pmGrowthCurve.h" 31 #include "pmTrend2D.h" 32 #include "pmPSF.h" 34 #include "pmModelFuncs.h" 33 35 #include "pmModel.h" 34 #include "pm Source.h"36 #include "pmModelUtils.h" 35 37 #include "pmModelClass.h" 38 36 39 #include "pmErrorCodes.h" 37 40 … … 46 49 # include "models/pmModel_RGAUSS.h" 47 50 # include "models/pmModel_SERSIC.h" 51 # include "models/pmModel_EXP.h" 52 # include "models/pmModel_DEV.h" 48 53 49 54 static pmModelClass defaultModels[] = { … … 53 58 {"PS_MODEL_PS1_V1", 8, (pmModelFunc)pmModelFunc_PS1_V1, (pmModelFlux)pmModelFlux_PS1_V1, (pmModelRadius)pmModelRadius_PS1_V1, (pmModelLimits)pmModelLimits_PS1_V1, (pmModelGuessFunc)pmModelGuess_PS1_V1, (pmModelFromPSFFunc)pmModelFromPSF_PS1_V1, (pmModelParamsFromPSF)pmModelParamsFromPSF_PS1_V1, (pmModelFitStatusFunc)pmModelFitStatus_PS1_V1, (pmModelSetLimitsFunc)pmModelSetLimits_PS1_V1 }, 54 59 {"PS_MODEL_RGAUSS", 8, (pmModelFunc)pmModelFunc_RGAUSS, (pmModelFlux)pmModelFlux_RGAUSS, (pmModelRadius)pmModelRadius_RGAUSS, (pmModelLimits)pmModelLimits_RGAUSS, (pmModelGuessFunc)pmModelGuess_RGAUSS, (pmModelFromPSFFunc)pmModelFromPSF_RGAUSS, (pmModelParamsFromPSF)pmModelParamsFromPSF_RGAUSS, (pmModelFitStatusFunc)pmModelFitStatus_RGAUSS, (pmModelSetLimitsFunc)pmModelSetLimits_RGAUSS }, 55 {"PS_MODEL_SERSIC", 8, (pmModelFunc)pmModelFunc_SERSIC, (pmModelFlux)pmModelFlux_SERSIC, (pmModelRadius)pmModelRadius_SERSIC, (pmModelLimits)pmModelLimits_SERSIC, (pmModelGuessFunc)pmModelGuess_SERSIC, (pmModelFromPSFFunc)pmModelFromPSF_SERSIC, (pmModelParamsFromPSF)pmModelParamsFromPSF_SERSIC, (pmModelFitStatusFunc)pmModelFitStatus_SERSIC, (pmModelSetLimitsFunc)pmModelSetLimits_SERSIC } 60 {"PS_MODEL_SERSIC", 8, (pmModelFunc)pmModelFunc_SERSIC, (pmModelFlux)pmModelFlux_SERSIC, (pmModelRadius)pmModelRadius_SERSIC, (pmModelLimits)pmModelLimits_SERSIC, (pmModelGuessFunc)pmModelGuess_SERSIC, (pmModelFromPSFFunc)pmModelFromPSF_SERSIC, (pmModelParamsFromPSF)pmModelParamsFromPSF_SERSIC, (pmModelFitStatusFunc)pmModelFitStatus_SERSIC, (pmModelSetLimitsFunc)pmModelSetLimits_SERSIC }, 61 {"PS_MODEL_EXP", 7, (pmModelFunc)pmModelFunc_EXP, (pmModelFlux)pmModelFlux_EXP, (pmModelRadius)pmModelRadius_EXP, (pmModelLimits)pmModelLimits_EXP, (pmModelGuessFunc)pmModelGuess_EXP, (pmModelFromPSFFunc)pmModelFromPSF_EXP, (pmModelParamsFromPSF)pmModelParamsFromPSF_EXP, (pmModelFitStatusFunc)pmModelFitStatus_EXP, (pmModelSetLimitsFunc)pmModelSetLimits_EXP }, 62 {"PS_MODEL_DEV", 7, (pmModelFunc)pmModelFunc_DEV, (pmModelFlux)pmModelFlux_DEV, (pmModelRadius)pmModelRadius_DEV, (pmModelLimits)pmModelLimits_DEV, (pmModelGuessFunc)pmModelGuess_DEV, (pmModelFromPSFFunc)pmModelFromPSF_DEV, (pmModelParamsFromPSF)pmModelParamsFromPSF_DEV, (pmModelFitStatusFunc)pmModelFitStatus_DEV, (pmModelSetLimitsFunc)pmModelSetLimits_DEV }, 56 63 }; 57 64 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmModelClass.h
r25738 r28643 28 28 # ifndef PM_MODEL_CLASS_H 29 29 # define PM_MODEL_CLASS_H 30 31 #include <pmModel.h>32 30 33 31 /// @addtogroup Objects Object Detection / Analysis Functions -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmModelUtils.c
r25754 r28643 22 22 #include "pmHDU.h" 23 23 #include "pmFPA.h" 24 25 #include "pmTrend2D.h" 24 26 #include "pmResiduals.h" 25 27 #include "pmGrowthCurve.h" 26 #include "pmTrend2D.h" 28 #include "pmSpan.h" 29 #include "pmFootprintSpans.h" 30 #include "pmFootprint.h" 31 #include "pmPeaks.h" 32 #include "pmMoments.h" 33 #include "pmModelFuncs.h" 34 #include "pmModel.h" 35 #include "pmModelUtils.h" 36 #include "pmModelClass.h" 37 #include "pmSourceMasks.h" 38 #include "pmSourceExtendedPars.h" 39 #include "pmSourceDiffStats.h" 40 #include "pmSource.h" 41 #include "pmSourceFitModel.h" 27 42 #include "pmPSF.h" 28 #include "pmModel.h" 43 29 44 #include "pmErrorCodes.h" 30 #include "pmModelUtils.h"31 45 32 46 /***************************************************************************** -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmMoments.c
r24498 r28643 29 29 psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__); 30 30 pmMoments *tmp = (pmMoments *) psAlloc(sizeof(pmMoments)); 31 32 tmp->Mrf = 0.0; 33 tmp->Mrh = 0.0; 34 tmp->KronFlux = 0.0; 35 tmp->KronFluxErr = 0.0; 36 37 tmp->KronFinner = 0.0; 38 tmp->KronFouter = 0.0; 39 31 40 tmp->Mx = 0.0; 32 41 tmp->My = 0.0; -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmMoments.h
r23487 r28643 24 24 typedef struct 25 25 { 26 float Mrf; ///< radial first moment 27 float Mrh; ///< radial half moment 28 26 29 float Mx; ///< X-coord of centroid. 27 30 float My; ///< Y-coord of centroid. … … 47 50 float SN; ///< approx signal-to-noise 48 51 int nPixels; ///< Number of pixels used. 52 53 float KronFlux; ///< Kron flux (flux in 2.5*Mrf) 54 float KronFluxErr; ///< Kron flux error 55 56 float KronFinner; ///< Kron flux (flux in 2.5*Mrf) 57 float KronFouter; ///< Kron flux (flux in 2.5*Mrf) 58 49 59 } 50 60 pmMoments; -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPSF.c
r26893 r28643 25 25 #include "pmHDU.h" 26 26 #include "pmFPA.h" 27 #include "pmFPAMaskWeight.h" 28 #include "psVectorBracket.h" 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 27 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 28 35 #include "pmFootprint.h" 29 36 #include "pmPeaks.h" 30 37 #include "pmMoments.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 33 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 34 47 #include "pmPSF.h" 35 #include "pmModel.h" 36 #include "pmSource.h" 37 #include "pmModelClass.h" 38 #include "pmModelUtils.h" 39 #include "pmSourcePhotometry.h" 40 #include "pmFPAMaskWeight.h" 41 #include "psVectorBracket.h" 48 #include "pmPSFtry.h" 49 #include "pmDetections.h" 50 42 51 #include "pmErrorCodes.h" 43 52 … … 54 63 55 64 psFree (options->stats); 65 psFree (options->fitOptions); 56 66 return; 57 67 } … … 65 75 66 76 options->stats = NULL; 77 options->fitOptions = NULL; // XXX this has to be set before calling pmPSF fit functions 67 78 68 79 options->psfTrendMode = PM_TREND_NONE; -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPSF.h
r26893 r28643 14 14 # define PM_PSF_H 15 15 16 #include <pslib.h>17 #include "pmTrend2D.h"18 #include "pmGrowthCurve.h"19 #include "pmResiduals.h"20 #include "pmFPA.h"21 22 16 /// @addtogroup Objects Object Detection / Analysis Functions 23 17 /// @{ 24 25 // type of model carried by the pmModel structure26 typedef int pmModelType;27 18 28 19 /** pmPSF data structure … … 38 29 * 39 30 */ 40 typedef struct{31 struct pmPSF { 41 32 pmModelType type; ///< PSF Model in use 42 33 psArray *params; ///< Model parameters (psPolynomial2D) … … 64 55 pmGrowthCurve *growth; ///< apMag vs Radius 65 56 pmResiduals *residuals; ///< normalized residual image (no spatial variation) 66 } pmPSF;57 }; 67 58 68 59 typedef struct { … … 82 73 float apRadius; 83 74 bool chiFluxTrend; // Fit a trend in Chi2 as a function of flux? 75 pmSourceFitOptions *fitOptions; 84 76 } pmPSFOptions; 85 77 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPSF_IO.c
r28440 r28643 38 38 #include "pmFPAfileFitsIO.h" 39 39 40 #include "pmTrend2D.h" 41 #include "pmResiduals.h" 42 #include "pmGrowthCurve.h" 40 43 #include "pmSpan.h" 44 #include "pmFootprintSpans.h" 41 45 #include "pmFootprint.h" 42 46 #include "pmPeaks.h" 43 47 #include "pmMoments.h" 44 #include "pmGrowthCurve.h" 45 #include "pmResiduals.h" 46 #include "pmTrend2D.h" 48 #include "pmModelFuncs.h" 49 #include "pmModel.h" 50 #include "pmModelUtils.h" 51 #include "pmModelClass.h" 52 #include "pmSourceMasks.h" 53 #include "pmSourceExtendedPars.h" 54 #include "pmSourceDiffStats.h" 55 #include "pmSource.h" 56 #include "pmSourceFitModel.h" 47 57 #include "pmPSF.h" 48 #include "pmModel.h" 58 #include "pmPSFtry.h" 59 #include "pmDetections.h" 60 49 61 #include "pmPSF_IO.h" 50 #include "pmSource.h"51 #include "pmModelClass.h"52 #include "pmModelUtils.h"53 62 #include "pmSourceIO.h" 54 63 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPSFtry.c
r25754 r28643 19 19 #include "pmFPA.h" 20 20 #include "pmFPAMaskWeight.h" 21 22 #include "pmTrend2D.h" 23 #include "pmResiduals.h" 24 #include "pmGrowthCurve.h" 21 25 #include "pmSpan.h" 26 #include "pmFootprintSpans.h" 22 27 #include "pmFootprint.h" 23 28 #include "pmPeaks.h" 24 29 #include "pmMoments.h" 25 #include "pmResiduals.h" 26 #include "pmGrowthCurve.h" 27 #include "pmTrend2D.h" 30 #include "pmModelFuncs.h" 31 #include "pmModel.h" 32 #include "pmModelUtils.h" 33 #include "pmModelClass.h" 34 #include "pmSourceMasks.h" 35 #include "pmSourceExtendedPars.h" 36 #include "pmSourceDiffStats.h" 37 #include "pmSource.h" 38 #include "pmSourceFitModel.h" 28 39 #include "pmPSF.h" 29 #include "pmModel.h"30 #include "pmSource.h"31 #include "pmSourceUtils.h"32 40 #include "pmPSFtry.h" 33 #include "pmModelClass.h" 34 #include "pmModelUtils.h" 35 #include "pmSourceFitModel.h" 41 #include "pmDetections.h" 42 36 43 #include "pmSourcePhotometry.h" 37 44 #include "pmSourceVisual.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPSFtryFitEXT.c
r25754 r28643 19 19 #include "pmFPA.h" 20 20 #include "pmFPAMaskWeight.h" 21 22 #include "pmTrend2D.h" 23 #include "pmResiduals.h" 24 #include "pmGrowthCurve.h" 21 25 #include "pmSpan.h" 26 #include "pmFootprintSpans.h" 22 27 #include "pmFootprint.h" 23 28 #include "pmPeaks.h" 24 29 #include "pmMoments.h" 25 #include "pmResiduals.h" 26 #include "pmGrowthCurve.h" 27 #include "pmTrend2D.h" 28 #include "pmPSF.h" 30 #include "pmModelFuncs.h" 29 31 #include "pmModel.h" 32 #include "pmModelUtils.h" 33 #include "pmModelClass.h" 34 #include "pmSourceMasks.h" 35 #include "pmSourceExtendedPars.h" 36 #include "pmSourceDiffStats.h" 30 37 #include "pmSource.h" 31 38 #include "pmSourceUtils.h" 39 #include "pmSourceFitModel.h" 40 #include "pmPSF.h" 32 41 #include "pmPSFtry.h" 33 #include "pmModelClass.h" 34 #include "pmModelUtils.h" 35 #include "pmSourceFitModel.h" 42 #include "pmDetections.h" 43 36 44 #include "pmSourcePhotometry.h" 37 45 #include "pmSourceVisual.h" … … 44 52 45 53 psTimerStart ("psf.fit"); 54 55 // in this segment, we are fitting the full PSF model class (shape unconstrained) 56 options->fitOptions->mode = PM_SOURCE_FIT_EXT; 46 57 47 58 // maskVal is used to test for rejected pixels, and must include markVal … … 73 84 74 85 // fit model as EXT, not PSF 75 status = pmSourceFitModel (source, source->modelEXT, PM_SOURCE_FIT_EXT, maskVal);86 status = pmSourceFitModel (source, source->modelEXT, options->fitOptions, maskVal); 76 87 77 88 // clear object mask to define valid pixels -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPSFtryFitPSF.c
r26027 r28643 17 17 #include "pmFPA.h" 18 18 #include "pmFPAMaskWeight.h" 19 20 #include "pmTrend2D.h" 21 #include "pmResiduals.h" 22 #include "pmGrowthCurve.h" 19 23 #include "pmSpan.h" 24 #include "pmFootprintSpans.h" 20 25 #include "pmFootprint.h" 21 26 #include "pmPeaks.h" 22 27 #include "pmMoments.h" 23 #include "pmResiduals.h" 24 #include "pmGrowthCurve.h" 25 #include "pmTrend2D.h" 28 #include "pmModelFuncs.h" 29 #include "pmModel.h" 30 #include "pmModelUtils.h" 31 #include "pmModelClass.h" 32 #include "pmSourceMasks.h" 33 #include "pmSourceExtendedPars.h" 34 #include "pmSourceDiffStats.h" 35 #include "pmSource.h" 36 #include "pmSourceFitModel.h" 26 37 #include "pmPSF.h" 27 #include "pmModel.h"28 #include "pmSource.h"29 #include "pmSourceUtils.h"30 38 #include "pmPSFtry.h" 31 #include "pmModelClass.h" 32 #include "pmModelUtils.h" 33 #include "pmSourceFitModel.h" 39 #include "pmDetections.h" 40 34 41 #include "pmSourcePhotometry.h" 35 42 #include "pmSourceVisual.h" … … 42 49 43 50 psTimerStart ("psf.fit"); 51 52 // in this segment, we are fitting the fitted PSF model class (shape constrained) 53 options->fitOptions->mode = PM_SOURCE_FIT_PSF; 44 54 45 55 // maskVal is used to test for rejected pixels, and must include markVal … … 81 91 82 92 // fit the PSF model to the source 83 status = pmSourceFitModel (source, source->modelPSF, PM_SOURCE_FIT_NORM, maskVal);93 status = pmSourceFitModel (source, source->modelPSF, options->fitOptions, maskVal); 84 94 85 95 // skip poor fits -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPSFtryMakePSF.c
r25754 r28643 18 18 #include "pmFPA.h" 19 19 #include "pmFPAMaskWeight.h" 20 21 #include "pmTrend2D.h" 22 #include "pmResiduals.h" 23 #include "pmGrowthCurve.h" 20 24 #include "pmSpan.h" 25 #include "pmFootprintSpans.h" 21 26 #include "pmFootprint.h" 22 27 #include "pmPeaks.h" 23 28 #include "pmMoments.h" 24 #include "pmResiduals.h" 25 #include "pmGrowthCurve.h" 26 #include "pmTrend2D.h" 29 #include "pmModelFuncs.h" 30 #include "pmModel.h" 31 #include "pmModelUtils.h" 32 #include "pmModelClass.h" 33 #include "pmSourceMasks.h" 34 #include "pmSourceExtendedPars.h" 35 #include "pmSourceDiffStats.h" 36 #include "pmSource.h" 37 #include "pmSourceFitModel.h" 27 38 #include "pmPSF.h" 28 #include "pmModel.h"29 #include "pmSource.h"30 #include "pmSourceUtils.h"31 39 #include "pmPSFtry.h" 32 #include "pmModelClass.h" 33 #include "pmModelUtils.h" 34 #include "pmSourceFitModel.h" 40 #include "pmDetections.h" 41 35 42 #include "pmSourcePhotometry.h" 36 43 #include "pmSourceVisual.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPSFtryMetric.c
r26260 r28643 18 18 #include "pmFPA.h" 19 19 #include "pmFPAMaskWeight.h" 20 21 #include "pmTrend2D.h" 22 #include "pmResiduals.h" 23 #include "pmGrowthCurve.h" 20 24 #include "pmSpan.h" 25 #include "pmFootprintSpans.h" 21 26 #include "pmFootprint.h" 22 27 #include "pmPeaks.h" 23 28 #include "pmMoments.h" 24 #include "pmResiduals.h" 25 #include "pmGrowthCurve.h" 26 #include "pmTrend2D.h" 29 #include "pmModelFuncs.h" 30 #include "pmModel.h" 31 #include "pmModelUtils.h" 32 #include "pmModelClass.h" 33 #include "pmSourceMasks.h" 34 #include "pmSourceExtendedPars.h" 35 #include "pmSourceDiffStats.h" 36 #include "pmSource.h" 37 #include "pmSourceFitModel.h" 27 38 #include "pmPSF.h" 28 #include "pmModel.h"29 #include "pmSource.h"30 #include "pmSourceUtils.h"31 39 #include "pmPSFtry.h" 32 #include "pmModelClass.h" 33 #include "pmModelUtils.h" 34 #include "pmSourceFitModel.h" 40 #include "pmDetections.h" 41 35 42 #include "pmSourcePhotometry.h" 36 43 #include "pmSourceVisual.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPSFtryModel.c
r27818 r28643 19 19 #include "pmFPA.h" 20 20 #include "pmFPAMaskWeight.h" 21 22 #include "pmTrend2D.h" 23 #include "pmResiduals.h" 24 #include "pmGrowthCurve.h" 21 25 #include "pmSpan.h" 26 #include "pmFootprintSpans.h" 22 27 #include "pmFootprint.h" 23 28 #include "pmPeaks.h" 24 29 #include "pmMoments.h" 25 #include "pmResiduals.h" 26 #include "pmGrowthCurve.h" 27 #include "pmTrend2D.h" 30 #include "pmModelFuncs.h" 31 #include "pmModel.h" 32 #include "pmModelUtils.h" 33 #include "pmModelClass.h" 34 #include "pmSourceMasks.h" 35 #include "pmSourceExtendedPars.h" 36 #include "pmSourceDiffStats.h" 37 #include "pmSource.h" 38 #include "pmSourceFitModel.h" 28 39 #include "pmPSF.h" 29 #include "pmModel.h"30 #include "pmSource.h"31 #include "pmSourceUtils.h"32 40 #include "pmPSFtry.h" 33 #include "pmModelClass.h" 34 #include "pmModelUtils.h" 35 #include "pmSourceFitModel.h" 36 #include "pmSourcePhotometry.h" 41 #include "pmDetections.h" 42 37 43 #include "pmSourceVisual.h" 38 44 … … 49 55 pmPSFtry *pmPSFtryModel (const psArray *sources, const char *modelName, pmPSFOptions *options, psImageMaskType maskVal, psImageMaskType markVal) 50 56 { 57 assert (options->fitOptions); 58 51 59 // validate the requested model name 52 60 options->type = pmModelClassGetType (modelName); -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPeaks.c
r26893 r28643 22 22 #include <pslib.h> 23 23 #include "pmSpan.h" 24 #include "pmFootprintSpans.h" 24 25 #include "pmFootprint.h" 25 26 #include "pmPeaks.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPeaks.h
r27657 r28643 17 17 # ifndef PM_PEAKS_H 18 18 # define PM_PEAKS_H 19 20 #include <pslib.h>21 #include "pmFootprint.h"22 19 23 20 /// @addtogroup Objects Object Detection / Analysis Functions -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPhotObj.c
r28013 r28643 16 16 #include <string.h> 17 17 #include <pslib.h> 18 19 #include "pmHDU.h" 20 #include "pmFPA.h" 21 22 #include "pmTrend2D.h" 23 #include "pmResiduals.h" 24 #include "pmGrowthCurve.h" 25 #include "pmSpan.h" 26 #include "pmFootprintSpans.h" 27 #include "pmFootprint.h" 28 #include "pmPeaks.h" 29 #include "pmMoments.h" 30 #include "pmModelFuncs.h" 31 #include "pmModel.h" 32 #include "pmModelUtils.h" 33 #include "pmModelClass.h" 34 #include "pmSourceMasks.h" 35 #include "pmSourceExtendedPars.h" 36 #include "pmSourceDiffStats.h" 37 #include "pmSource.h" 38 18 39 #include "pmPhotObj.h" 19 #include "pmSource.h" 40 20 41 21 42 static void pmPhotObjFree (pmPhotObj *tmp) -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmPhotObj.h
r28013 r28643 10 10 # ifndef PM_PHOT_OBJ_H 11 11 # define PM_PHOT_OBJ_H 12 13 #include <pslib.h>14 #include "pmPeaks.h"15 #include "pmModel.h"16 #include "pmMoments.h"17 12 18 13 /// @addtogroup Objects Object Detection / Analysis Functions -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSource.c
r28013 r28643 23 23 #include "pmFPA.h" 24 24 #include "pmFPAMaskWeight.h" 25 26 #include "pmTrend2D.h" 27 #include "pmResiduals.h" 28 #include "pmGrowthCurve.h" 25 29 #include "pmSpan.h" 30 #include "pmFootprintSpans.h" 26 31 #include "pmFootprint.h" 27 32 #include "pmPeaks.h" 28 33 #include "pmMoments.h" 29 #include "pmResiduals.h" 30 #include "pmGrowthCurve.h" 31 #include "pmTrend2D.h" 32 #include "pmPSF.h" 34 #include "pmModelFuncs.h" 33 35 #include "pmModel.h" 36 #include "pmModelUtils.h" 37 #include "pmModelClass.h" 38 #include "pmSourceMasks.h" 39 #include "pmSourceExtendedPars.h" 40 #include "pmSourceDiffStats.h" 34 41 #include "pmSource.h" 35 42 … … 482 489 } 483 490 psfClump.X = stats->clippedMean; 484 psfClump.dX = stats->clippedStdev;491 psfClump.dX = hypot(stats->clippedStdev, PSF_CLUMP_GRID_SCALE); 485 492 486 493 if (!psVectorStats (stats, tmpSy, NULL, NULL, 0)) { … … 489 496 } 490 497 psfClump.Y = stats->clippedMean; 491 psfClump.dY = stats->clippedStdev;498 psfClump.dY = hypot(stats->clippedStdev, PSF_CLUMP_GRID_SCALE); 492 499 493 500 psTrace ("psModules.objects", 2, "clump X, Y: %f, %f\n", psfClump.X, psfClump.Y); -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSource.h
r28013 r28643 11 11 # define PM_SOURCE_H 12 12 13 #include <pslib.h>14 #include "pmPeaks.h"15 #include "pmModel.h"16 #include "pmMoments.h"17 #include "pmSourceExtendedPars.h"18 #include "pmSourceDiffStats.h"19 20 13 /// @addtogroup Objects Object Detection / Analysis Functions 21 14 /// @{ 22 23 #include <pmSourceMasks.h>24 15 25 16 /** pmSourceType enumeration -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceContour.c
r24887 r28643 23 23 #include "pmHDU.h" 24 24 #include "pmFPA.h" 25 26 #include "pmTrend2D.h" 27 #include "pmResiduals.h" 28 #include "pmGrowthCurve.h" 25 29 #include "pmSpan.h" 30 #include "pmFootprintSpans.h" 26 31 #include "pmFootprint.h" 27 32 #include "pmPeaks.h" 28 33 #include "pmMoments.h" 29 #include "pmResiduals.h" 30 #include "pmGrowthCurve.h" 31 #include "pmTrend2D.h" 32 #include "pmPSF.h" 34 #include "pmModelFuncs.h" 33 35 #include "pmModel.h" 36 #include "pmModelUtils.h" 37 #include "pmModelClass.h" 38 #include "pmSourceMasks.h" 39 #include "pmSourceExtendedPars.h" 40 #include "pmSourceDiffStats.h" 34 41 #include "pmSource.h" 42 35 43 #include "pmSourceContour.h" 36 44 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceFitModel.c
r26070 r28643 23 23 #include "pmHDU.h" 24 24 #include "pmFPA.h" 25 26 #include "pmTrend2D.h" 27 #include "pmResiduals.h" 28 #include "pmGrowthCurve.h" 25 29 #include "pmSpan.h" 30 #include "pmFootprintSpans.h" 26 31 #include "pmFootprint.h" 27 32 #include "pmPeaks.h" 28 33 #include "pmMoments.h" 29 #include "pmGrowthCurve.h" 30 #include "pmResiduals.h" 31 #include "pmTrend2D.h" 32 #include "pmPSF.h" 34 #include "pmModelFuncs.h" 33 35 #include "pmModel.h" 36 #include "pmModelUtils.h" 37 #include "pmModelClass.h" 38 #include "pmSourceMasks.h" 39 #include "pmSourceExtendedPars.h" 40 #include "pmSourceDiffStats.h" 34 41 #include "pmSource.h" 35 #include "pmModelClass.h"36 42 #include "pmSourceFitModel.h" 37 43 38 // save as static values so they may be set externally 39 static psF32 PM_SOURCE_FIT_MODEL_NUM_ITERATIONS = 15; 40 static psF32 PM_SOURCE_FIT_MODEL_TOLERANCE = 0.1; 41 static psF32 PM_SOURCE_FIT_MODEL_WEIGHT = 1.0; 42 static bool PM_SOURCE_FIT_MODEL_PIX_WEIGHTS = true; 43 44 bool pmSourceFitModelInit (float nIter, float tol, float weight, bool poissonErrors) 44 void pmSourceFitOptionsFree(pmSourceFitOptions *opt) 45 45 { 46 47 PM_SOURCE_FIT_MODEL_NUM_ITERATIONS = nIter; 48 PM_SOURCE_FIT_MODEL_TOLERANCE = tol; 49 PM_SOURCE_FIT_MODEL_WEIGHT = weight; 50 PM_SOURCE_FIT_MODEL_PIX_WEIGHTS = poissonErrors; 51 52 return true; 46 return; 47 } 48 49 pmSourceFitOptions *pmSourceFitOptionsAlloc(void) { 50 51 pmSourceFitOptions *opt = (pmSourceFitOptions *) psAlloc(sizeof(pmSourceFitOptions)); 52 psMemSetDeallocator(opt, (psFreeFunc) pmSourceFitOptionsFree); 53 54 opt->mode = PM_SOURCE_FIT_PSF; 55 opt->nIter = 15; 56 opt->tol = 0.1; 57 opt->weight = 1.0; 58 opt->poissonErrors = true; 59 60 return opt; 53 61 } 54 62 55 63 bool pmSourceFitModel (pmSource *source, 56 64 pmModel *model, 57 pmSourceFit Mode mode,65 pmSourceFitOptions *options, 58 66 psImageMaskType maskVal) 59 67 { … … 111 119 // as variance to avoid the bias from systematic errors here we would just use the 112 120 // source sky variance 113 if ( PM_SOURCE_FIT_MODEL_PIX_WEIGHTS) {121 if (options->poissonErrors) { 114 122 yErr->data.F32[nPix] = 1.0 / source->variance->data.F32[i][j]; 115 123 } else { 116 yErr->data.F32[nPix] = 1.0 / PM_SOURCE_FIT_MODEL_WEIGHT;124 yErr->data.F32[nPix] = 1.0 / options->weight; 117 125 } 118 126 nPix++; … … 133 141 // set parameter mask based on fitting mode 134 142 int nParams = 0; 135 switch ( mode) {143 switch (options->mode) { 136 144 case PM_SOURCE_FIT_NORM: 137 145 // NORM-only model fits only source normalization (Io) … … 173 181 } 174 182 175 psMinimization *myMin = psMinimizationAlloc ( PM_SOURCE_FIT_MODEL_NUM_ITERATIONS, PM_SOURCE_FIT_MODEL_TOLERANCE);183 psMinimization *myMin = psMinimizationAlloc (options->nIter, options->tol); 176 184 177 185 psImage *covar = psImageAlloc (params->n, params->n, PS_TYPE_F32); -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceFitModel.h
r21183 r28643 22 22 } pmSourceFitMode; 23 23 24 bool pmSourceFitModelInit( 25 float nIter, ///< max number of allowed iterations 26 float tol, ///< convergence criterion 27 float weight, ///< use this weight for constant-weight fits 28 bool poissonErrors // use poisson errors for fits? 29 ); 24 typedef struct { 25 pmSourceFitMode mode; ///< optionally fit all or a subset of parameters 26 float nIter; ///< max number of allowed iterations 27 float tol; ///< convergence criterion 28 float weight; ///< use this weight for constant-weight fits 29 bool poissonErrors; ///< use poisson errors for fits? 30 } pmSourceFitOptions; 31 32 // the pmSourceFitOptions structure is used to control details of the fitting process 33 pmSourceFitOptions *pmSourceFitOptionsAlloc(void); 34 35 // bool pmSourceFitModelInit( 36 // pmSourceFitMode mode, ///< what parameter set should be fitted? 37 // float nIter, ///< max number of allowed iterations 38 // float tol, ///< convergence criterion 39 // float weight, ///< use this weight for constant-weight fits 40 // bool poissonErrors ///< use poisson errors for fits? 41 // ); 30 42 31 43 /** pmSourceFitModel() … … 38 50 */ 39 51 bool pmSourceFitModel( 40 pmSource *source, ///< The input pmSource41 pmModel *model, ///< model to be fitted42 pmSourceFit Mode mode,///< define parameters to be fitted52 pmSource *source, ///< The input pmSource 53 pmModel *model, ///< model to be fitted 54 pmSourceFitOptions *options, ///< define parameters to be fitted 43 55 psImageMaskType maskVal ///< Value to mask 44 56 ); 45 57 46 47 // initialize data for a group of object models 48 bool pmSourceFitSetInit (pmModelType type); 49 50 // clear data for a group of object models 51 void pmSourceFitSetClear (void); 52 53 // function used to set limits for a group of models 54 bool pmSourceFitSet_CheckLimits (psMinConstraintMode mode, int nParam, float *params, float *betas); 55 56 // function used to fit a group of object models 57 psF32 pmSourceFitSet_Function(psVector *deriv, 58 const psVector *params, 59 const psVector *x); 60 61 /** pmSourceFitSet() 62 * 63 * Fit the requested model to the specified source. The starting guess for the model is given 64 * by the input source.model parameter values. The pixels of interest are specified by the 65 * source.pixels and source.mask entries. This function calls psMinimizeLMChi2() on the image 66 * data. The function returns TRUE on success or FALSE on failure. 67 * 68 */ 69 bool pmSourceFitSet( 70 pmSource *source, ///< The input pmSource 71 psArray *modelSet, ///< model to be fitted 72 pmSourceFitMode mode, ///< define parameters to be fitted 73 psImageMaskType maskVal ///< Vale to mask 74 75 ); 58 // // initialize data for a group of object models 59 // bool pmSourceFitSetInit (pmModelType type); 60 // 61 // // clear data for a group of object models 62 // void pmSourceFitSetClear (void); 63 // 64 // // function used to set limits for a group of models 65 // bool pmSourceFitSet_CheckLimits (psMinConstraintMode mode, int nParam, float *params, float *betas); 66 // 67 // // function used to fit a group of object models 68 // psF32 pmSourceFitSet_Function(psVector *deriv, 69 // const psVector *params, 70 // const psVector *x); 71 // 72 // /** pmSourceFitSet() 73 // * 74 // * Fit the requested model to the specified source. The starting guess for the model is given 75 // * by the input source.model parameter values. The pixels of interest are specified by the 76 // * source.pixels and source.mask entries. This function calls psMinimizeLMChi2() on the image 77 // * data. The function returns TRUE on success or FALSE on failure. 78 // * 79 // */ 80 // bool pmSourceFitSet( 81 // pmSource *source, ///< The input pmSource 82 // psArray *modelSet, ///< model to be fitted 83 // pmSourceFitMode mode, ///< define parameters to be fitted 84 // psImageMaskType maskVal ///< Vale to mask 85 // 86 // ); 76 87 77 88 /// @} -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceFitSet.c
r27903 r28643 22 22 #include "pmHDU.h" 23 23 #include "pmFPA.h" 24 25 #include "pmTrend2D.h" 26 #include "pmResiduals.h" 27 #include "pmGrowthCurve.h" 24 28 #include "pmSpan.h" 29 #include "pmFootprintSpans.h" 25 30 #include "pmFootprint.h" 26 31 #include "pmPeaks.h" 27 32 #include "pmMoments.h" 28 #include "pmGrowthCurve.h" 29 #include "pmResiduals.h" 30 #include "pmTrend2D.h" 31 #include "pmPSF.h" 33 #include "pmModelFuncs.h" 32 34 #include "pmModel.h" 35 #include "pmModelUtils.h" 36 #include "pmModelClass.h" 37 #include "pmSourceMasks.h" 38 #include "pmSourceExtendedPars.h" 39 #include "pmSourceDiffStats.h" 33 40 #include "pmSource.h" 34 #include "pmModelClass.h" 41 35 42 #include "pmSourceFitModel.h" 36 43 #include "pmSourceFitSet.h" 37 44 38 45 // save as static values so they may be set externally 39 static psF32 PM_SOURCE_FIT_MODEL_NUM_ITERATIONS = 15;40 static psF32 PM_SOURCE_FIT_MODEL_TOLERANCE = 0.1;41 static psF32 PM_SOURCE_FIT_MODEL_WEIGHT = 1.0;42 static bool PM_SOURCE_FIT_MODEL_PIX_WEIGHTS = true;46 // static psF32 PM_SOURCE_FIT_MODEL_NUM_ITERATIONS = 15; 47 // static psF32 PM_SOURCE_FIT_MODEL_TOLERANCE = 0.1; 48 // static psF32 PM_SOURCE_FIT_MODEL_WEIGHT = 1.0; 49 // static bool PM_SOURCE_FIT_MODEL_PIX_WEIGHTS = true; 43 50 44 51 /********************* Source Model Set Functions ***************************/ … … 429 436 bool pmSourceFitSet (pmSource *source, 430 437 psArray *modelSet, 431 pmSourceFitMode mode,438 pmSourceFitOptions *options, 432 439 psImageMaskType maskVal) 433 440 { … … 478 485 // as variance to avoid the bias from systematic errors here we would just use the 479 486 // source sky variance 480 if ( PM_SOURCE_FIT_MODEL_PIX_WEIGHTS) {481 yErr->data.F32[nPix] = 1.0 / source->variance->data.F32[i][j];482 } else {483 yErr->data.F32[nPix] = 1.0 / PM_SOURCE_FIT_MODEL_WEIGHT;484 }485 nPix++;486 }487 if (options->poissonErrors) { 488 yErr->data.F32[nPix] = 1.0 / source->variance->data.F32[i][j]; 489 } else { 490 yErr->data.F32[nPix] = 1.0 / options->weight; 491 } 492 nPix++; 493 } 487 494 } 488 495 x->n = nPix; … … 490 497 yErr->n = nPix; 491 498 492 // create the FitSet for this thread and set the initial parameter guesses499 // create the FitSet for this thread and set the initial parameter guesses 493 500 pmSourceFitSetData *thisSet = pmSourceFitSetDataSet(modelSet); 494 501 495 // define param and deriv vectors for complete set of parameters502 // define param and deriv vectors for complete set of parameters 496 503 psVector *params = psVectorAlloc (thisSet->nParamSet, PS_TYPE_F32); 497 504 498 // set the param and deriv vectors based on the curent values505 // set the param and deriv vectors based on the curent values 499 506 pmSourceFitSetJoin (NULL, params, thisSet); 500 507 501 // create the minimization constraints508 // create the minimization constraints 502 509 psMinConstraint *constraint = psMinConstraintAlloc(); 503 510 constraint->paramMask = psVectorAlloc (thisSet->nParamSet, PS_TYPE_VECTOR_MASK); 504 511 constraint->checkLimits = pmSourceFitSetCheckLimits; 505 512 506 pmSourceFitSetMasks (constraint, thisSet, mode);507 508 // force the floating parameters to fall within the contraint ranges513 pmSourceFitSetMasks (constraint, thisSet, options->mode); 514 515 // force the floating parameters to fall within the contraint ranges 509 516 for (int i = 0; i < params->n; i++) { 510 pmSourceFitSetCheckLimits (PS_MINIMIZE_PARAM_MIN, i, params->data.F32, NULL);511 pmSourceFitSetCheckLimits (PS_MINIMIZE_PARAM_MAX, i, params->data.F32, NULL);517 pmSourceFitSetCheckLimits (PS_MINIMIZE_PARAM_MIN, i, params->data.F32, NULL); 518 pmSourceFitSetCheckLimits (PS_MINIMIZE_PARAM_MAX, i, params->data.F32, NULL); 512 519 } 513 520 514 521 if (psTraceGetLevel("psModules.objects") >= 5) { 515 for (int i = 0; i < params->n; i++) {516 fprintf (stderr, "%d %f %d\n", i, params->data.F32[i], constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]);517 }522 for (int i = 0; i < params->n; i++) { 523 fprintf (stderr, "%d %f %d\n", i, params->data.F32[i], constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]); 524 } 518 525 } 519 526 520 527 if (nPix < thisSet->nParamSet + 1) { 521 psTrace (__func__, 4, "insufficient valid pixels\n");522 psTrace("psModules.objects", 10, "---- %s() end : fail pixels ----\n", __func__);523 for (int i = 0; i < modelSet->n; i++) {524 pmModel *model = modelSet->data[i];525 model->flags |= PM_MODEL_STATUS_BADARGS;526 }527 psFree (x);528 psFree (y);529 psFree (yErr);530 psFree (params);531 psFree(constraint);532 pmSourceFitSetDataClear(); // frees thisSet and removes if from the array of fitSets533 return(false);534 } 535 536 psMinimization *myMin = psMinimizationAlloc ( PM_SOURCE_FIT_MODEL_NUM_ITERATIONS, PM_SOURCE_FIT_MODEL_TOLERANCE);528 psTrace (__func__, 4, "insufficient valid pixels\n"); 529 psTrace("psModules.objects", 10, "---- %s() end : fail pixels ----\n", __func__); 530 for (int i = 0; i < modelSet->n; i++) { 531 pmModel *model = modelSet->data[i]; 532 model->flags |= PM_MODEL_STATUS_BADARGS; 533 } 534 psFree (x); 535 psFree (y); 536 psFree (yErr); 537 psFree (params); 538 psFree(constraint); 539 pmSourceFitSetDataClear(); // frees thisSet and removes if from the array of fitSets 540 return(false); 541 } 542 543 psMinimization *myMin = psMinimizationAlloc (options->nIter, options->tol); 537 544 538 545 psImage *covar = psImageAlloc (params->n, params->n, PS_TYPE_F32); … … 540 547 fitStatus = psMinimizeLMChi2(myMin, covar, params, constraint, x, y, yErr, pmSourceFitSetFunction); 541 548 if (!fitStatus) { 542 psTrace("psModules.objects", 4, "Failed to fit model (%ld components)\n", modelSet->n);543 } 544 545 // parameter errors from the covariance matrix549 psTrace("psModules.objects", 4, "Failed to fit model (%ld components)\n", modelSet->n); 550 } 551 552 // parameter errors from the covariance matrix 546 553 psVector *dparams = psVectorAlloc (thisSet->nParamSet, PS_TYPE_F32); 547 554 for (int i = 0; i < dparams->n; i++) { 548 if ((constraint->paramMask != NULL) && constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i])549 continue;550 dparams->data.F32[i] = sqrt(covar->data.F32[i][i]);551 } 552 553 // get the Gauss-Newton distance for fixed model parameters555 if ((constraint->paramMask != NULL) && constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) 556 continue; 557 dparams->data.F32[i] = sqrt(covar->data.F32[i][i]); 558 } 559 560 // get the Gauss-Newton distance for fixed model parameters 554 561 if (constraint->paramMask != NULL) { 555 psVector *delta = psVectorAlloc (params->n, PS_TYPE_F32);556 psVector *altmask = psVectorAlloc (params->n, PS_TYPE_VECTOR_MASK);557 altmask->data.PS_TYPE_VECTOR_MASK_DATA[0] = 1;558 for (int i = 1; i < dparams->n; i++) {559 altmask->data.PS_TYPE_VECTOR_MASK_DATA[i] = (constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) ? 0 : 1;560 }561 psMinimizeGaussNewtonDelta(delta, params, altmask, x, y, yErr, pmSourceFitSetFunction);562 563 for (int i = 0; i < dparams->n; i++) {564 if (!constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i])565 continue;566 // note that delta is the value *subtracted* from the parameter567 // to get the new guess. for dparams to represent the direction568 // of motion, we need to take -delta569 dparams->data.F32[i] = -delta->data.F32[i];570 }571 psFree (delta);572 psFree (altmask);562 psVector *delta = psVectorAlloc (params->n, PS_TYPE_F32); 563 psVector *altmask = psVectorAlloc (params->n, PS_TYPE_VECTOR_MASK); 564 altmask->data.PS_TYPE_VECTOR_MASK_DATA[0] = 1; 565 for (int i = 1; i < dparams->n; i++) { 566 altmask->data.PS_TYPE_VECTOR_MASK_DATA[i] = (constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) ? 0 : 1; 567 } 568 psMinimizeGaussNewtonDelta(delta, params, altmask, x, y, yErr, pmSourceFitSetFunction); 569 570 for (int i = 0; i < dparams->n; i++) { 571 if (!constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[i]) 572 continue; 573 // note that delta is the value *subtracted* from the parameter 574 // to get the new guess. for dparams to represent the direction 575 // of motion, we need to take -delta 576 dparams->data.F32[i] = -delta->data.F32[i]; 577 } 578 psFree (delta); 579 psFree (altmask); 573 580 } 574 581 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceFitSet.h
r23487 r28643 56 56 pmSource *source, ///< The input pmSource 57 57 psArray *modelSet, ///< model to be fitted 58 pmSourceFit Mode mode, ///< define parameters to be fitted58 pmSourceFitOptions *options, ///< define options for fitting process 59 59 psImageMaskType maskVal ///< Vale to mask 60 60 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceGroups.c
r26450 r28643 6 6 #include <pslib.h> 7 7 8 #include "pmHDU.h" 8 9 #include "pmFPA.h" 10 11 #include "pmTrend2D.h" 12 #include "pmResiduals.h" 13 #include "pmGrowthCurve.h" 14 #include "pmSpan.h" 15 #include "pmFootprintSpans.h" 16 #include "pmFootprint.h" 17 #include "pmPeaks.h" 18 #include "pmMoments.h" 19 #include "pmModelFuncs.h" 20 #include "pmModel.h" 21 #include "pmModelUtils.h" 22 #include "pmModelClass.h" 23 #include "pmSourceMasks.h" 24 #include "pmSourceExtendedPars.h" 25 #include "pmSourceDiffStats.h" 9 26 #include "pmSource.h" 27 #include "pmSourceFitModel.h" 28 #include "pmPSF.h" 29 #include "pmPSFtry.h" 30 #include "pmDetections.h" 31 10 32 #include "pmSourceGroups.h" 11 33 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceGroups.h
r26182 r28643 1 1 #ifndef PM_SOURCE_GROUPS_H 2 2 #define PM_SOURCE_GROUPS_H 3 4 #include <pslib.h>5 6 #include "pmFPA.h"7 3 8 4 /// Groups of sources -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO.c
r28013 r28643 31 31 #include "pmConceptsRead.h" 32 32 33 #include "pmTrend2D.h" 34 #include "pmResiduals.h" 35 #include "pmGrowthCurve.h" 33 36 #include "pmSpan.h" 37 #include "pmFootprintSpans.h" 34 38 #include "pmFootprint.h" 35 39 #include "pmPeaks.h" 36 40 #include "pmMoments.h" 37 #include "pmGrowthCurve.h" 38 #include "pmResiduals.h" 39 #include "pmTrend2D.h" 41 #include "pmModelFuncs.h" 42 #include "pmModel.h" 43 #include "pmModelUtils.h" 44 #include "pmModelClass.h" 45 #include "pmSourceMasks.h" 46 #include "pmSourceExtendedPars.h" 47 #include "pmSourceDiffStats.h" 48 #include "pmSource.h" 49 #include "pmSourceFitModel.h" 40 50 #include "pmPSF.h" 41 #include "pmModel.h" 51 #include "pmPSFtry.h" 52 42 53 #include "pmDetections.h" 43 #include "pmSource.h"44 #include "pmModelClass.h"45 54 #include "pmDetEff.h" 46 55 #include "pmSourceIO.h" … … 326 335 } 327 336 337 # define PM_SOURCES_WRITE(NAME,TYPE) \ 338 if (!strcmp (exttype, NAME)) { \ 339 status &= pmSourcesWrite_##TYPE(file->fits, readout, sources, file->header, outhead, dataname, recipe); \ 340 if (xsrcname) { \ 341 status &= pmSourcesWrite_##TYPE##_XSRC(file->fits, readout, sources, file->header, xsrcname, recipe); \ 342 } \ 343 if (xfitname) { \ 344 status &= pmSourcesWrite_##TYPE##_XFIT (file->fits, readout, sources, file->header, xfitname); \ 345 } \ 346 } 347 328 348 // write out all readout-level Objects files for this cell 329 349 bool pmReadoutWriteObjects (pmReadout *readout, const pmFPAview *view, pmFPAfile *file, const pmConfig *config) … … 360 380 } 361 381 382 // the older types (RAW, OBJ, SX, CMP) are for backwards compatibility -- deprecate eventually? 362 383 switch (file->type) { 363 384 case PM_FPA_FILE_RAW: … … 518 539 psMetadataAddStr (outhead, PS_LIST_TAIL, "XFITNAME", PS_META_REPLACE, "name of XFIT table extension", xfitname); 519 540 } 520 521 // XXX these are case-sensitive since the EXTYPE is case-sensitive 541 542 543 // these are case-sensitive since the EXTYPE is case-sensitive 522 544 status = true; 523 if (!strcmp (exttype, "SMPDATA")) { 524 status &= pmSourcesWrite_SMPDATA (file->fits, sources, file->header, outhead, dataname); 525 } 526 if (!strcmp (exttype, "PS1_DEV_0")) { 527 status &= pmSourcesWrite_PS1_DEV_0 (file->fits, sources, file->header, outhead, dataname); 528 } 529 if (!strcmp (exttype, "PS1_DEV_1")) { 530 status &= pmSourcesWrite_PS1_DEV_1 (file->fits, sources, file->header, outhead, dataname); 531 } 532 if (!strcmp (exttype, "PS1_CAL_0")) { 533 status &= pmSourcesWrite_PS1_CAL_0 (file->fits, readout, sources, file->header, outhead, dataname); 534 } 535 if (!strcmp (exttype, "PS1_V1")) { 536 status &= pmSourcesWrite_CMF_PS1_V1 (file->fits, readout, sources, file->header, outhead, dataname); 537 } 538 if (!strcmp (exttype, "PS1_V2")) { 539 status &= pmSourcesWrite_CMF_PS1_V2 (file->fits, readout, sources, file->header, outhead, dataname); 540 } 541 if (!strcmp (exttype, "PS1_SV1")) { 542 status &= pmSourcesWrite_CMF_PS1_SV1 (file->fits, readout, sources, file->header, outhead, dataname, recipe); 543 } 544 if (!strcmp (exttype, "PS1_DV1")) { 545 status &= pmSourcesWrite_CMF_PS1_DV1 (file->fits, readout, sources, file->header, outhead, dataname); 546 } 547 548 if (xsrcname) { 549 if (!strcmp (exttype, "PS1_DEV_1")) { 550 status &= pmSourcesWrite_PS1_DEV_1_XSRC (file->fits, sources, xsrcname, recipe); 551 } 552 if (!strcmp (exttype, "PS1_CAL_0")) { 553 status &= pmSourcesWrite_PS1_CAL_0_XSRC (file->fits, readout, sources, file->header, xsrcname, recipe); 554 } 555 if (!strcmp (exttype, "PS1_V1")) { 556 status &= pmSourcesWrite_CMF_PS1_V1_XSRC (file->fits, readout, sources, file->header, xsrcname, recipe); 557 } 558 if (!strcmp (exttype, "PS1_V2")) { 559 status &= pmSourcesWrite_CMF_PS1_V2_XSRC (file->fits, readout, sources, file->header, xsrcname, recipe); 560 } 561 if (!strcmp (exttype, "PS1_SV1")) { 562 status &= pmSourcesWrite_CMF_PS1_SV1_XSRC (file->fits, readout, sources, file->header, xsrcname, recipe); 563 } 564 if (!strcmp (exttype, "PS1_DV1")) { 565 status &= pmSourcesWrite_CMF_PS1_DV1_XSRC (file->fits, readout, sources, file->header, xsrcname, recipe); 566 } 567 } 568 if (xfitname) { 569 if (!strcmp (exttype, "PS1_DEV_1")) { 570 status &= pmSourcesWrite_PS1_DEV_1_XFIT (file->fits, sources, xfitname); 571 } 572 if (!strcmp (exttype, "PS1_CAL_0")) { 573 status &= pmSourcesWrite_PS1_CAL_0_XFIT (file->fits, readout, sources, file->header, xfitname); 574 } 575 if (!strcmp (exttype, "PS1_V1")) { 576 status &= pmSourcesWrite_CMF_PS1_V1_XFIT (file->fits, readout, sources, xfitname); 577 } 578 if (!strcmp (exttype, "PS1_V2")) { 579 status &= pmSourcesWrite_CMF_PS1_V2_XFIT (file->fits, readout, sources, xfitname); 580 } 581 if (!strcmp (exttype, "PS1_SV1")) { 582 status &= pmSourcesWrite_CMF_PS1_SV1_XFIT (file->fits, readout, sources, xfitname); 583 } 584 if (!strcmp (exttype, "PS1_DV1")) { 585 status &= pmSourcesWrite_CMF_PS1_DV1_XFIT (file->fits, readout, sources, xfitname); 586 } 587 } 545 PM_SOURCES_WRITE("SMPDATA", SMPDATA); 546 PM_SOURCES_WRITE("PS1_DEV_0", PS1_DEV_0); 547 PM_SOURCES_WRITE("PS1_DEV_1", PS1_DEV_1); 548 PM_SOURCES_WRITE("PS1_CAL_0", PS1_CAL_0); 549 PM_SOURCES_WRITE("PS1_V1", CMF_PS1_V1); 550 PM_SOURCES_WRITE("PS1_V2", CMF_PS1_V2); 551 PM_SOURCES_WRITE("PS1_V3", CMF_PS1_V3); 552 PM_SOURCES_WRITE("PS1_SV1", CMF_PS1_SV1); 553 PM_SOURCES_WRITE("PS1_DV1", CMF_PS1_DV1); 554 588 555 psFree (outhead); 589 556 psFree (exttype); -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO.h
r28013 r28643 24 24 bool pmSourcesWriteCMP (psArray *sources, char *filename, psMetadata *header); 25 25 26 bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname); 27 bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname); 26 bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, pmConfig *config); 28 27 29 bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname); 30 bool pmSourcesWrite_PS1_DEV_1_XSRC (psFits *fits, psArray *sources, char *extname, psMetadata *recipe); 31 bool pmSourcesWrite_PS1_DEV_1_XFIT (psFits *fits, psArray *sources, char *extname); 28 // All of these functions need to use the same API, even if not all elements are used in a specific case 29 bool pmSourcesWrite_SMPDATA(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe); 30 bool pmSourcesWrite_SMPDATA_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 31 bool pmSourcesWrite_SMPDATA_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname); 32 32 33 bool pmSourcesWrite_PS1_ CAL_0 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);34 bool pmSourcesWrite_PS1_ CAL_0_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe);35 bool pmSourcesWrite_PS1_ CAL_0_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname);33 bool pmSourcesWrite_PS1_DEV_0(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe); 34 bool pmSourcesWrite_PS1_DEV_0_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 35 bool pmSourcesWrite_PS1_DEV_0_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname); 36 36 37 bool pmSourcesWrite_ CMF_PS1_V1 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);38 bool pmSourcesWrite_ CMF_PS1_V1_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe);39 bool pmSourcesWrite_ CMF_PS1_V1_XFIT (psFits *fits, pmReadout *readout, psArray *sources, char *extname);37 bool pmSourcesWrite_PS1_DEV_1(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe); 38 bool pmSourcesWrite_PS1_DEV_1_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 39 bool pmSourcesWrite_PS1_DEV_1_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname); 40 40 41 bool pmSourcesWrite_ CMF_PS1_V2 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);42 bool pmSourcesWrite_ CMF_PS1_V2_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe);43 bool pmSourcesWrite_ CMF_PS1_V2_XFIT (psFits *fits, pmReadout *readout, psArray *sources, char *extname);41 bool pmSourcesWrite_PS1_CAL_0(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe); 42 bool pmSourcesWrite_PS1_CAL_0_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 43 bool pmSourcesWrite_PS1_CAL_0_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname); 44 44 45 bool pmSourcesWrite_CMF_PS1_ SV1(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe);46 bool pmSourcesWrite_CMF_PS1_ SV1_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe);47 bool pmSourcesWrite_CMF_PS1_ SV1_XFIT (psFits *fits, pmReadout *readout, psArray *sources, char *extname);45 bool pmSourcesWrite_CMF_PS1_V1(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe); 46 bool pmSourcesWrite_CMF_PS1_V1_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 47 bool pmSourcesWrite_CMF_PS1_V1_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname); 48 48 49 bool pmSourcesWrite_CMF_PS1_ DV1 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname);50 bool pmSourcesWrite_CMF_PS1_ DV1_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe);51 bool pmSourcesWrite_CMF_PS1_ DV1_XFIT (psFits *fits, pmReadout *readout, psArray *sources, char *extname);49 bool pmSourcesWrite_CMF_PS1_V2(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe); 50 bool pmSourcesWrite_CMF_PS1_V2_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 51 bool pmSourcesWrite_CMF_PS1_V2_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname); 52 52 53 bool pmSource_CMF_WritePHU (const pmFPAview *view, pmFPAfile *file, pmConfig *config); 53 bool pmSourcesWrite_CMF_PS1_V3(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe); 54 bool pmSourcesWrite_CMF_PS1_V3_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 55 bool pmSourcesWrite_CMF_PS1_V3_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname); 56 57 bool pmSourcesWrite_CMF_PS1_SV1(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe); 58 bool pmSourcesWrite_CMF_PS1_SV1_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 59 bool pmSourcesWrite_CMF_PS1_SV1_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname); 60 61 bool pmSourcesWrite_CMF_PS1_DV1(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe); 62 bool pmSourcesWrite_CMF_PS1_DV1_XSRC(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe); 63 bool pmSourcesWrite_CMF_PS1_DV1_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname); 54 64 55 65 psArray *pmSourcesReadCMP (char *filename, psMetadata *header); -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_CMF_PS1_DV1.c
r28013 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 42 51 … … 47 56 // This version has elements intended for difference images & forced photometry: 48 57 // diffStats entries (good for dipoles); flux + flux error (for insignificant detections) 49 bool pmSourcesWrite_CMF_PS1_DV1 (psFits *fits, pmReadout *readout, psArray *sources, 50 psMetadata *imageHeader, psMetadata *tableHeader, char *extname) 58 bool pmSourcesWrite_CMF_PS1_DV1 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe) 51 59 { 52 60 PS_ASSERT_PTR_NON_NULL(fits, false); … … 536 544 537 545 // XXX this layout is still the same as PS1_DEV_1 538 bool pmSourcesWrite_CMF_PS1_DV1_XFIT (psFits *fits, pmReadout *readout, psArray *sources, char *extname)546 bool pmSourcesWrite_CMF_PS1_DV1_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname) 539 547 { 540 548 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_CMF_PS1_SV1.c
r28013 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 42 51 … … 46 55 47 56 // NOTE: this output function is intended for psphotStack analysis: it includes per-psf radial fluxes 48 // XXX currently inthe 'read' function is NOT consistent with the 'write' function (does not read radial fluxes)57 // XXX currently, the 'read' function is NOT consistent with the 'write' function (does not read radial fluxes) 49 58 50 59 bool pmSourcesWrite_CMF_PS1_SV1 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe) … … 616 625 617 626 // XXX this layout is still the same as PS1_DEV_1 618 bool pmSourcesWrite_CMF_PS1_SV1_XFIT (psFits *fits, pmReadout *readout, psArray *sources, char *extname)627 bool pmSourcesWrite_CMF_PS1_SV1_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname) 619 628 { 620 629 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_CMF_PS1_V1.c
r27818 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 42 51 … … 45 54 // followed by a zero-size matrix, followed by the table data 46 55 47 bool pmSourcesWrite_CMF_PS1_V1 (psFits *fits, pmReadout *readout, psArray *sources, 48 psMetadata *imageHeader, psMetadata *tableHeader, char *extname) 56 bool pmSourcesWrite_CMF_PS1_V1 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe) 49 57 { 50 58 PS_ASSERT_PTR_NON_NULL(fits, false); … … 516 524 517 525 // XXX this layout is still the same as PS1_DEV_1 518 bool pmSourcesWrite_CMF_PS1_V1_XFIT (psFits *fits, pmReadout *readout, psArray *sources, char *extname)526 bool pmSourcesWrite_CMF_PS1_V1_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname) 519 527 { 520 528 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_CMF_PS1_V2.c
r27818 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 42 51 … … 45 54 // followed by a zero-size matrix, followed by the table data 46 55 47 bool pmSourcesWrite_CMF_PS1_V2 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname )56 bool pmSourcesWrite_CMF_PS1_V2 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe) 48 57 { 49 58 PS_ASSERT_PTR_NON_NULL(fits, false); … … 578 587 579 588 // XXX this layout is still the same as PS1_DEV_1 580 bool pmSourcesWrite_CMF_PS1_V2_XFIT (psFits *fits, pmReadout *readout, psArray *sources, char *extname)589 bool pmSourcesWrite_CMF_PS1_V2_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname) 581 590 { 582 591 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_CMP.c
r20937 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 42 51 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_MatchedRefs.c
r27177 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 51 42 52 #include "pmAstrometryObjects.h" 43 53 #include "pmAstrometryWCS.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_OBJ.c
r20937 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 42 51 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_PS1_CAL_0.c
r25979 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 42 51 … … 49 58 // XXX how do I generate the source tables which I need to send to PSPS? 50 59 51 bool pmSourcesWrite_PS1_CAL_0 (psFits *fits, pmReadout *readout, psArray *sources, 52 psMetadata *imageHeader, psMetadata *tableHeader, char *extname) 60 bool pmSourcesWrite_PS1_CAL_0 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe) 53 61 { 54 62 PS_ASSERT_PTR_NON_NULL(fits, false); -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_PS1_DEV_0.c
r25979 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 42 51 … … 49 58 // XXX how do I generate the source tables which I need to send to PSPS? 50 59 // XXX: input parameter imageHeader is never used. 51 bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, psArray *sources, psMetadata *imageHeader, 52 psMetadata *tableHeader, char *extname) 60 bool pmSourcesWrite_PS1_DEV_0 (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe) 53 61 { 54 62 PS_ASSERT_PTR_NON_NULL(fits, false); … … 228 236 return (sources); 229 237 } 238 239 bool pmSourcesWrite_PS1_DEV_0_XSRC (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe) 240 { 241 return true; 242 } 243 244 bool pmSourcesWrite_PS1_DEV_0_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname) 245 { 246 return true; 247 } -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_PS1_DEV_1.c
r25979 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 42 51 … … 47 56 // this output format is valid for psphot analysis of an image, and does not include calibrated 48 57 // values derived in the DVO database. 49 // XXX how do I generate the source tables which I need to send to PSPS? 50 51 bool pmSourcesWrite_PS1_DEV_1 (psFits *fits, psArray *sources, 52 psMetadata *imageHeader, psMetadata *tableHeader, char *extname) 58 59 bool pmSourcesWrite_PS1_DEV_1(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe) 53 60 { 54 61 PS_ASSERT_PTR_NON_NULL(fits, false); … … 281 288 } 282 289 283 bool pmSourcesWrite_PS1_DEV_1_XSRC (psFits *fits, p sArray *sources, char *extname, psMetadata *recipe)290 bool pmSourcesWrite_PS1_DEV_1_XSRC (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe) 284 291 { 285 292 … … 453 460 } 454 461 455 bool pmSourcesWrite_PS1_DEV_1_XFIT (psFits *fits, psArray *sources, char *extname)462 bool pmSourcesWrite_PS1_DEV_1_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname) 456 463 { 457 464 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_RAW.c
r25754 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 41 #include "pmSourcePhotometry.h" 48 #include "pmPSFtry.h" 49 42 50 #include "pmSourceIO.h" 43 51 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_SMPDATA.c
r25979 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmResiduals.h" 35 #include "pmGrowthCurve.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 42 51 … … 45 54 // followed by a zero-size matrix, followed by the table data 46 55 // XXX: input parameter imageHeader is never used 47 bool pmSourcesWrite_SMPDATA (psFits *fits, psArray *sources, psMetadata *imageHeader, 48 psMetadata *tableHeader, char *extname) 56 bool pmSourcesWrite_SMPDATA (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, psMetadata *tableHeader, char *extname, psMetadata *recipe) 49 57 { 50 58 PS_ASSERT_PTR_NON_NULL(fits, false); … … 204 212 return (sources); 205 213 } 214 215 bool pmSourcesWrite_SMPDATA_XSRC (psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname, psMetadata *recipe) 216 { 217 return true; 218 } 219 220 bool pmSourcesWrite_SMPDATA_XFIT(psFits *fits, pmReadout *readout, psArray *sources, psMetadata *imageHeader, char *extname) 221 { 222 return true; 223 } -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceIO_SX.c
r20937 r28643 28 28 #include "pmFPAfile.h" 29 29 30 #include "pmTrend2D.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 30 33 #include "pmSpan.h" 34 #include "pmFootprintSpans.h" 31 35 #include "pmFootprint.h" 32 36 #include "pmPeaks.h" 33 37 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 38 #include "pmModelFuncs.h" 39 #include "pmModel.h" 40 #include "pmModelUtils.h" 41 #include "pmModelClass.h" 42 #include "pmSourceMasks.h" 43 #include "pmSourceExtendedPars.h" 44 #include "pmSourceDiffStats.h" 45 #include "pmSource.h" 46 #include "pmSourceFitModel.h" 37 47 #include "pmPSF.h" 38 #include "pmModel.h" 39 #include "pmSource.h" 40 #include "pmModelClass.h" 48 #include "pmPSFtry.h" 49 41 50 #include "pmSourceIO.h" 42 51 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceMatch.c
r28119 r28643 6 6 #include <string.h> 7 7 #include <pslib.h> 8 8 #include "pmHDU.h" 9 #include "pmFPA.h" 10 11 #include "pmTrend2D.h" 12 #include "pmResiduals.h" 13 #include "pmGrowthCurve.h" 14 #include "pmSpan.h" 15 #include "pmFootprintSpans.h" 16 #include "pmFootprint.h" 17 #include "pmPeaks.h" 18 #include "pmMoments.h" 19 #include "pmModelFuncs.h" 20 #include "pmModel.h" 21 #include "pmModelUtils.h" 22 #include "pmModelClass.h" 23 #include "pmSourceMasks.h" 24 #include "pmSourceExtendedPars.h" 25 #include "pmSourceDiffStats.h" 9 26 #include "pmSource.h" 27 #include "pmSourceFitModel.h" 28 #include "pmPSF.h" 29 #include "pmPSFtry.h" 30 #include "pmDetections.h" 31 10 32 #include "pmErrorCodes.h" 11 33 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceMatch.h
r26076 r28643 1 1 #ifndef PM_SOURCE_MATCH_H 2 2 #define PM_SOURCE_MATCH_H 3 4 #include <pslib.h>5 3 6 4 /// Mask values for matched sources -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceMoments.c
r27531 r28643 22 22 #include <strings.h> 23 23 #include <pslib.h> 24 24 25 #include "pmHDU.h" 25 26 #include "pmFPA.h" 26 #include "pmFPAMaskWeight.h" 27 28 #include "pmTrend2D.h" 29 #include "pmResiduals.h" 30 #include "pmGrowthCurve.h" 27 31 #include "pmSpan.h" 32 #include "pmFootprintSpans.h" 28 33 #include "pmFootprint.h" 29 34 #include "pmPeaks.h" 30 35 #include "pmMoments.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 33 #include "pmTrend2D.h" 34 #include "pmPSF.h" 36 #include "pmModelFuncs.h" 35 37 #include "pmModel.h" 38 #include "pmModelUtils.h" 39 #include "pmModelClass.h" 40 #include "pmSourceMasks.h" 41 #include "pmSourceExtendedPars.h" 42 #include "pmSourceDiffStats.h" 36 43 #include "pmSource.h" 37 44 … … 54 61 # define VALID_RADIUS(X,Y,RAD2) (((RAD2) >= (PS_SQR(X) + PS_SQR(Y))) ? 1 : 0) 55 62 63 static bool beVerbose = false; 64 void pmSourceMomentsSetVerbose(bool state){ beVerbose = state; } 65 56 66 bool pmSourceMoments(pmSource *source, psF32 radius, psF32 sigma, psF32 minSN, psImageMaskType maskVal) 57 67 { … … 61 71 PS_ASSERT_FLOAT_LARGER_THAN(radius, 0.0, false); 62 72 63 // use sky from moments if defined, 0.0 otherwise 73 // use sky from moments if defined, 0.0 otherwise 74 75 // XXX this value comes from the sky model at the source center, and tends to over-estimate 76 // the sky in the vicinity of bright sources. we are better off assuming the model worked 77 // well: 64 78 psF32 sky = 0.0; 65 if (source->moments == NULL) {66 source->moments = pmMomentsAlloc();67 } else {68 sky = source->moments->Sky;69 }79 // XXX if (source->moments == NULL) { 80 // XXX source->moments = pmMomentsAlloc(); 81 // XXX } else { 82 // XXX sky = source->moments->Sky; 83 // XXX } 70 84 71 85 // First Pass: calculate the first moments (these are subtracted from the coordinates below) … … 197 211 // Xn = SUM (x - xc)^n * (z - sky) 198 212 213 psF32 RF = 0.0; 214 psF32 RH = 0.0; 215 psF32 RS = 0.0; 199 216 psF32 XX = 0.0; 200 217 psF32 XY = 0.0; … … 244 261 if (r > radius) continue; 245 262 246 psF32 pDiff = *vPix - sky; 263 psF32 fDiff = *vPix - sky; 264 psF32 pDiff = fDiff; 247 265 psF32 wDiff = *vWgt; 248 266 … … 257 275 if (sigma > 0.0) { 258 276 // XXX a lot of extra flops; can we do pre-calculate? 259 psF32 z = (PS_SQR(xDiff) + PS_SQR(yDiff))*rsigma2; 277 // XXX we were re-calculating r2 (maybe the compiler caught this?) 278 // psF32 z = (PS_SQR(xDiff) + PS_SQR(yDiff))*rsigma2; 279 psF32 z = r2 * rsigma2; 260 280 assert (z >= 0.0); 261 281 psF32 weight = exp(-z); … … 266 286 267 287 Sum += pDiff; 288 289 # if (1) 290 # if (0) 291 if (fDiff < 0) continue; 292 # endif 293 psF32 rf = r * fDiff; 294 psF32 rh = sqrt(r) * fDiff; 295 psF32 rs = fDiff; 296 # else 297 psF32 rf = r * pDiff; 298 psF32 rh = sqrt(r) * pDiff; 299 psF32 rs = pDiff; 300 # endif 268 301 269 302 psF32 x = xDiff * pDiff; … … 284 317 psF32 xyyy = xDiff * yyy / r2; 285 318 psF32 yyyy = yDiff * yyy / r2; 319 320 RF += rf; 321 RH += rh; 322 RS += rs; 286 323 287 324 XX += xx; … … 302 339 } 303 340 341 source->moments->Mrf = RF/RS; 342 source->moments->Mrh = RH/RS; 343 304 344 source->moments->Mxx = XX/Sum; 305 345 source->moments->Mxy = XY/Sum; … … 317 357 source->moments->Myyyy = YYYY/Sum; 318 358 319 // if (source->moments->Mxx < 0) { 320 // fprintf (stderr, "error: neg second moment??\n"); 321 // } 322 // if (source->moments->Myy < 0) { 323 // fprintf (stderr, "error: neg second moment??\n"); 324 // } 325 326 psTrace ("psModules.objects", 4, "Mxx: %f Mxy: %f Myy: %f Mxxx: %f Mxxy: %f Mxyy: %f Myyy: %f Mxxxx: %f Mxxxy: %f Mxxyy: %f Mxyyy: %f Mxyyy: %f\n", 359 // Calculate the Kron magnitude (make this block optional?) 360 // float radKron = 2.5*source->moments->Mrf; 361 float radKinner = 1.0*source->moments->Mrf; 362 float radKron = 2.5*source->moments->Mrf; 363 float radKouter = 4.0*source->moments->Mrf; 364 365 int nKronPix = 0; 366 Sum = Var = 0.0; 367 float SumInner = 0.0; 368 float SumOuter = 0.0; 369 370 for (psS32 row = 0; row < source->pixels->numRows ; row++) { 371 372 psF32 yDiff = row - yCM; 373 if (fabs(yDiff) > radKron) continue; 374 375 psF32 *vPix = source->pixels->data.F32[row]; 376 psF32 *vWgt = source->variance->data.F32[row]; 377 psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row]; 378 379 for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) { 380 if (vMsk) { 381 if (*vMsk & maskVal) { 382 vMsk++; 383 continue; 384 } 385 vMsk++; 386 } 387 if (isnan(*vPix)) continue; 388 389 psF32 xDiff = col - xCM; 390 if (fabs(xDiff) > radKron) continue; 391 392 // radKron is just a function of (xDiff, yDiff) 393 psF32 r2 = PS_SQR(xDiff) + PS_SQR(yDiff); 394 psF32 r = sqrt(r2); 395 396 psF32 pDiff = *vPix - sky; 397 psF32 wDiff = *vWgt; 398 399 // skip pixels below specified significance level. this is allowed, but should be 400 // avoided -- the over-weights the wings of bright stars compared to those of faint 401 // stars. 402 if (PS_SQR(pDiff) < minSN2*wDiff) continue; 403 404 if (r < radKron) { 405 Sum += pDiff; 406 Var += wDiff; 407 nKronPix ++; 408 // if (beVerbose) fprintf (stderr, "mome: %d %d %f %f %f\n", col, row, sky, *vPix, Sum); 409 } 410 411 if ((r > radKinner) && (r < radKron)) { 412 SumInner += pDiff; 413 } 414 if ((r > radKron) && (r < radKouter)) { 415 SumOuter += pDiff; 416 } 417 } 418 } 419 source->moments->KronFlux = Sum; 420 source->moments->KronFinner = SumInner; 421 source->moments->KronFouter = SumOuter; 422 source->moments->KronFluxErr = sqrt(Var); 423 424 psTrace ("psModules.objects", 4, "Mrf: %f KronFlux: %f Mxx: %f Mxy: %f Myy: %f Mxxx: %f Mxxy: %f Mxyy: %f Myyy: %f Mxxxx: %f Mxxxy: %f Mxxyy: %f Mxyyy: %f Mxyyy: %f\n", 425 source->moments->Mrf, source->moments->KronFlux, 327 426 source->moments->Mxx, source->moments->Mxy, source->moments->Myy, 328 427 source->moments->Mxxx, source->moments->Mxxy, source->moments->Mxyy, source->moments->Myyy, -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourcePhotometry.c
r28440 r28643 22 22 #include "pmFPA.h" 23 23 #include "pmFPAMaskWeight.h" 24 25 #include "pmTrend2D.h" 26 #include "pmResiduals.h" 27 #include "pmGrowthCurve.h" 24 28 #include "pmSpan.h" 29 #include "pmFootprintSpans.h" 25 30 #include "pmFootprint.h" 26 31 #include "pmPeaks.h" 27 32 #include "pmMoments.h" 28 #include "pmGrowthCurve.h" 29 #include "pmResiduals.h" 30 #include "pmTrend2D.h" 33 #include "pmModelFuncs.h" 34 #include "pmModel.h" 35 #include "pmModelUtils.h" 36 #include "pmModelClass.h" 37 #include "pmSourceMasks.h" 38 #include "pmSourceExtendedPars.h" 39 #include "pmSourceDiffStats.h" 40 #include "pmSource.h" 41 #include "pmSourceFitModel.h" 31 42 #include "pmPSF.h" 32 #include "pmModel.h" 33 #include "pmSource.h" 34 #include "pmModelClass.h" 43 #include "pmPSFtry.h" 44 35 45 #include "pmSourcePhotometry.h" 36 46 … … 257 267 PS_ASSERT_PTR_NON_NULL(image, false); 258 268 PS_ASSERT_PTR_NON_NULL(mask, false); 259 PS_ASSERT_PTR_NON_NULL(model, false); 269 270 if (DO_SKY) { 271 PS_ASSERT_PTR_NON_NULL(model, false); 272 } 260 273 261 274 float apSum = 0; … … 271 284 psF32 **imData = image->data.F32; 272 285 psImageMaskType **mkData = mask->data.PS_TYPE_IMAGE_MASK_DATA; 286 int nAperPix = 0; 273 287 274 288 // measure apMag 275 for (int i x = 0; ix < image->numCols; ix++) {276 for (int iy = 0; iy < image->numRows; iy++) {289 for (int iy = 0; iy < image->numRows; iy++) { 290 for (int ix = 0; ix < image->numCols; ix++) { 277 291 if (mkData[iy][ix] & maskVal) 278 292 continue; 279 293 apSum += imData[iy][ix] - sky; 294 nAperPix ++; 295 // fprintf (stderr, "aper: %d %d %f %f %f\n", ix, iy, sky, imData[iy][ix], apSum); 280 296 } 281 297 } -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourcePlotApResid.c
r26893 r28643 25 25 #include "pmFPAview.h" 26 26 #include "pmFPAfile.h" 27 28 #include "pmTrend2D.h" 29 #include "pmResiduals.h" 30 #include "pmGrowthCurve.h" 27 31 #include "pmSpan.h" 32 #include "pmFootprintSpans.h" 28 33 #include "pmFootprint.h" 29 34 #include "pmPeaks.h" 30 35 #include "pmMoments.h" 31 #include "pmResiduals.h" 32 #include "pmGrowthCurve.h" 33 #include "pmTrend2D.h" 36 #include "pmModelFuncs.h" 37 #include "pmModel.h" 38 #include "pmModelUtils.h" 39 #include "pmModelClass.h" 40 #include "pmSourceMasks.h" 41 #include "pmSourceExtendedPars.h" 42 #include "pmSourceDiffStats.h" 43 #include "pmSource.h" 44 #include "pmSourceFitModel.h" 34 45 #include "pmPSF.h" 35 #include "pmModel.h"36 46 #include "pmDetections.h" 37 #include "pmSource.h" 47 38 48 #include "pmSourcePlots.h" 39 49 #include "pmKapaPlots.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourcePlotMoments.c
r26893 r28643 28 28 #include "pmFPAview.h" 29 29 #include "pmFPAfile.h" 30 31 #include "pmTrend2D.h" 32 #include "pmResiduals.h" 33 #include "pmGrowthCurve.h" 30 34 #include "pmSpan.h" 35 #include "pmFootprintSpans.h" 31 36 #include "pmFootprint.h" 32 37 #include "pmPeaks.h" 33 38 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 39 #include "pmModelFuncs.h" 40 #include "pmModel.h" 41 #include "pmModelUtils.h" 42 #include "pmModelClass.h" 43 #include "pmSourceMasks.h" 44 #include "pmSourceExtendedPars.h" 45 #include "pmSourceDiffStats.h" 46 #include "pmSource.h" 47 #include "pmSourceFitModel.h" 37 48 #include "pmPSF.h" 38 #include "pmModel.h"39 49 #include "pmDetections.h" 40 #include "pmSource.h"41 50 #include "pmSourcePlots.h" 42 51 #include "pmKapaPlots.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourcePlotPSFModel.c
r26893 r28643 28 28 #include "pmFPAview.h" 29 29 #include "pmFPAfile.h" 30 31 32 #include "pmTrend2D.h" 33 #include "pmResiduals.h" 34 #include "pmGrowthCurve.h" 30 35 #include "pmSpan.h" 36 #include "pmFootprintSpans.h" 31 37 #include "pmFootprint.h" 32 38 #include "pmPeaks.h" 33 39 #include "pmMoments.h" 34 #include "pmGrowthCurve.h" 35 #include "pmResiduals.h" 36 #include "pmTrend2D.h" 40 #include "pmModelFuncs.h" 41 #include "pmModel.h" 42 #include "pmModelUtils.h" 43 #include "pmModelClass.h" 44 #include "pmSourceMasks.h" 45 #include "pmSourceExtendedPars.h" 46 #include "pmSourceDiffStats.h" 47 #include "pmSource.h" 48 #include "pmSourceFitModel.h" 37 49 #include "pmPSF.h" 38 #include "pmModel.h"39 50 #include "pmDetections.h" 40 #include "pmSource.h"41 51 #include "pmSourcePlots.h" 42 52 #include "pmKapaPlots.h" -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceSky.c
r23187 r28643 21 21 #include <string.h> 22 22 #include <pslib.h> 23 23 24 #include "pmHDU.h" 24 25 #include "pmFPA.h" 25 #include "pmFPAMaskWeight.h" 26 27 #include "pmTrend2D.h" 28 #include "pmResiduals.h" 29 #include "pmGrowthCurve.h" 26 30 #include "pmSpan.h" 31 #include "pmFootprintSpans.h" 27 32 #include "pmFootprint.h" 28 33 #include "pmPeaks.h" 29 34 #include "pmMoments.h" 30 #include "pmResiduals.h" 31 #include "pmGrowthCurve.h" 32 #include "pmTrend2D.h" 33 #include "pmPSF.h" 35 #include "pmModelFuncs.h" 34 36 #include "pmModel.h" 37 #include "pmModelUtils.h" 38 #include "pmModelClass.h" 39 #include "pmSourceMasks.h" 40 #include "pmSourceExtendedPars.h" 41 #include "pmSourceDiffStats.h" 35 42 #include "pmSource.h" 43 36 44 #include "pmSourceSky.h" 37 45 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceUtils.c
r24578 r28643 21 21 #include <string.h> 22 22 #include <pslib.h> 23 23 24 #include "pmHDU.h" 24 25 #include "pmFPA.h" 25 #include "pmFPAMaskWeight.h" 26 27 #include "pmTrend2D.h" 28 #include "pmResiduals.h" 29 #include "pmGrowthCurve.h" 26 30 #include "pmSpan.h" 31 #include "pmFootprintSpans.h" 27 32 #include "pmFootprint.h" 28 33 #include "pmPeaks.h" 29 34 #include "pmMoments.h" 30 #include "pmResiduals.h" 31 #include "pmGrowthCurve.h" 32 #include "pmTrend2D.h" 33 #include "pmPSF.h" 35 #include "pmModelFuncs.h" 34 36 #include "pmModel.h" 37 #include "pmModelUtils.h" 38 #include "pmModelClass.h" 39 #include "pmSourceMasks.h" 40 #include "pmSourceExtendedPars.h" 41 #include "pmSourceDiffStats.h" 35 42 #include "pmSource.h" 43 36 44 #include "pmSourceUtils.h" 37 45 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourceVisual.c
r28435 r28643 4 4 5 5 #include <pslib.h> 6 #include "pmHDU.h" 7 #include "pmFPA.h" 8 6 9 #include "pmTrend2D.h" 10 #include "pmResiduals.h" 11 #include "pmGrowthCurve.h" 12 #include "pmSpan.h" 13 #include "pmFootprintSpans.h" 14 #include "pmFootprint.h" 15 #include "pmPeaks.h" 16 #include "pmMoments.h" 17 #include "pmModelFuncs.h" 18 #include "pmModel.h" 19 #include "pmModelUtils.h" 20 #include "pmModelClass.h" 21 #include "pmSourceMasks.h" 22 #include "pmSourceExtendedPars.h" 23 #include "pmSourceDiffStats.h" 24 #include "pmSource.h" 25 #include "pmSourceFitModel.h" 7 26 #include "pmPSF.h" 8 27 #include "pmPSFtry.h" 9 #include "pmSource.h" 28 #include "pmDetections.h" 29 10 30 #include "pmSourceVisual.h" 11 31 -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmSpan.h
r20945 r28643 10 10 # ifndef PM_SPAN_H 11 11 # define PM_SPAN_H 12 13 #include <pslib.h>14 12 15 13 /// @addtogroup Objects Object Detection / Analysis Functions -
branches/eam_branches/ipp-20100621/psModules/src/objects/pmTrend2D.h
r25754 r28643 12 12 # ifndef PM_TREND_2D_H 13 13 # define PM_TREND_2D_H 14 15 #include <pslib.h>16 14 17 15 /// @addtogroup Objects Object Detection / Analysis Functions -
branches/eam_branches/ipp-20100621/psModules/src/psmodules.h
r28435 r28643 114 114 115 115 // the following headers are from psModule:objects 116 #include <pmTrend2D.h> 117 #include <pmResiduals.h> 118 #include <pmGrowthCurve.h> 119 116 120 #include <pmSpan.h> 117 121 #include <pmFootprintSpans.h> … … 120 124 #include <pmDetections.h> 121 125 #include <pmMoments.h> 126 127 #include <pmModelFuncs.h> 128 #include <pmModel.h> 129 130 #include <pmSourceMasks.h> 122 131 #include <pmSourceExtendedPars.h> 123 132 #include <pmSourceDiffStats.h> 124 #include <pmResiduals.h> 125 #include <pmGrowthCurve.h> 126 #include <pmTrend2D.h> 133 #include <pmSource.h> 134 #include <pmSourceFitModel.h> 127 135 #include <pmPSF.h> 128 #include <pmModel.h> 129 #include <pmSourceMasks.h> 130 #include <pmSource.h> 136 #include <pmPSFtry.h> 131 137 #include <pmPhotObj.h> 132 138 #include <pmSourceUtils.h> 133 139 #include <pmSourceIO.h> 134 140 #include <pmSourceSky.h> 135 #include <pmSourceFitModel.h>136 141 #include <pmSourceFitSet.h> 137 142 #include <pmSourceContour.h> 138 143 #include <pmSourcePlots.h> 139 144 #include <pmPSF_IO.h> 140 #include <pmPSFtry.h>141 145 #include <pmModelClass.h> 142 146 #include <pmModelUtils.h> -
branches/eam_branches/ipp-20100621/psphot/src/psphot.h
r28013 r28643 211 211 bool psphotInitLimitsPSF (psMetadata *recipe, pmReadout *readout); 212 212 bool psphotInitLimitsEXT (psMetadata *recipe); 213 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, p sImageMaskType maskVal, psImageMaskType markVal);214 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, p sImageMaskType maskVal, psImageMaskType markVal);215 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, p sImageMaskType maskVal, psImageMaskType markVal);216 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pm ModelType modelType, psImageMaskType maskVal, psImageMaskType markVal);217 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, p sImageMaskType maskVal, psImageMaskType markVal);213 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal); 214 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal); 215 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal); 216 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal); 217 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal); 218 218 219 219 // functions to support simultaneous multi-source fitting … … 252 252 bool psphotVisualShowBackground (pmConfig *config, const pmFPAview *view, pmReadout *readout); 253 253 bool psphotVisualShowSignificance (psImage *image, float min, float max); 254 bool psphotVisualShowLogSignificance (psImage *image, float min, float max); 254 255 bool psphotVisualShowPeaks (pmDetections *detections); 255 256 bool psphotVisualShowFootprints (pmDetections *detections); -
branches/eam_branches/ipp-20100621/psphot/src/psphotBlendFit.c
r28405 r28643 75 75 76 76 // Define source fitting parameters for extended source fits 77 pmSourceFitModelInit(fitIter, fitTol, PS_SQR(skySig), poisson); 77 pmSourceFitOptions *fitOptions = pmSourceFitOptionsAlloc(); 78 fitOptions->nIter = fitIter; 79 fitOptions->tol = fitTol; 80 fitOptions->poissonErrors = poisson; 81 fitOptions->weight = PS_SQR(skySig); 82 fitOptions->mode = PM_SOURCE_FIT_PSF; 78 83 79 84 psphotInitLimitsPSF (recipe, readout); … … 88 93 if (!sources->n) { 89 94 psLogMsg ("psphot", PS_LOG_INFO, "no sources, skipping blend"); 95 psFree (fitOptions); 90 96 return true; 91 97 } … … 112 118 psArrayAdd(job->args, 1, psf); 113 119 psArrayAdd(job->args, 1, newSources); // return for new sources 120 psArrayAdd(job->args, 1, fitOptions); // default fit options 114 121 psFree (newSources); 115 122 … … 121 128 if (!psThreadJobAddPending(job)) { 122 129 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 130 psFree (fitOptions); 123 131 return NULL; 124 132 } 125 126 # if (0)127 {128 int nfit = 0;129 int npsf = 0;130 int next = 0;131 int nfail = 0;132 psArray *newSources = psArrayAllocEmpty(16);133 134 if (!psphotBlendFit_Unthreaded (&nfit, &npsf, &next, &nfail, readout, recipe, cells->data[j], psf, newSources)) {135 psError(PS_ERR_UNKNOWN, false, "Unable to guess model.");136 return NULL;137 }138 Nfit += nfit;139 Npsf += npsf;140 Next += next;141 Nfail += nfail;142 143 // add these back onto sources144 for (int k = 0; k < newSources->n; k++) {145 psArrayAdd (sources, 16, newSources->data[k]);146 }147 psFree (newSources);148 }149 # endif150 133 } 151 134 … … 153 136 if (!psThreadPoolWait (false)) { 154 137 psError(PS_ERR_UNKNOWN, false, "Unable to guess model."); 138 psFree (fitOptions); 155 139 return NULL; 156 140 } … … 163 147 } else { 164 148 psScalar *scalar = NULL; 165 scalar = job->args->data[ 5];149 scalar = job->args->data[6]; 166 150 Nfit += scalar->data.S32; 167 scalar = job->args->data[ 6];151 scalar = job->args->data[7]; 168 152 Npsf += scalar->data.S32; 169 scalar = job->args->data[ 7];153 scalar = job->args->data[8]; 170 154 Next += scalar->data.S32; 171 scalar = job->args->data[ 8];155 scalar = job->args->data[9]; 172 156 Nfail += scalar->data.S32; 173 157 … … 186 170 psphotSaveImage (NULL, readout->image, "image.v2.fits"); 187 171 } 172 psFree (fitOptions); 188 173 189 174 psLogMsg ("psphot.psphotBlendFit", PS_LOG_INFO, "fit models: %f sec for %d objects (%d psf, %d ext, %d failed, %ld skipped)\n", psTimerMark ("psphot.fit.nonlinear"), Nfit, Npsf, Next, Nfail, sources->n - Nfit); … … 204 189 psScalar *scalar = NULL; 205 190 206 pmReadout *readout = job->args->data[0]; 207 psMetadata *recipe = job->args->data[1]; 208 psArray *sources = job->args->data[2]; 209 pmPSF *psf = job->args->data[3]; 210 psArray *newSources = job->args->data[4]; 191 pmReadout *readout = job->args->data[0]; 192 psMetadata *recipe = job->args->data[1]; 193 psArray *sources = job->args->data[2]; 194 pmPSF *psf = job->args->data[3]; 195 psArray *newSources = job->args->data[4]; 196 pmSourceFitOptions *fitOptions = job->args->data[5]; 211 197 212 198 // bit-masks to test for good/bad pixels … … 269 255 Nfit ++; 270 256 257 if (0) { 258 psF32 Mxx = source->moments->Mxx; 259 psF32 Myy = source->moments->Myy; 260 fprintf (stderr, "1: Mxx: %f, Myy: %f\n", Mxx, Myy); 261 } 262 271 263 // try fitting PSFs or extended sources depending on source->mode 272 264 // these functions subtract the resulting fitted source 273 265 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) { 274 if (psphotFitBlob (readout, source, newSources, psf, maskVal, markVal)) {266 if (psphotFitBlob (readout, source, newSources, psf, fitOptions, maskVal, markVal)) { 275 267 source->type = PM_SOURCE_TYPE_EXTENDED; 276 268 psTrace ("psphot", 5, "source at %7.1f, %7.1f is ext", source->peak->xf, source->peak->yf); … … 280 272 } 281 273 } else { 282 if (psphotFitBlend (readout, source, psf, maskVal, markVal)) {274 if (psphotFitBlend (readout, source, psf, fitOptions, maskVal, markVal)) { 283 275 source->type = PM_SOURCE_TYPE_STAR; 284 276 psTrace ("psphot", 5, "source at %7.1f, %7.1f is psf", source->peak->xf, source->peak->yf); … … 289 281 } 290 282 283 if (0) { 284 psF32 Mxx = source->moments->Mxx; 285 psF32 Myy = source->moments->Myy; 286 fprintf (stderr, "2: Mxx: %f, Myy: %f\n", Mxx, Myy); 287 } 288 291 289 psTrace ("psphot", 5, "source at %7.1f, %7.1f failed", source->peak->xf, source->peak->yf); 292 290 Nfail ++; … … 298 296 299 297 // change the value of a scalar on the array (wrap this and put it in psArray.h) 300 scalar = job->args->data[ 5];298 scalar = job->args->data[6]; 301 299 scalar->data.S32 = Nfit; 302 300 303 scalar = job->args->data[ 6];301 scalar = job->args->data[7]; 304 302 scalar->data.S32 = Npsf; 305 303 306 scalar = job->args->data[ 7];304 scalar = job->args->data[8]; 307 305 scalar->data.S32 = Next; 308 306 309 scalar = job->args->data[ 8];307 scalar = job->args->data[9]; 310 308 scalar->data.S32 = Nfail; 311 309 -
branches/eam_branches/ipp-20100621/psphot/src/psphotChoosePSF.c
r28013 r28643 74 74 75 75 // structure to store user options defining the psf 76 pmPSFOptions *options = pmPSFOptionsAlloc ();76 pmPSFOptions *options = pmPSFOptionsAlloc(); 77 77 78 78 // load user options from the recipe. no need to check existence -- they are … … 143 143 return false; 144 144 } 145 pmSourceFitModelInit(fitIter, fitTol, PS_SQR(SKY_SIG), options->poissonErrorsPhotLMM); 146 145 146 // options which modify the behavior of the model fitting 147 options->fitOptions = pmSourceFitOptionsAlloc(); 148 options->fitOptions->nIter = fitIter; 149 options->fitOptions->tol = fitTol; 150 options->fitOptions->poissonErrors = options->poissonErrorsPhotLMM; 151 options->fitOptions->weight = PS_SQR(SKY_SIG); 152 options->fitOptions->mode = PM_SOURCE_FIT_PSF; 153 147 154 psArray *stars = psArrayAllocEmpty (sources->n); 148 155 -
branches/eam_branches/ipp-20100621/psphot/src/psphotExtendedSourceFits.c
r28013 r28643 129 129 sources = psArraySort (sources, pmSourceSortBySN); 130 130 131 // Define source fitting parameters for extended source fits 132 pmSourceFitOptions *fitOptions = pmSourceFitOptionsAlloc(); 133 fitOptions->mode = PM_SOURCE_FIT_EXT; 134 // XXX for now, use the defaults for the rest: 135 // fitOptions->nIter = fitIter; 136 // fitOptions->tol = fitTol; 137 // fitOptions->poissonErrors = poisson; 138 // fitOptions->weight = PS_SQR(skySig); 139 131 140 // choose the sources of interest 132 141 for (int i = 0; i < sources->n; i++) { … … 215 224 psFree (source->modelFlux); 216 225 source->modelFlux = NULL; 217 modelFit = psphotFitEXT (readout, source, modelType, maskVal, markVal);226 modelFit = psphotFitEXT (readout, source, fitOptions, modelType, maskVal, markVal); 218 227 if (!modelFit) { 219 228 psTrace ("psphot", 5, "failed to fit plain model for object at %f, %f", source->moments->Mx, source->moments->My); … … 311 320 } 312 321 } 322 psFree (fitOptions); 313 323 314 324 psLogMsg ("psphot", PS_LOG_INFO, "extended source analysis: %f sec for %d objects\n", psTimerMark ("psphot"), Next); -
branches/eam_branches/ipp-20100621/psphot/src/psphotFindDetections.c
r28013 r28643 90 90 psphotVisualShowSignificance (significance, -1.0, PS_SQR(3.0*NSIGMA_PEAK)); 91 91 92 // XXX getting some strange results from significance image 93 if (0) { 94 psImage *lsig = (psImage *) psUnaryOp (NULL, significance, "log"); 95 psphotVisualShowSignificance (lsig, 0.0, 4.0); 96 psFree (lsig); 97 } 92 // display the log significance image 93 psphotVisualShowLogSignificance (significance, 0.0, 4.5); 98 94 99 95 // detect the peaks in the significance image -
branches/eam_branches/ipp-20100621/psphot/src/psphotFitSet.c
r21183 r28643 24 24 } 25 25 26 // Define source fitting parameters for extended source fits 27 pmSourceFitOptions *fitOptions = pmSourceFitOptionsAlloc(); 28 fitOptions->mode = PM_SOURCE_FIT_EXT; 29 // XXX for now, use the defaults for the rest: 30 // fitOptions->nIter = fitIter; 31 // fitOptions->tol = fitTol; 32 // fitOptions->poissonErrors = poisson; 33 // fitOptions->weight = PS_SQR(skySig); 34 26 35 // XXX pmSourceFitSet must cache the modelFlux? 27 pmSourceFitSet (source, modelSet, mode, maskVal);36 pmSourceFitSet (source, modelSet, fitOptions, maskVal); 28 37 29 38 // write out positive object -
branches/eam_branches/ipp-20100621/psphot/src/psphotReadout.c
r28398 r28643 53 53 } 54 54 55 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are determined and saved on 56 // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT 55 // load the psf model, if suppled. FWHM_MAJ,FWHM_MIN,etc are determined and saved on 56 // readout->analysis. XXX Note: this function currently only works with a single 57 // PSPHOT.INPUT 57 58 if (!psphotLoadPSF (config, view)) { // ??? need to supply 2 ? 58 59 psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model"); -
branches/eam_branches/ipp-20100621/psphot/src/psphotSetThreads.c
r26894 r28643 30 30 psFree(task); 31 31 32 task = psThreadTaskAlloc("PSPHOT_BLEND_FIT", 9);32 task = psThreadTaskAlloc("PSPHOT_BLEND_FIT", 10); 33 33 task->function = &psphotBlendFit_Threaded; 34 34 psThreadTaskAdd(task); -
branches/eam_branches/ipp-20100621/psphot/src/psphotSourceFits.c
r26894 r28643 2 2 3 3 // given a source with an existing modelPSF, attempt a full PSF fit, subtract if successful 4 // XXX this function does not call pmSourceFitModelInit : fix this?5 4 6 5 static int NfitPSF = 0; … … 22 21 } 23 22 24 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, p sImageMaskType maskVal, psImageMaskType markVal) {23 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal) { 25 24 26 25 float x, y, dR; 26 27 pmSourceFitOptions options = *fitOptions; 27 28 28 29 // maskVal is used to test for rejected pixels, and must include markVal … … 31 32 // if this source is not a possible blend, just fit as PSF 32 33 if ((source->blends == NULL) || (source->mode & PM_SOURCE_MODE_SATSTAR)) { 33 bool status = psphotFitPSF (readout, source, psf, maskVal, markVal);34 bool status = psphotFitPSF (readout, source, psf, fitOptions, maskVal, markVal); 34 35 return status; 35 36 } … … 91 92 92 93 // fit PSF model 93 pmSourceFitSet (source, modelSet, PM_SOURCE_FIT_PSF, maskVal); 94 options.mode = PM_SOURCE_FIT_PSF; 95 pmSourceFitSet (source, modelSet, &options, maskVal); 94 96 95 97 // clear the circular mask … … 154 156 } 155 157 156 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, p sImageMaskType maskVal, psImageMaskType markVal) {158 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal) { 157 159 158 160 double chiTrend; 161 pmSourceFitOptions options = *fitOptions; 159 162 160 163 // maskVal is used to test for rejected pixels, and must include markVal … … 171 174 172 175 // fit PSF model (set/unset the pixel mask) 173 pmSourceFitModel (source, PSF, PM_SOURCE_FIT_PSF, maskVal); 176 options.mode = PM_SOURCE_FIT_PSF; 177 pmSourceFitModel (source, PSF, &options, maskVal); 174 178 175 179 if (!isfinite(PSF->params->data.F32[PM_PAR_I0])) psAbort("nan in fit"); … … 213 217 } 214 218 215 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *newSources, pmPSF *psf, p sImageMaskType maskVal, psImageMaskType markVal) {219 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *newSources, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal) { 216 220 217 221 bool okEXT, okDBL; … … 246 250 247 251 // XXX need to handle failures better here 248 EXT = psphotFitEXT (readout, source, modelTypeEXT, maskVal, markVal);252 EXT = psphotFitEXT (readout, source, fitOptions, modelTypeEXT, maskVal, markVal); 249 253 if (!EXT) goto escape; 250 254 if (!isfinite(EXT->params->data.F32[PM_PAR_I0])) goto escape; … … 254 258 255 259 // DBL will always be defined, but DBL->data[n] might not 256 DBL = psphotFitDBL (readout, source, maskVal, markVal);260 DBL = psphotFitDBL (readout, source, fitOptions, maskVal, markVal); 257 261 if (!DBL) goto escape; 258 262 if (!DBL->n) goto escape; … … 379 383 380 384 // fit a double PSF source to an extended blob 381 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, p sImageMaskType maskVal, psImageMaskType markVal) {385 psArray *psphotFitDBL (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal) { 382 386 383 387 float dx, dy; … … 387 391 psEllipseMoments moments; 388 392 psArray *modelSet; 393 394 pmSourceFitOptions options = *fitOptions; 389 395 390 396 NfitDBL ++; … … 426 432 427 433 // fit PSF model (set/unset the pixel mask) 428 pmSourceFitSet (source, modelSet, PM_SOURCE_FIT_PSF, maskVal); 434 options.mode = PM_SOURCE_FIT_PSF; 435 pmSourceFitSet (source, modelSet, &options, maskVal); 429 436 return (modelSet); 430 437 } 431 438 432 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) { 439 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) { 440 441 pmSourceFitOptions options = *fitOptions; 433 442 434 443 NfitEXT ++; … … 436 445 // maskVal is used to test for rejected pixels, and must include markVal 437 446 maskVal |= markVal; 447 448 psTraceSetLevel("psLib.math.psMinimizeLMChi2", 5); 438 449 439 450 // use the source moments, etc to guess basic model parameters … … 448 459 } 449 460 461 // for sersic models, get the initial guess more carefully 462 // if (modelType == pmModelClassGetType("PS_MODEL_SERSIC")) { 463 // psphotGuessSersic (); 464 // // test and return NULL on failure? 465 // } 466 450 467 // fit EXT (not PSF) model (set/unset the pixel mask) 451 pmSourceFitModel (source, EXT, PM_SOURCE_FIT_EXT, maskVal); 468 options.mode = PM_SOURCE_FIT_EXT; 469 pmSourceFitModel (source, EXT, &options, maskVal); 470 471 psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0); 452 472 return (EXT); 453 473 } 474 475 // A sersic model is very sensitive to the index. attempt to find the index first by grid search in just the index 476 // bool psphotFitSersic (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) { 477 // 478 // assert (model->type == pmModelClassGetType("PS_MODEL_SERSIC")); 479 // 480 // 481 // 482 // if (!model->modelGuess(model, source)) { 483 // } 484 // 485 // 486 // } -
branches/eam_branches/ipp-20100621/psphot/src/psphotSourceSize.c
r28013 r28643 1 1 # include "psphotInternal.h" 2 2 # include <gsl/gsl_sf_gamma.h> 3 4 # define KRON 1 3 5 4 6 typedef struct { … … 197 199 pmSourceSub (source, PM_MODEL_OP_FULL, options->maskVal); 198 200 201 // XXX test: switch to kron flux 202 # if (KRON) 203 float apMag = -2.5*log10(source->moments->KronFlux); 204 # else 199 205 float apMag = -2.5*log10(source->moments->Sum); 206 # endif 200 207 float dMag = source->psfMag - apMag; 201 208 … … 343 350 pmSourceSub (source, PM_MODEL_OP_FULL, options->maskVal); 344 351 352 # if (KRON) 353 float apMag = -2.5*log10(source->moments->KronFlux); 354 # else 345 355 float apMag = -2.5*log10(source->moments->Sum); 356 # endif 346 357 float dMag = source->psfMag - apMag; 347 358 348 359 // set nSigma to include both systematic and poisson error terms 349 360 // XXX the 'poisson error' contribution for size is probably wrong... 350 float nSigmaMAG = (dMag - options->ApResid) / hypot(source->errMag, options->ApSysErr); 361 // XXX add in a hard floor on the Ap Sys Err (to be a bit generous) 362 float nSigmaMAG = (dMag - options->ApResid) / hypot(source->errMag, hypot(options->ApSysErr, 0.025)); 351 363 float nSigmaMXX = (Mxx - psfClump->X) / hypot(psfClump->dX, psfClump->X*psfClump->X*source->errMag); 352 364 float nSigmaMYY = (Myy - psfClump->Y) / hypot(psfClump->dY, psfClump->Y*psfClump->Y*source->errMag); 365 366 fprintf (stderr, "Mxx: %f, Myy: %f, dx: %f, dy: %f, psfMag: %f, apMag: %f, dMag: %f, errMag: %f, nSigmaMag: %f\n", 367 Mxx, Myy, source->peak->xf - source->moments->Mx, source->peak->yf - source->moments->My, 368 source->psfMag, apMag, dMag, source->errMag, nSigmaMAG); 353 369 354 370 // partially-masked sources are more likely to be mis-measured PSFs -
branches/eam_branches/ipp-20100621/psphot/src/psphotSourceStats.c
r28440 r28643 1 1 # include "psphotInternal.h" 2 void pmSourceMomentsSetVerbose(bool state); 2 3 3 4 // convert detections to sources and measure their basic properties (moments, local sky, sky … … 369 370 maskVal |= markVal; 370 371 372 // XXX test : pmSourceMomentsSetVerbose(true); 373 371 374 // threaded measurement of the sources moments 372 375 int Nfail = 0; … … 408 411 // measure basic source moments (no S/N clipping on input pixels) 409 412 status = pmSourceMoments (source, RADIUS, SIGMA, 0.0, maskVal); 413 // XXX moments / aperture test: 414 if (0) { 415 // clear the mask bit and set the circular mask pixels 416 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); 417 psImageKeepCircle (source->maskObj, source->peak->x, source->peak->y, 4.0*source->moments->Mrf, "OR", markVal); 418 419 float apMag = NAN; 420 pmSourcePhotometryAper (&apMag, NULL, source->pixels, source->maskObj, maskVal); 421 fprintf (stderr, "apMag: %f, kronMag: %f\n", apMag, -2.5*log10(source->moments->KronFlux)); 422 423 // clear the mask bit 424 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); 425 } 410 426 if (status) { 411 427 Nmoments ++; -
branches/eam_branches/ipp-20100621/psphot/src/psphotVisual.c
r28435 r28643 228 228 229 229 psphotVisualRangeImage (kapa, image, "signif", 2, min, max); 230 231 pmVisualAskUser(NULL); 232 return true; 233 } 234 235 bool psphotVisualShowLogSignificance (psImage *image, float min, float max) { 236 237 if (!pmVisualTestLevel("psphot.image.logsignif", 3)) return true; 238 239 int kapa = psphotKapaChannel (1); 240 if (kapa == -1) return false; 241 242 psImage *lsig = (psImage *) psUnaryOp (NULL, image, "log"); 243 psphotVisualRangeImage (kapa, lsig, "log-signif", 2, min, max); 244 psFree (lsig); 230 245 231 246 pmVisualAskUser(NULL);
Note:
See TracChangeset
for help on using the changeset viewer.
