Changeset 27909
- Timestamp:
- May 10, 2010, 5:24:37 PM (16 years ago)
- Location:
- branches/eam_branches/psphot.20100506/src
- Files:
-
- 38 edited
-
psphot.h (modified) (4 diffs)
-
psphotAddNoise.c (modified) (4 diffs)
-
psphotApResid.c (modified) (4 diffs)
-
psphotBasicDeblend.c (modified) (4 diffs)
-
psphotBlendFit.c (modified) (4 diffs)
-
psphotChoosePSF.c (modified) (4 diffs)
-
psphotDeblendSatstars.c (modified) (4 diffs)
-
psphotEfficiency.c (modified) (4 diffs)
-
psphotExtendedSourceAnalysis.c (modified) (4 diffs)
-
psphotExtendedSourceFits.c (modified) (4 diffs)
-
psphotFindDetections.c (modified) (4 diffs)
-
psphotFitSourcesLinear.c (modified) (3 diffs)
-
psphotForcedReadout.c (modified) (5 diffs)
-
psphotGuessModels.c (modified) (4 diffs)
-
psphotImageQuality.c (modified) (3 diffs)
-
psphotMagnitudes.c (modified) (3 diffs)
-
psphotMakePSFReadout.c (modified) (3 diffs)
-
psphotMaskReadout.c (modified) (3 diffs)
-
psphotMergeSources.c (modified) (12 diffs)
-
psphotModelBackground.c (modified) (2 diffs)
-
psphotModelTest.c (modified) (2 diffs)
-
psphotOutput.c (modified) (2 diffs)
-
psphotReadout.c (modified) (7 diffs)
-
psphotReadoutCleanup.c (modified) (3 diffs)
-
psphotReadoutFindPSF.c (modified) (6 diffs)
-
psphotReadoutKnownSources.c (modified) (5 diffs)
-
psphotReadoutMinimal.c (modified) (3 diffs)
-
psphotReplaceUnfit.c (modified) (2 diffs)
-
psphotRoughClass.c (modified) (4 diffs)
-
psphotSkyReplace.c (modified) (3 diffs)
-
psphotSourceFreePixels.c (modified) (3 diffs)
-
psphotSourceMatch.c (modified) (6 diffs)
-
psphotSourceSize.c (modified) (4 diffs)
-
psphotSourceStats.c (modified) (4 diffs)
-
psphotStackChisqImage.c (modified) (7 diffs)
-
psphotStackImageLoop.c (modified) (1 diff)
-
psphotStackReadout.c (modified) (8 diffs)
-
psphotSubtractBackground.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/psphot.20100506/src/psphot.h
r27884 r27909 37 37 bool psphotReadoutMinimal(pmConfig *config, const pmFPAview *view); 38 38 39 bool psphotReadoutCleanup (pmConfig *config, const pmFPAview *view );40 bool psphotReadoutCleanupReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);39 bool psphotReadoutCleanup (pmConfig *config, const pmFPAview *view, const char *filerule); 40 bool psphotReadoutCleanupReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 41 41 42 42 bool psphotDefineFiles (pmConfig *config, pmFPAfile *input); … … 51 51 52 52 // psphotReadout functions 53 bool psphotAddPhotcode (pmConfig *config, const pmFPAview *view );53 bool psphotAddPhotcode (pmConfig *config, const pmFPAview *view, const char *filerule); 54 54 bool psphotAddPhotcodeReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index); 55 55 56 bool psphotSetMaskAndVariance (pmConfig *config, const pmFPAview *view );57 bool psphotSetMaskAndVarianceReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);58 59 bool psphotModelBackground (pmConfig *config, const pmFPAview *view );60 bool psphotModelBackgroundReadoutFileIndex (pmConfig *config, const pmFPAview *view, const char *file name, int index);61 62 bool psphotSubtractBackground (pmConfig *config, const pmFPAview *view );63 bool psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);64 65 bool psphotFindDetections (pmConfig *config, const pmFPAview *view, bool firstPass);66 bool psphotFindDetectionsReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe, bool firstPass);67 68 bool psphotSourceStats (pmConfig *config, const pmFPAview *view, bool setWindow);69 bool psphotSourceStatsReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe, bool setWindow);70 71 bool psphotDeblendSatstars (pmConfig *config, const pmFPAview *view );72 bool psphotDeblendSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index);73 74 bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view );75 bool psphotBasicDeblendReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index);76 77 bool psphotRoughClass (pmConfig *config, const pmFPAview *view );78 bool psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);56 bool psphotSetMaskAndVariance (pmConfig *config, const pmFPAview *view, const char *filerule); 57 bool psphotSetMaskAndVarianceReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 58 59 bool psphotModelBackground (pmConfig *config, const pmFPAview *view, const char *filerule); 60 bool psphotModelBackgroundReadoutFileIndex (pmConfig *config, const pmFPAview *view, const char *filerule, int index); 61 62 bool psphotSubtractBackground (pmConfig *config, const pmFPAview *view, const char *filerule); 63 bool psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 64 65 bool psphotFindDetections (pmConfig *config, const pmFPAview *view, const char *filerule, bool firstPass); 66 bool psphotFindDetectionsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool firstPass); 67 68 bool psphotSourceStats (pmConfig *config, const pmFPAview *view, const char *filerule, bool setWindow); 69 bool psphotSourceStatsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool setWindow); 70 71 bool psphotDeblendSatstars (pmConfig *config, const pmFPAview *view, const char *filerule); 72 bool psphotDeblendSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index); 73 74 bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view, const char *filerule); 75 bool psphotBasicDeblendReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index); 76 77 bool psphotRoughClass (pmConfig *config, const pmFPAview *view, const char *filerule); 78 bool psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 79 79 bool psphotRoughClassRegion (int nRegion, psRegion *region, psArray *sources, psMetadata *analysis, psMetadata *recipe, const bool havePSF); 80 80 81 bool psphotImageQuality (pmConfig *config, const pmFPAview *view );82 bool psphotImageQualityReadout(pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);83 84 bool psphotChoosePSF (pmConfig *config, const pmFPAview *view );85 bool psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);86 87 bool psphotGuessModels (pmConfig *config, const pmFPAview *view );88 bool psphotGuessModelsReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index);89 90 bool psphotMergeSources (pmConfig *config, const pmFPAview *view );91 bool psphotMergeSourcesReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index);92 93 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, bool final);81 bool psphotImageQuality (pmConfig *config, const pmFPAview *view, const char *filerule); 82 bool psphotImageQualityReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 83 84 bool psphotChoosePSF (pmConfig *config, const pmFPAview *view, const char *filerule); 85 bool psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 86 87 bool psphotGuessModels (pmConfig *config, const pmFPAview *view, const char *filerule); 88 bool psphotGuessModelsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index); 89 90 bool psphotMergeSources (pmConfig *config, const pmFPAview *view, const char *filerule); 91 bool psphotMergeSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index); 92 93 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final); 94 94 bool psphotFitSourcesLinearReadout (psMetadata *recipe, pmReadout *readout, psArray *sources, pmPSF *psf, bool final); 95 95 96 bool psphotSourceSize (pmConfig *config, const pmFPAview *view, bool getPSFsize);97 bool psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe, bool getPSFsize);98 99 bool psphotBlendFit (pmConfig *config, const pmFPAview *view );100 bool psphotBlendFitReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);96 bool psphotSourceSize (pmConfig *config, const pmFPAview *view, const char *filerule, bool getPSFsize); 97 bool psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool getPSFsize); 98 99 bool psphotBlendFit (pmConfig *config, const pmFPAview *view, const char *filerule); 100 bool psphotBlendFitReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 101 101 bool psphotBlendFit_Threaded (psThreadJob *job); 102 102 103 bool psphotReplaceAllSources (pmConfig *config, const pmFPAview *view );104 bool psphotReplaceAllSourcesReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);105 106 bool psphotAddNoise (pmConfig *config, const pmFPAview *view );107 bool psphotSubNoise (pmConfig *config, const pmFPAview *view );108 bool psphotAddOrSubNoise (pmConfig *config, const pmFPAview *view, bool add);109 bool psphotAddOrSubNoiseReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe, bool add);110 111 bool psphotExtendedSourceAnalysis (pmConfig *config, const pmFPAview *view );112 bool psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);113 114 bool psphotExtendedSourceFits (pmConfig *config, const pmFPAview *view );115 bool psphotExtendedSourceFitsReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);116 117 bool psphotApResid (pmConfig *config, const pmFPAview *view );118 bool psphotApResidReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);119 120 bool psphotMagnitudes (pmConfig *config, const pmFPAview *view );103 bool psphotReplaceAllSources (pmConfig *config, const pmFPAview *view, const char *filerule); 104 bool psphotReplaceAllSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 105 106 bool psphotAddNoise (pmConfig *config, const pmFPAview *view, const char *filerule); 107 bool psphotSubNoise (pmConfig *config, const pmFPAview *view, const char *filerule); 108 bool psphotAddOrSubNoise (pmConfig *config, const pmFPAview *view, const char *filerule, bool add); 109 bool psphotAddOrSubNoiseReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool add); 110 111 bool psphotExtendedSourceAnalysis (pmConfig *config, const pmFPAview *view, const char *filerule); 112 bool psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 113 114 bool psphotExtendedSourceFits (pmConfig *config, const pmFPAview *view, const char *filerule); 115 bool psphotExtendedSourceFitsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 116 117 bool psphotApResid (pmConfig *config, const pmFPAview *view, const char *filerule); 118 bool psphotApResidReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 119 120 bool psphotMagnitudes (pmConfig *config, const pmFPAview *view, const char *filerule); 121 121 bool psphotMagnitudesReadout(pmConfig *config, psMetadata *recipe, const pmFPAview *view, pmReadout *readout, psArray *sources, pmPSF *psf); 122 122 bool psphotMagnitudes_Threaded (psThreadJob *job); 123 123 124 bool psphotEfficiency (pmConfig *config, const pmFPAview *view );125 bool psphotEfficiencyReadout(pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe);124 bool psphotEfficiency (pmConfig *config, const pmFPAview *view, const char *filerule); 125 bool psphotEfficiencyReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe); 126 126 127 127 bool psphotPSFWeights(pmConfig *config, pmReadout *readout, const pmFPAview *view, psArray *sources); 128 128 bool psphotPSFWeights_Threaded (psThreadJob *job); 129 129 130 bool psphotSkyReplace (pmConfig *config, const pmFPAview *view );131 bool psphotSkyReplaceReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index);132 133 bool psphotSourceFreePixels (pmConfig *config, const pmFPAview *view );134 bool psphotSourceFreePixelsReadout(pmConfig *config, const pmFPAview *view, const char *file name, int index);130 bool psphotSkyReplace (pmConfig *config, const pmFPAview *view, const char *filerule); 131 bool psphotSkyReplaceReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index); 132 133 bool psphotSourceFreePixels (pmConfig *config, const pmFPAview *view, const char *filerule); 134 bool psphotSourceFreePixelsReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index); 135 135 136 136 // in psphotSourceStats.c: … … 147 147 148 148 // in psphotMergeSources.c: 149 bool psphotLoadExtSources (pmConfig *config, const pmFPAview *view );149 bool psphotLoadExtSources (pmConfig *config, const pmFPAview *view, const char *filerule); 150 150 psArray *psphotLoadPSFSources (pmConfig *config, const pmFPAview *view); 151 bool psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view );152 bool psphotCheckExtSources (pmConfig *config, const pmFPAview *view );151 bool psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view, const char *filerule); 152 bool psphotCheckExtSources (pmConfig *config, const pmFPAview *view, const char *filerule); 153 153 154 154 // generate the detection structure for the supplied array of sources 155 bool psphotDetectionsFromSources (pmConfig *config, const pmFPAview *view, psArray *sources);155 bool psphotDetectionsFromSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *sources); 156 156 157 157 // generate the detection structure for the supplied array of sources … … 349 349 bool psphotStackImageLoop (pmConfig *config); 350 350 bool psphotStackReadout (pmConfig *config, const pmFPAview *view); 351 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view );351 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view, const char *filerule); 352 352 bool psphotStackChisqImageAddReadout(const pmConfig *config, // Configuration 353 353 const pmFPAview *view, 354 const char *filename, 354 355 pmReadout **chiReadout, 355 char *filename,356 356 int index); 357 357 358 bool psphotStackRemoveChisqFromInputs (pmConfig *config );358 bool psphotStackRemoveChisqFromInputs (pmConfig *config, const char *filerule); 359 359 bool pmFPAfileRemoveSingle(psMetadata *files, const char *name, int num); 360 360 361 psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view );362 bool psphotMatchSourcesReadout (psArray *objects, pmConfig *config, const pmFPAview *view, c har *filename, int index);361 psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view, const char *filerule); 362 bool psphotMatchSourcesReadout (psArray *objects, pmConfig *config, const pmFPAview *view, const char *filerule, int index); 363 363 bool psphotMatchSourcesToObjects (psArray *objects, psArray *sources, float RADIUS); 364 364 -
branches/eam_branches/psphot.20100506/src/psphotAddNoise.c
r26894 r27909 1 1 # include "psphotInternal.h" 2 2 3 bool psphotAddNoise (pmConfig *config, const pmFPAview *view ) {4 return psphotAddOrSubNoise (config, view, true);3 bool psphotAddNoise (pmConfig *config, const pmFPAview *view, const char *filerule) { 4 return psphotAddOrSubNoise (config, view, filerule, true); 5 5 } 6 6 7 bool psphotSubNoise (pmConfig *config, const pmFPAview *view ) {8 return psphotAddOrSubNoise (config, view, f alse);7 bool psphotSubNoise (pmConfig *config, const pmFPAview *view, const char *filerule) { 8 return psphotAddOrSubNoise (config, view, filerule, false); 9 9 } 10 10 11 11 // for now, let's store the detections on the readout->analysis for each readout 12 bool psphotAddOrSubNoise (pmConfig *config, const pmFPAview *view, bool add)12 bool psphotAddOrSubNoise (pmConfig *config, const pmFPAview *view, const char *filerule, bool add) 13 13 { 14 14 bool status = true; … … 23 23 // loop over the available readouts 24 24 for (int i = 0; i < num; i++) { 25 if (!psphotAddOrSubNoiseReadout (config, view, "PSPHOT.INPUT", i, recipe, add)) {26 psError (PSPHOT_ERR_CONFIG, false, "failed on to modify noise for PSPHOT.INPUT entry %d", i);25 if (!psphotAddOrSubNoiseReadout (config, view, filerule, i, recipe, add)) { 26 psError (PSPHOT_ERR_CONFIG, false, "failed on to modify noise for %s entry %d", filerule, i); 27 27 return false; 28 28 } … … 31 31 } 32 32 33 bool psphotAddOrSubNoiseReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe, bool add) {33 bool psphotAddOrSubNoiseReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool add) { 34 34 35 35 bool status = false; … … 39 39 40 40 // find the currently selected readout 41 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest41 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 42 42 psAssert (file, "missing file?"); 43 43 -
branches/eam_branches/psphot.20100506/src/psphotApResid.c
r27657 r27909 5 5 6 6 // for now, let's store the detections on the readout->analysis for each readout 7 bool psphotApResid (pmConfig *config, const pmFPAview *view )7 bool psphotApResid (pmConfig *config, const pmFPAview *view, const char *filerule) 8 8 { 9 9 bool status = true; … … 23 23 for (int i = 0; i < num; i++) { 24 24 if (i == chisqNum) continue; // skip chisq image 25 if (!psphotApResidReadout (config, view, "PSPHOT.INPUT", i, recipe)) {26 psError (PSPHOT_ERR_CONFIG, false, "failed to measure aperture residual for PSPHOT.INPUT entry %d", i);25 if (!psphotApResidReadout (config, view, filerule, i, recipe)) { 26 psError (PSPHOT_ERR_CONFIG, false, "failed to measure aperture residual for %s entry %d", filerule, i); 27 27 return false; 28 28 } … … 31 31 } 32 32 33 bool psphotApResidReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe)33 bool psphotApResidReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) 34 34 { 35 35 int Nfail = 0; … … 43 43 44 44 // find the currently selected readout 45 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest45 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 46 46 psAssert (file, "missing file?"); 47 47 -
branches/eam_branches/psphot.20100506/src/psphotBasicDeblend.c
r26894 r27909 2 2 3 3 // for now, let's store the detections on the readout->analysis for each readout 4 bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view )4 bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view, const char *filerule) 5 5 { 6 6 bool status = true; … … 11 11 // loop over the available readouts 12 12 for (int i = 0; i < num; i++) { 13 if (!psphotBasicDeblendReadout (config, view, "PSPHOT.INPUT", i)) {14 psError (PSPHOT_ERR_CONFIG, false, "failed on basic deblend analysis for PSPHOT.INPUT entry %d", i);13 if (!psphotBasicDeblendReadout (config, view, filerule, i)) { 14 psError (PSPHOT_ERR_CONFIG, false, "failed on basic deblend analysis for %s entry %d", filerule, i); 15 15 return false; 16 16 } … … 19 19 } 20 20 21 bool psphotBasicDeblendReadout (pmConfig *config, const pmFPAview *view, const char *file name, int fileIndex) {21 bool psphotBasicDeblendReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int fileIndex) { 22 22 23 23 int N; … … 31 31 32 32 // find the currently selected readout 33 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, fileIndex); // File of interest33 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, fileIndex); // File of interest 34 34 psAssert (file, "missing file?"); 35 35 -
branches/eam_branches/psphot.20100506/src/psphotBlendFit.c
r26894 r27909 2 2 3 3 // for now, let's store the detections on the readout->analysis for each readout 4 bool psphotBlendFit (pmConfig *config, const pmFPAview *view )4 bool psphotBlendFit (pmConfig *config, const pmFPAview *view, const char *filerule) 5 5 { 6 6 bool status = true; … … 15 15 // loop over the available readouts 16 16 for (int i = 0; i < num; i++) { 17 if (!psphotBlendFitReadout (config, view, "PSPHOT.INPUT", i, recipe)) {18 psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (non-linear) for PSPHOT.INPUT entry %d", i);17 if (!psphotBlendFitReadout (config, view, filerule, i, recipe)) { 18 psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (non-linear) for %s entry %d", filerule, i); 19 19 return false; 20 20 } … … 24 24 25 25 // XXX I don't like this name 26 bool psphotBlendFitReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe) {26 bool psphotBlendFitReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) { 27 27 28 28 int Nfit = 0; … … 35 35 36 36 // find the currently selected readout 37 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest37 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 38 38 psAssert (file, "missing file?"); 39 39 -
branches/eam_branches/psphot.20100506/src/psphotChoosePSF.c
r27657 r27909 2 2 3 3 // generate a PSF model for inputs without PSF models already loaded 4 bool psphotChoosePSF (pmConfig *config, const pmFPAview *view )4 bool psphotChoosePSF (pmConfig *config, const pmFPAview *view, const char *filerule) 5 5 { 6 6 bool status = true; … … 20 20 for (int i = 0; i < num; i++) { 21 21 if (i == chisqNum) continue; // skip chisq image 22 if (!psphotChoosePSFReadout (config, view, "PSPHOT.INPUT", i, recipe)) {23 psError (PSPHOT_ERR_CONFIG, false, "failed to choose a psf model for PSPHOT.INPUT entry %d", i);22 if (!psphotChoosePSFReadout (config, view, filerule, i, recipe)) { 23 psError (PSPHOT_ERR_CONFIG, false, "failed to choose a psf model for %s entry %d", filerule, i); 24 24 return false; 25 25 } … … 29 29 30 30 // try PSF models and select best option 31 bool psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe) {31 bool psphotChoosePSFReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) { 32 32 33 33 bool status; … … 36 36 37 37 // find the currently selected readout 38 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest38 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 39 39 psAssert (file, "missing file?"); 40 40 -
branches/eam_branches/psphot.20100506/src/psphotDeblendSatstars.c
r26894 r27909 2 2 3 3 // for now, let's store the detections on the readout->analysis for each readout 4 bool psphotDeblendSatstars (pmConfig *config, const pmFPAview *view )4 bool psphotDeblendSatstars (pmConfig *config, const pmFPAview *view, const char *filerule) 5 5 { 6 6 bool status = true; … … 11 11 // loop over the available readouts 12 12 for (int i = 0; i < num; i++) { 13 if (!psphotDeblendSatstarsReadout (config, view, "PSPHOT.INPUT", i)) {14 psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for PSPHOT.INPUT entry %d", i);13 if (!psphotDeblendSatstarsReadout (config, view, filerule, i)) { 14 psError (PSPHOT_ERR_CONFIG, false, "failed on saturated star deblend analysis for %s entry %d", filerule, i); 15 15 return false; 16 16 } … … 19 19 } 20 20 21 bool psphotDeblendSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *file name, int fileIndex) {21 bool psphotDeblendSatstarsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int fileIndex) { 22 22 23 23 int N; … … 31 31 32 32 // find the currently selected readout 33 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, fileIndex); // File of interest33 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, fileIndex); // File of interest 34 34 psAssert (file, "missing file?"); 35 35 -
branches/eam_branches/psphot.20100506/src/psphotEfficiency.c
r27657 r27909 149 149 } 150 150 151 bool psphotEfficiency (pmConfig *config, const pmFPAview *view )151 bool psphotEfficiency (pmConfig *config, const pmFPAview *view, const char *filerule) 152 152 { 153 153 bool status = true; … … 167 167 for (int i = 0; i < num; i++) { 168 168 if (i == chisqNum) continue; // skip chisq image 169 if (!psphotEfficiencyReadout (config, view, "PSPHOT.INPUT", i, recipe)) {170 psError (PSPHOT_ERR_CONFIG, false, "failed to measure detection efficiency for PSPHOT.INPUT entry %d", i);169 if (!psphotEfficiencyReadout (config, view, filerule, i, recipe)) { 170 psError (PSPHOT_ERR_CONFIG, false, "failed to measure detection efficiency for %s entry %d", filerule, i); 171 171 return false; 172 172 } … … 176 176 177 177 // Determine detection efficiency 178 bool psphotEfficiencyReadout(pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe)178 bool psphotEfficiencyReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) 179 179 { 180 180 bool status = true; … … 183 183 184 184 // find the currently selected readout 185 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest185 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 186 186 psAssert (file, "missing file?"); 187 187 -
branches/eam_branches/psphot.20100506/src/psphotExtendedSourceAnalysis.c
r27819 r27909 2 2 3 3 // for now, let's store the detections on the readout->analysis for each readout 4 bool psphotExtendedSourceAnalysis (pmConfig *config, const pmFPAview *view )4 bool psphotExtendedSourceAnalysis (pmConfig *config, const pmFPAview *view, const char *filerule) 5 5 { 6 6 bool status = true; … … 21 21 // loop over the available readouts 22 22 for (int i = 0; i < num; i++) { 23 if (!psphotExtendedSourceAnalysisReadout (config, view, "PSPHOT.INPUT", i, recipe)) {24 psError (PSPHOT_ERR_CONFIG, false, "failed on measure extended source aperture-like parameters for PSPHOT.INPUT entry %d", i);23 if (!psphotExtendedSourceAnalysisReadout (config, view, filerule, i, recipe)) { 24 psError (PSPHOT_ERR_CONFIG, false, "failed on measure extended source aperture-like parameters for %s entry %d", filerule, i); 25 25 return false; 26 26 } … … 30 30 31 31 // aperture-like measurements for extended sources 32 bool psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe) {32 bool psphotExtendedSourceAnalysisReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) { 33 33 34 34 bool status; … … 42 42 43 43 // find the currently selected readout 44 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest44 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 45 45 psAssert (file, "missing file?"); 46 46 -
branches/eam_branches/psphot.20100506/src/psphotExtendedSourceFits.c
r26894 r27909 2 2 3 3 // for now, let's store the detections on the readout->analysis for each readout 4 bool psphotExtendedSourceFits (pmConfig *config, const pmFPAview *view )4 bool psphotExtendedSourceFits (pmConfig *config, const pmFPAview *view, const char *filerule) 5 5 { 6 6 bool status = true; … … 21 21 // loop over the available readouts 22 22 for (int i = 0; i < num; i++) { 23 if (!psphotExtendedSourceFitsReadout (config, view, "PSPHOT.INPUT", i, recipe)) {24 psError (PSPHOT_ERR_CONFIG, false, "failed on to fit extended sources for PSPHOT.INPUT entry %d", i);23 if (!psphotExtendedSourceFitsReadout (config, view, filerule, i, recipe)) { 24 psError (PSPHOT_ERR_CONFIG, false, "failed on to fit extended sources for %s entry %d", filerule, i); 25 25 return false; 26 26 } … … 30 30 31 31 // non-linear model fitting for extended sources 32 bool psphotExtendedSourceFitsReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe) {32 bool psphotExtendedSourceFitsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) { 33 33 34 34 bool status; … … 41 41 42 42 // find the currently selected readout 43 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest43 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 44 44 psAssert (file, "missing file?"); 45 45 -
branches/eam_branches/psphot.20100506/src/psphotFindDetections.c
r26894 r27909 4 4 // peaks and new footprints. any old peaks are saved on oldPeaks. the resulting footprint set 5 5 // contains all footprints (old and new) 6 bool psphotFindDetections (pmConfig *config, const pmFPAview *view, bool firstPass)6 bool psphotFindDetections (pmConfig *config, const pmFPAview *view, const char *filerule, bool firstPass) 7 7 { 8 8 bool status = true; … … 17 17 // loop over the available readouts 18 18 for (int i = 0; i < num; i++) { 19 if (!psphotFindDetectionsReadout (config, view, "PSPHOT.INPUT", i, recipe, firstPass)) {20 psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for PSPHOT.INPUT entry %d", i);19 if (!psphotFindDetectionsReadout (config, view, filerule, i, recipe, firstPass)) { 20 psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for %s entry %d", filerule, i); 21 21 return false; 22 22 } … … 26 26 27 27 // smooth the image, search for peaks, optionally define footprints based on the peaks 28 bool psphotFindDetectionsReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe, bool firstPass) {28 bool psphotFindDetectionsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool firstPass) { 29 29 30 30 bool status; … … 34 34 35 35 // find the currently selected readout 36 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest36 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 37 37 psAssert (file, "missing file?"); 38 38 -
branches/eam_branches/psphot.20100506/src/psphotFitSourcesLinear.c
r27532 r27909 13 13 14 14 // for now, let's store the detections on the readout->analysis for each readout 15 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, bool final)15 bool psphotFitSourcesLinear (pmConfig *config, const pmFPAview *view, const char *filerule, bool final) 16 16 { 17 17 bool status = true; … … 28 28 29 29 // find the currently selected readout 30 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", i); // File of interest30 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest 31 31 psAssert (file, "missing file?"); 32 32 … … 44 44 45 45 if (!psphotFitSourcesLinearReadout (recipe, readout, sources, psf, final)) { 46 psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for PSPHOT.INPUT entry %d", i);46 psError (PSPHOT_ERR_CONFIG, false, "failed to fit sources (linear) for %s entry %d", filerule, i); 47 47 return false; 48 48 } -
branches/eam_branches/psphot.20100506/src/psphotForcedReadout.c
r27314 r27909 20 20 21 21 // set the photcode for this image 22 if (!psphotAddPhotcode (config, view )) {22 if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) { 23 23 psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 24 24 return false; … … 30 30 31 31 // Generate the mask and weight images, including the user-defined analysis region of interest 32 psphotSetMaskAndVariance (config, view );32 psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT"); 33 33 if (!strcasecmp (breakPt, "NOTHING")) { 34 return psphotReadoutCleanup (config, view);34 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 35 35 } 36 36 37 37 // generate a background model (median, smoothed image) 38 if (!psphotModelBackground (config, view )) {39 return psphotReadoutCleanup (config, view );38 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) { 39 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 40 40 } 41 if (!psphotSubtractBackground (config, view )) {42 return psphotReadoutCleanup (config, view );41 if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) { 42 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 43 43 } 44 44 if (!strcasecmp (breakPt, "BACKMDL")) { 45 return psphotReadoutCleanup (config, view );45 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 46 46 } 47 47 … … 49 49 // this only happens if we had a programming error in psphotLoadPSF 50 50 psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model"); 51 return psphotReadoutCleanup (config, view );51 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 52 52 } 53 53 54 54 // include externally-supplied sources 55 psphotLoadExtSources (config, view );55 psphotLoadExtSources (config, view, "PSPHOT.INPUT"); 56 56 57 57 // construct an initial model for each object, set the radius to fitRadius, set circular fit mask 58 psphotGuessModels (config, view );58 psphotGuessModels (config, view, "PSPHOT.INPUT"); 59 59 60 60 // merge the newly selected sources into the existing list 61 61 // NOTE: merge OLD and NEW 62 psphotMergeSources (config, view );62 psphotMergeSources (config, view, "PSPHOT.INPUT"); 63 63 64 64 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 65 psphotFitSourcesLinear (config, view, false);65 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); 66 66 67 67 // identify CRs and extended sources … … 71 71 72 72 // calculate source magnitudes 73 psphotMagnitudes(config, view );73 psphotMagnitudes(config, view, "PSPHOT.INPUT"); 74 74 75 75 // XXX do I want to do this? … … 80 80 81 81 // replace background in residual image 82 psphotSkyReplace (config, view );82 psphotSkyReplace (config, view, "PSPHOT.INPUT"); 83 83 84 84 // drop the references to the image pixels held by each source 85 psphotSourceFreePixels (config, view );85 psphotSourceFreePixels (config, view, "PSPHOT.INPUT"); 86 86 87 87 // create the exported-metadata and free local data 88 return psphotReadoutCleanup (config, view);88 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 89 89 } -
branches/eam_branches/psphot.20100506/src/psphotGuessModels.c
r27657 r27909 8 8 9 9 // for now, let's store the detections on the readout->analysis for each readout 10 bool psphotGuessModels (pmConfig *config, const pmFPAview *view )10 bool psphotGuessModels (pmConfig *config, const pmFPAview *view, const char *filerule) 11 11 { 12 12 bool status = true; … … 22 22 for (int i = 0; i < num; i++) { 23 23 if (i == chisqNum) continue; // skip chisq image 24 if (!psphotGuessModelsReadout (config, view, "PSPHOT.INPUT", i)) {25 psError (PSPHOT_ERR_CONFIG, false, "failed on to guess models for PSPHOT.INPUT entry %d", i);24 if (!psphotGuessModelsReadout (config, view, filerule, i)) { 25 psError (PSPHOT_ERR_CONFIG, false, "failed on to guess models for %s entry %d", filerule, i); 26 26 return false; 27 27 } … … 31 31 32 32 // construct an initial PSF model for each object (new sources only) 33 bool psphotGuessModelsReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index) {33 bool psphotGuessModelsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) { 34 34 35 35 bool status; … … 38 38 39 39 // find the currently selected readout 40 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest40 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 41 41 psAssert (file, "missing file?"); 42 42 -
branches/eam_branches/psphot.20100506/src/psphotImageQuality.c
r27657 r27909 5 5 6 6 // for now, let's store the detections on the readout->analysis for each readout 7 bool psphotImageQuality (pmConfig *config, const pmFPAview *view )7 bool psphotImageQuality (pmConfig *config, const pmFPAview *view, const char *filerule) 8 8 { 9 9 bool status = true; … … 23 23 for (int i = 0; i < num; i++) { 24 24 if (i == chisqNum) continue; // skip chisq image 25 if (!psphotImageQualityReadout (config, view, "PSPHOT.INPUT", i, recipe)) {26 psError (PSPHOT_ERR_CONFIG, false, "failed on to measure image quality for PSPHOT.INPUT entry %d", i);25 if (!psphotImageQualityReadout (config, view, filerule, i, recipe)) { 26 psError (PSPHOT_ERR_CONFIG, false, "failed on to measure image quality for %s entry %d", filerule, i); 27 27 return false; 28 28 } … … 32 32 33 33 // selecting the 'good' stars (likely to be psf stars), measure the M_cn, M_sn terms for n = 2,3,4 34 bool psphotImageQualityReadout(pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe)34 bool psphotImageQualityReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) 35 35 { 36 36 bool status = true; 37 37 38 38 // find the currently selected readout 39 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest39 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 40 40 psAssert (file, "missing file?"); 41 41 -
branches/eam_branches/psphot.20100506/src/psphotMagnitudes.c
r27657 r27909 1 1 # include "psphotInternal.h" 2 2 3 bool psphotMagnitudes (pmConfig *config, const pmFPAview *view )3 bool psphotMagnitudes (pmConfig *config, const pmFPAview *view, const char *filerule) 4 4 { 5 5 bool status = true; … … 21 21 22 22 // find the currently selected readout 23 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", i); // File of interest23 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest 24 24 psAssert (file, "missing file?"); 25 25 … … 37 37 38 38 if (!psphotMagnitudesReadout (config, recipe, view, readout, sources, psf)) { 39 psError (PSPHOT_ERR_CONFIG, false, "failed to measure magnitudes for PSPHOT.INPUT entry %d", i);39 psError (PSPHOT_ERR_CONFIG, false, "failed to measure magnitudes for %s entry %d", filerule, i); 40 40 return false; 41 41 } -
branches/eam_branches/psphot.20100506/src/psphotMakePSFReadout.c
r26894 r27909 19 19 20 20 // set the photcode for this image 21 if (!psphotAddPhotcode (config, view )) {21 if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) { 22 22 psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 23 23 return false; … … 29 29 30 30 // Generate the mask and weight images, including the user-defined analysis region of interest 31 psphotSetMaskAndVariance (config, view );31 psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT"); 32 32 if (!strcasecmp (breakPt, "NOTHING")) { 33 return psphotReadoutCleanup (config, view);33 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 34 34 } 35 35 36 36 // generate a background model (median, smoothed image) 37 if (!psphotModelBackground (config, view )) {38 return psphotReadoutCleanup (config, view );37 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) { 38 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 39 39 } 40 if (!psphotSubtractBackground (config, view )) {41 return psphotReadoutCleanup (config, view );40 if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) { 41 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 42 42 } 43 43 if (!strcasecmp (breakPt, "BACKMDL")) { 44 return psphotReadoutCleanup (config, view );44 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 45 45 } 46 46 47 psphotLoadExtSources (config, view );47 psphotLoadExtSources (config, view, "PSPHOT.INPUT"); 48 48 49 49 // If sources have been supplied, then these should be used to measure the PSF include … … 53 53 // a text file have no valid SN values, but psphotChoosePSF needs to select the top 54 54 // PSF_MAX_NSTARS to generate the PSF. 55 if (!psphotCheckExtSources (config, view )) {55 if (!psphotCheckExtSources (config, view, "PSPHOT.INPUT")) { 56 56 psLogMsg ("psphot", 3, "failure to select possible PSF sources (external or internal)"); 57 return psphotReadoutCleanup (config, view );57 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 58 58 } 59 59 60 60 // Use bright stellar objects to measure PSF. If we do not have enough stars to generate 61 61 // the PSF, build one from the SEEING guess and model class 62 if (!psphotChoosePSF (config, view )) {62 if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) { 63 63 psLogMsg ("psphot", 3, "failure to construct a psf model"); 64 return psphotReadoutCleanup (config, view );64 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 65 65 } 66 66 67 67 // measure aperture photometry corrections 68 68 # if 0 69 if (!psphotApResid (config, view )) {69 if (!psphotApResid (config, view, "PSPHOT.INPUT")) { 70 70 psLogMsg ("psphot", 3, "failed on psphotApResid"); 71 return psphotReadoutCleanup (config, view );71 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 72 72 } 73 73 # endif 74 74 75 return psphotReadoutCleanup (config, view );75 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 76 76 } -
branches/eam_branches/psphot.20100506/src/psphotMaskReadout.c
r26894 r27909 1 1 # include "psphotInternal.h" 2 2 3 bool psphotSetMaskAndVariance (pmConfig *config, const pmFPAview *view ) {3 bool psphotSetMaskAndVariance (pmConfig *config, const pmFPAview *view, const char *filerule) { 4 4 5 5 bool status = false; … … 16 16 17 17 // Generate the mask and weight images, including the user-defined analysis region of interest 18 if (!psphotSetMaskAndVarianceReadout (config, view, "PSPHOT.INPUT", i, recipe)) {18 if (!psphotSetMaskAndVarianceReadout (config, view, filerule, i, recipe)) { 19 19 psError (PSPHOT_ERR_CONFIG, false, "failed to generate mask for PSPHOT.INPUT entry %d", i); 20 20 return false; … … 25 25 26 26 // generate mask and variance if not defined, additional mask for restricted subregion 27 bool psphotSetMaskAndVarianceReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe) {27 bool psphotSetMaskAndVarianceReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) { 28 28 29 29 bool status; 30 30 31 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", index); // File of interest31 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 32 32 psAssert (file, "missing file?"); 33 33 -
branches/eam_branches/psphot.20100506/src/psphotMergeSources.c
r27657 r27909 6 6 7 7 // for now, let's store the detections on the readout->analysis for each readout 8 bool psphotMergeSources (pmConfig *config, const pmFPAview *view )8 bool psphotMergeSources (pmConfig *config, const pmFPAview *view, const char *filerule) 9 9 { 10 10 bool status = true; … … 15 15 // loop over the available readouts 16 16 for (int i = 0; i < num; i++) { 17 if (!psphotMergeSourcesReadout (config, view, "PSPHOT.INPUT", i)) {18 psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for PSPHOT.INPUT entry %d", i);17 if (!psphotMergeSourcesReadout (config, view, filerule, i)) { 18 psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for %s entry %d", filerule, i); 19 19 return false; 20 20 } … … 24 24 25 25 // add newly selected sources to the existing list of sources 26 bool psphotMergeSourcesReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index) {26 bool psphotMergeSourcesReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) { 27 27 28 28 bool status; 29 29 30 30 // find the currently selected readout 31 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest31 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 32 32 psAssert (file, "missing file?"); 33 33 … … 71 71 // only expect a single entry for PSPHOT.INPUT.CMF and PSPHOT.SOURCES.TEXT, so we can only 72 72 // associate input sources with a single entry for PSPHOT.INPUT 73 bool psphotLoadExtSources (pmConfig *config, const pmFPAview *view ) {73 bool psphotLoadExtSources (pmConfig *config, const pmFPAview *view, const char *filerule) { 74 74 75 75 bool status; … … 79 79 80 80 // find the currently selected readout 81 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", index); // File of interest81 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 82 82 psAssert (file, "missing file?"); 83 83 … … 130 130 // load data from input TXT file: 131 131 { 132 pmChip *chipTXT = pmFPAfileThisChip (config->files, view, "PSPHOT.INPUT");132 pmChip *chipTXT = pmFPAfileThisChip (config->files, view, filerule); 133 133 if (!chipTXT) goto finish; 134 134 … … 167 167 168 168 // extract the input sources corresponding to this readout 169 // XXX this function needs to be updated to work with the new context of ps hot inputs169 // XXX this function needs to be updated to work with the new context of psphot inputs 170 170 psArray *psphotLoadPSFSources (pmConfig *config, const pmFPAview *view) { 171 171 … … 197 197 // psphotDetectionsFromSources to psphotSourceStats and are now stored on 198 198 // detections->newSources. 199 bool psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view ) {200 201 // find the currently selected readout 202 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", 0); // File of interest199 bool psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view, const char *filerule) { 200 201 // find the currently selected readout 202 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // File of interest 203 203 psAssert (file, "missing file?"); 204 204 … … 227 227 // generate the detection structure for the supplied array of sources 228 228 // XXX this currently assumes there is a single input file 229 bool psphotDetectionsFromSources (pmConfig *config, const pmFPAview *view, psArray *sources) {230 231 // find the currently selected readout 232 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", 0); // File of interest229 bool psphotDetectionsFromSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *sources) { 230 231 // find the currently selected readout 232 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // File of interest 233 233 psAssert (file, "missing file?"); 234 234 … … 335 335 } 336 336 337 bool psphotCheckExtSources (pmConfig *config, const pmFPAview *view ) {337 bool psphotCheckExtSources (pmConfig *config, const pmFPAview *view, const char *filerule) { 338 338 339 339 bool status; … … 343 343 344 344 // find the currently selected readout 345 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", 0); // File of interest345 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // File of interest 346 346 psAssert (file, "missing file?"); 347 347 … … 373 373 374 374 // find the detections (by peak and/or footprint) in the image. 375 if (!psphotFindDetections (config, view, true)) {375 if (!psphotFindDetections (config, view, filerule, true)) { 376 376 psError(PSPHOT_ERR_CONFIG, false, "unable to find detections in this image"); 377 return psphotReadoutCleanup (config, view );377 return psphotReadoutCleanup (config, view, filerule); 378 378 } 379 379 380 380 // construct sources and measure basic stats 381 psphotSourceStats (config, view, true);381 psphotSourceStats (config, view, filerule, true); 382 382 383 383 // find blended neighbors of very saturated stars 384 psphotDeblendSatstars (config, view );384 psphotDeblendSatstars (config, view, filerule); 385 385 386 386 // mark blended peaks PS_SOURCE_BLEND 387 if (!psphotBasicDeblend (config, view )) {387 if (!psphotBasicDeblend (config, view, filerule)) { 388 388 psLogMsg ("psphot", 3, "failed on deblend analysis"); 389 return psphotReadoutCleanup (config, view );389 return psphotReadoutCleanup (config, view, filerule); 390 390 } 391 391 392 392 // classify sources based on moments, brightness 393 if (!psphotRoughClass (config, view )) {393 if (!psphotRoughClass (config, view, filerule)) { 394 394 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 395 return psphotReadoutCleanup (config, view );396 } 397 } 398 399 return true; 400 } 395 return psphotReadoutCleanup (config, view, filerule); 396 } 397 } 398 399 return true; 400 } -
branches/eam_branches/psphot.20100506/src/psphotModelBackground.c
r27657 r27909 384 384 385 385 // XXX supply filename or keep PSPHOT.INPUT fixed? 386 bool psphotModelBackground (pmConfig *config, const pmFPAview *view )386 bool psphotModelBackground (pmConfig *config, const pmFPAview *view, const char *filerule) 387 387 { 388 388 bool status = false; … … 393 393 // loop over the available readouts 394 394 for (int i = 0; i < num; i++) { 395 if (!psphotModelBackgroundReadoutFileIndex(config, view, "PSPHOT.INPUT", i)) {395 if (!psphotModelBackgroundReadoutFileIndex(config, view, filerule, i)) { 396 396 psError (PSPHOT_ERR_CONFIG, false, "failed to model background for PSPHOT.INPUT entry %d", i); 397 397 return false; -
branches/eam_branches/psphot.20100506/src/psphotModelTest.c
r26894 r27909 3 3 4 4 // XXX add more test information? 5 bool psphotModelTest (pmConfig *config, const pmFPAview *view, psMetadata *recipe) {5 bool psphotModelTest (pmConfig *config, const pmFPAview *view, const char *filerule, psMetadata *recipe) { 6 6 7 7 bool status; … … 33 33 34 34 // use poissonian errors or local-sky errors 35 bool POISSON_ERRORS = psMetadataLookupBool (&status, recipe, "POISSON_ERRORS");35 bool POISSON_ERRORS = psMetadataLookupBool (&status, recipe, filerule); 36 36 if (!status) POISSON_ERRORS = true; 37 37 pmSourceFitModelInit (15, 0.1, 1.0, POISSON_ERRORS); -
branches/eam_branches/psphot.20100506/src/psphotOutput.c
r26894 r27909 126 126 } 127 127 128 bool psphotAddPhotcode (pmConfig *config, const pmFPAview *view ) {128 bool psphotAddPhotcode (pmConfig *config, const pmFPAview *view, const char *filerule) { 129 129 130 130 bool status = false; … … 135 135 // loop over the available readouts 136 136 for (int i = 0; i < num; i++) { 137 if (!psphotAddPhotcodeReadout (config, view, "PSPHOT.INPUT", i)) {137 if (!psphotAddPhotcodeReadout (config, view, filerule, i)) { 138 138 psError (PSPHOT_ERR_CONFIG, false, "failed to add photcode to PSPHOT.INPUT entry %d", i); 139 139 return false; -
branches/eam_branches/psphot.20100506/src/psphotReadout.c
r27657 r27909 28 28 29 29 // set the photcode for this image 30 if (!psphotAddPhotcode (config, view )) {30 if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) { 31 31 psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 32 32 return false; … … 34 34 35 35 // Generate the mask and weight images, including the user-defined analysis region of interest 36 if (!psphotSetMaskAndVariance (config, view )) {37 return psphotReadoutCleanup(config, view );36 if (!psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT")) { 37 return psphotReadoutCleanup(config, view, "PSPHOT.INPUT"); 38 38 } 39 39 if (!strcasecmp (breakPt, "NOTHING")) { 40 return psphotReadoutCleanup (config, view);40 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 41 41 } 42 42 43 43 // generate a background model (median, smoothed image) 44 if (!psphotModelBackground (config, view )) {45 return psphotReadoutCleanup (config, view );46 } 47 if (!psphotSubtractBackground (config, view )) {48 return psphotReadoutCleanup (config, view );44 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) { 45 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 46 } 47 if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) { 48 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 49 49 } 50 50 if (!strcasecmp (breakPt, "BACKMDL")) { 51 return psphotReadoutCleanup (config, view );51 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 52 52 } 53 53 54 54 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are determined and saved on 55 55 // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT 56 if (!psphotLoadPSF (config, view)) { 56 if (!psphotLoadPSF (config, view)) { // ??? need to supply 2 ? 57 57 psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model"); 58 return psphotReadoutCleanup (config, view );58 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 59 59 } 60 60 61 61 // find the detections (by peak and/or footprint) in the image. 62 if (!psphotFindDetections (config, view, true)) { // pass 162 if (!psphotFindDetections (config, view, "PSPHOT.INPUT", true)) { // pass 1 63 63 // this only happens if we had an error in psphotFindDetections 64 64 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 65 return psphotReadoutCleanup (config, view );65 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 66 66 } 67 67 68 68 // construct sources and measure basic stats (saved on detections->newSources) 69 if (!psphotSourceStats (config, view, true)) { // pass 169 if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) { // pass 1 70 70 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 71 return psphotReadoutCleanup (config, view );71 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 72 72 } 73 73 if (!strcasecmp (breakPt, "PEAKS")) { 74 return psphotReadoutCleanup (config, view);74 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 75 75 } 76 76 77 77 // find blended neighbors of very saturated stars (detections->newSources) 78 if (!psphotDeblendSatstars (config, view )) {78 if (!psphotDeblendSatstars (config, view, "PSPHOT.INPUT")) { 79 79 psError (PSPHOT_ERR_UNKNOWN, false, "failed on satstar deblend analysis"); 80 return psphotReadoutCleanup (config, view );80 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 81 81 } 82 82 83 83 // mark blended peaks PS_SOURCE_BLEND (detections->newSources) 84 if (!psphotBasicDeblend (config, view )) {84 if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) { 85 85 psError (PSPHOT_ERR_UNKNOWN, false, "failed on deblend analysis"); 86 return psphotReadoutCleanup (config, view );86 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 87 87 } 88 88 89 89 // classify sources based on moments, brightness. if a PSF model has been loaded, the PSF 90 90 // clump defined for it is used not measured (detections->newSources) 91 if (!psphotRoughClass (config, view )) { // pass 191 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { // pass 1 92 92 psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough classifications"); 93 return psphotReadoutCleanup (config, view );93 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 94 94 } 95 95 // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources) 96 if (!psphotImageQuality (config, view )) { // pass 196 if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) { // pass 1 97 97 psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality"); 98 return psphotReadoutCleanup (config, view);98 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 99 99 } 100 100 if (!strcasecmp (breakPt, "MOMENTS")) { 101 return psphotReadoutCleanup (config, view);101 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 102 102 } 103 103 104 104 // use bright stellar objects to measure PSF if we were supplied a PSF for any input file, 105 105 // this step is skipped 106 if (!psphotChoosePSF (config, view )) { // pass 1106 if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) { // pass 1 107 107 psLogMsg ("psphot", 3, "failure to construct a psf model"); 108 return psphotReadoutCleanup (config, view );108 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 109 109 } 110 110 if (!strcasecmp (breakPt, "PSFMODEL")) { 111 return psphotReadoutCleanup (config, view );111 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 112 112 } 113 113 114 114 // include externally-supplied sources 115 115 // XXX fix this in the new multi-input context 116 // psphotLoadExtSources (config, view ); // pass 1116 // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1 117 117 118 118 // construct an initial model for each object, set the radius to fitRadius, set circular 119 119 // fit mask (detections->newSources) 120 psphotGuessModels (config, view ); // pass 1120 psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 1 121 121 122 122 // merge the newly selected sources into the existing list 123 123 // NOTE: merge OLD and NEW 124 psphotMergeSources (config, view );124 psphotMergeSources (config, view, "PSPHOT.INPUT"); 125 125 126 126 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 127 psphotFitSourcesLinear (config, view, false); // pass 1 (detections->allSources)127 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); // pass 1 (detections->allSources) 128 128 129 129 // identify CRs and extended sources (only unmeasured sources are measured) 130 psphotSourceSize (config, view, true); // pass 1 (detections->allSources)130 psphotSourceSize (config, view, "PSPHOT.INPUT", true); // pass 1 (detections->allSources) 131 131 if (!strcasecmp (breakPt, "ENSEMBLE")) { 132 132 goto finish; … … 135 135 // non-linear PSF and EXT fit to brighter sources 136 136 // replace model flux, adjust mask as needed, fit, subtract the models (full stamp) 137 psphotBlendFit (config, view ); // pass 1 (detections->allSources)137 psphotBlendFit (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 138 138 139 139 // replace all sources 140 psphotReplaceAllSources (config, view ); // pass 1 (detections->allSources)140 psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 141 141 142 142 // linear fit to include all sources (subtract again) 143 143 // NOTE : apply to ALL sources (extended + psf) 144 psphotFitSourcesLinear (config, view, true); // pass 2 (detections->allSources)144 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 2 (detections->allSources) 145 145 146 146 // if we only do one pass, skip to extended source analysis … … 150 150 151 151 // add noise for subtracted objects 152 psphotAddNoise (config, view ); // pass 1 (detections->allSources)152 psphotAddNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 153 153 154 154 // find fainter sources 155 155 // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections 156 psphotFindDetections (config, view, false); // pass 2 (detections->peaks, detections->footprints)156 psphotFindDetections (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->peaks, detections->footprints) 157 157 158 158 // remove noise for subtracted objects (ie, return to normal noise level) 159 159 // NOTE: this needs to operate only on the OLD sources 160 psphotSubNoise (config, view ); // pass 1 (detections->allSources)160 psphotSubNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 161 161 162 162 // define new sources based on only the new peaks 163 163 // NOTE: new sources are saved on detections->newSources 164 psphotSourceStats (config, view, false); // pass 2 (detections->newSources)164 psphotSourceStats (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->newSources) 165 165 166 166 // set source type 167 167 // NOTE: apply only to detections->newSources 168 if (!psphotRoughClass (config, view )) { // pass 2 (detections->newSources)168 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { // pass 2 (detections->newSources) 169 169 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 170 return psphotReadoutCleanup (config, view );170 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 171 171 } 172 172 173 173 // create full input models, set the radius to fitRadius, set circular fit mask 174 174 // NOTE: apply only to detections->newSources 175 psphotGuessModels (config, view ); // pass 2 (detections->newSources)175 psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 2 (detections->newSources) 176 176 177 177 // replace all sources so fit below applies to all at once 178 178 // NOTE: apply only to OLD sources (which have been subtracted) 179 psphotReplaceAllSources (config, view ); // pass 2179 psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 2 180 180 181 181 // merge the newly selected sources into the existing list 182 182 // NOTE: merge OLD and NEW 183 183 // XXX check on free of sources... 184 psphotMergeSources (config, view ); // (detections->newSources + detections->allSources -> detections->allSources)184 psphotMergeSources (config, view, "PSPHOT.INPUT"); // (detections->newSources + detections->allSources -> detections->allSources) 185 185 186 186 // NOTE: apply to ALL sources 187 psphotFitSourcesLinear (config, view, true); // pass 3 (detections->allSources)187 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 3 (detections->allSources) 188 188 189 189 pass1finish: … … 191 191 // measure source size for the remaining sources 192 192 // NOTE: applies only to NEW (unmeasured) sources 193 psphotSourceSize (config, view, false); // pass 2 (detections->allSources)194 195 psphotExtendedSourceAnalysis (config, view ); // pass 1 (detections->allSources)196 psphotExtendedSourceFits (config, view ); // pass 1 (detections->allSources)193 psphotSourceSize (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->allSources) 194 195 psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 196 psphotExtendedSourceFits (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 197 197 198 198 finish: … … 202 202 203 203 // measure aperture photometry corrections 204 if (!psphotApResid (config, view )) { // pass 1 (detections->allSources)204 if (!psphotApResid (config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources) 205 205 psLogMsg ("psphot", 3, "failed on psphotApResid"); 206 return psphotReadoutCleanup (config, view );206 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 207 207 } 208 208 209 209 // calculate source magnitudes 210 psphotMagnitudes(config, view ); // pass 1 (detections->allSources)211 212 if (!psphotEfficiency(config, view )) { // pass 1210 psphotMagnitudes(config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources) 211 212 if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) { // pass 1 213 213 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 214 214 psErrorClear(); … … 219 219 220 220 // replace background in residual image 221 psphotSkyReplace (config, view ); // pass 1221 psphotSkyReplace (config, view, "PSPHOT.INPUT"); // pass 1 222 222 223 223 // drop the references to the image pixels held by each source 224 psphotSourceFreePixels (config, view ); // pass 1224 psphotSourceFreePixels (config, view, "PSPHOT.INPUT"); // pass 1 225 225 226 226 // create the exported-metadata and free local data 227 return psphotReadoutCleanup(config, view );227 return psphotReadoutCleanup(config, view, "PSPHOT.INPUT"); 228 228 } -
branches/eam_branches/psphot.20100506/src/psphotReadoutCleanup.c
r27657 r27909 2 2 3 3 // for now, let's store the detections on the readout->analysis for each readout 4 bool psphotReadoutCleanup (pmConfig *config, const pmFPAview *view )4 bool psphotReadoutCleanup (pmConfig *config, const pmFPAview *view, const char *filerule) 5 5 { 6 6 bool status = true; … … 24 24 // loop over the available readouts 25 25 for (int i = 0; i < num; i++) { 26 if (!psphotReadoutCleanupReadout (config, view, "PSPHOT.INPUT", i, recipe)) {27 psError (PSPHOT_ERR_CONFIG, false, "failed on psphotReadoutCleanup for PSPHOT.INPUT entry %d", i);26 if (!psphotReadoutCleanupReadout (config, view, filerule, i, recipe)) { 27 psError (PSPHOT_ERR_CONFIG, false, "failed on psphotReadoutCleanup for %s entry %d", filerule, i); 28 28 return false; 29 29 } … … 39 39 // not a DATA error, then there was a serious problem. Only in this case, or if the fail 40 40 // on the stats measurement, do we return false 41 bool psphotReadoutCleanupReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe) {41 bool psphotReadoutCleanupReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) { 42 42 43 43 bool status = true; 44 44 45 45 // find the currently selected readout 46 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest46 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 47 47 psAssert (file, "missing file?"); 48 48 -
branches/eam_branches/psphot.20100506/src/psphotReadoutFindPSF.c
r26894 r27909 8 8 9 9 // set the photcode for the PSPHOT.INPUT 10 if (!psphotAddPhotcode(config, view )) {10 if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) { 11 11 psError(PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 12 12 return false; … … 14 14 15 15 // Generate the mask and variance images, including the user-defined analysis region of interest 16 psphotSetMaskAndVariance (config, view );16 psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT"); 17 17 18 18 // Note that in this implementation, we do NOT model the background and we do not … … 21 21 // include externally-supplied sources (supplied as PSPHOT.INPUT.CMF) 22 22 // XXX we assume a single set of input sources is supplied 23 if (!psphotDetectionsFromSources (config, view, inSources)) {23 if (!psphotDetectionsFromSources (config, view, "PSPHOT.INPUT", inSources)) { 24 24 psError(PSPHOT_ERR_ARGUMENTS, true, "Can't find PSF stars"); 25 return psphotReadoutCleanup (config, view);25 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 26 26 } 27 27 28 28 // construct detections->newSources and measure basic stats (moments, local sky) 29 if (!psphotSourceStats(config, view, true)) {29 if (!psphotSourceStats(config, view, "PSPHOT.INPUT", true)) { 30 30 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 31 31 return false; … … 33 33 34 34 // peak flux is wrong : use the peak measured in the moments analysis: 35 if (!psphotRepairLoadedSources(config, view )) {35 if (!psphotRepairLoadedSources(config, view, "PSPHOT.INPUT")) { 36 36 psError(PSPHOT_ERR_UNKNOWN, false, "failure to repair sources"); 37 37 return false; … … 39 39 40 40 // classify sources based on moments, brightness (psf is not known) 41 if (!psphotRoughClass (config, view )) {41 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { 42 42 psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough source class"); 43 return psphotReadoutCleanup (config, view );43 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 44 44 } 45 45 46 if (!psphotImageQuality (config, view )) {46 if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) { 47 47 psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality"); 48 return psphotReadoutCleanup (config, view);48 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 49 49 } 50 50 51 if (!psphotChoosePSF(config, view )) {51 if (!psphotChoosePSF(config, view, "PSPHOT.INPUT")) { 52 52 psError(PSPHOT_ERR_PSF, false, "Failed to construct a psf model"); 53 return psphotReadoutCleanup (config, view);53 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 54 54 } 55 55 … … 59 59 // fits from that analysis, or run the linear PSF fit for all objects currently in hand 60 60 // construct an initial model for each object, set the radius to fitRadius, set circular fit mask 61 psphotGuessModels (config, view );61 psphotGuessModels (config, view, "PSPHOT.INPUT"); 62 62 # endif 63 63 64 64 // merge the newly selected sources into the existing list 65 65 // NOTE: merge OLD and NEW 66 psphotMergeSources (config, view );66 psphotMergeSources (config, view, "PSPHOT.INPUT"); 67 67 68 68 # if 0 69 69 // measure aperture photometry corrections 70 if (!psphotApResid (config, view )) {70 if (!psphotApResid (config, view, "PSPHOT.INPUT")) { 71 71 psLogMsg ("psphot", 3, "failed on psphotApResid"); 72 return psphotReadoutCleanup (config, view );72 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 73 73 } 74 74 # endif 75 75 76 76 // drop the references to the image pixels held by each source 77 psphotSourceFreePixels(config, view );77 psphotSourceFreePixels(config, view, "PSPHOT.INPUT"); 78 78 79 79 // create the exported-metadata and free local data 80 return psphotReadoutCleanup (config, view);80 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 81 81 } -
branches/eam_branches/psphot.20100506/src/psphotReadoutKnownSources.c
r26894 r27909 8 8 9 9 // set the photcode for this image 10 if (!psphotAddPhotcode(config, view )) {10 if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) { 11 11 psError(PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 12 12 return false; … … 14 14 15 15 // Generate the mask and weight images, including the user-defined analysis region of interest 16 psphotSetMaskAndVariance (config, view );16 psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT"); 17 17 18 18 // Note that in this implementation, we do NOT model the background and we do not … … 20 20 21 21 // include externally-supplied sources (supplied as PSPHOT.INPUT.CMF) 22 if (!psphotDetectionsFromSources (config, view, inSources)) {22 if (!psphotDetectionsFromSources (config, view, "PSPHOT.INPUT", inSources)) { 23 23 psError(PSPHOT_ERR_ARGUMENTS, true, "Can't find PSF stars"); 24 return psphotReadoutCleanup (config, view);24 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 25 25 } 26 26 27 27 // construct sources and measure basic stats 28 if (!psphotSourceStats (config, view, true)) {28 if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) { 29 29 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 30 30 return false; … … 32 32 33 33 // peak flux is wrong : use the peak measured in the moments analysis: 34 if (!psphotRepairLoadedSources(config, view )) {34 if (!psphotRepairLoadedSources(config, view, "PSPHOT.INPUT")) { 35 35 psError(PSPHOT_ERR_UNKNOWN, false, "failure to repair sources"); 36 36 return false; … … 38 38 39 39 // classify sources based on moments, brightness (psf is not known) 40 if (!psphotRoughClass (config, view )) {40 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { 41 41 psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough source class"); 42 return psphotReadoutCleanup (config, view);42 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 43 43 } 44 44 45 if (!psphotChoosePSF (config, view )) {45 if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) { 46 46 psError(PSPHOT_ERR_PSF, false, "Failed to construct a psf model"); 47 return psphotReadoutCleanup (config, view);47 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 48 48 } 49 49 50 50 // construct an initial model for each object 51 psphotGuessModels (config, view );51 psphotGuessModels (config, view, "PSPHOT.INPUT"); 52 52 53 53 // merge the newly selected sources into the existing list 54 54 // NOTE: merge OLD and NEW 55 psphotMergeSources (config, view );55 psphotMergeSources (config, view, "PSPHOT.INPUT"); 56 56 57 57 // linear PSF fit to source peaks 58 psphotFitSourcesLinear (config, view, false);58 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); 59 59 60 60 // measure aperture photometry corrections 61 if (!psphotApResid (config, view )) {61 if (!psphotApResid (config, view, "PSPHOT.INPUT")) { 62 62 psLogMsg ("psphot", 3, "failed on psphotApResid"); 63 return psphotReadoutCleanup (config, view);63 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 64 64 } 65 65 66 66 // calculate source magnitudes 67 psphotMagnitudes(config, view );67 psphotMagnitudes(config, view, "PSPHOT.INPUT"); 68 68 69 69 // drop the references to the image pixels held by each source 70 psphotSourceFreePixels (config, view );70 psphotSourceFreePixels (config, view, "PSPHOT.INPUT"); 71 71 72 72 // create the exported-metadata and free local data 73 return psphotReadoutCleanup (config, view);73 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 74 74 } -
branches/eam_branches/psphot.20100506/src/psphotReadoutMinimal.c
r26894 r27909 18 18 19 19 // set the photcode for this image 20 if (!psphotAddPhotcode(config, view )) {20 if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) { 21 21 psError(PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 22 22 return false; … … 24 24 25 25 // Generate the mask and weight images, including the user-defined analysis region of interest 26 psphotSetMaskAndVariance (config, view );26 psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT"); 27 27 28 28 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are saved on readout->analysis 29 29 if (!psphotLoadPSF (config, view)) { 30 30 psError (PSPHOT_ERR_CONFIG, false, "missing psf model"); 31 return psphotReadoutCleanup (config, view );31 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 32 32 } 33 33 34 34 // find the detections (by peak and/or footprint) in the image. (final pass) 35 if (!psphotFindDetections(config, view, false)) {35 if (!psphotFindDetections(config, view, "PSPHOT.INPUT", false)) { 36 36 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 37 return psphotReadoutCleanup (config, view );37 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 38 38 } 39 39 40 40 // construct sources and measure basic stats (saved on detections->newSources) 41 if (!psphotSourceStats (config, view, false)) { // pass 141 if (!psphotSourceStats (config, view, "PSPHOT.INPUT", false)) { // pass 1 42 42 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 43 return psphotReadoutCleanup (config, view );43 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 44 44 } 45 45 46 46 // find blended neighbors of very saturated stars 47 psphotDeblendSatstars (config, view );47 psphotDeblendSatstars (config, view, "PSPHOT.INPUT"); 48 48 49 49 // mark blended peaks PS_SOURCE_BLEND 50 if (!psphotBasicDeblend (config, view )) {50 if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) { 51 51 psLogMsg ("psphot", 3, "failed on deblend analysis"); 52 return psphotReadoutCleanup (config, view );52 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 53 53 } 54 54 55 55 // classify sources based on moments, brightness (use supplied psf shape parameters) 56 if (!psphotRoughClass (config, view )) {56 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { 57 57 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 58 return psphotReadoutCleanup (config, view );58 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 59 59 } 60 60 61 61 // construct an initial model for each object 62 psphotGuessModels (config, view );62 psphotGuessModels (config, view, "PSPHOT.INPUT"); 63 63 64 64 // merge the newly selected sources into the existing list 65 psphotMergeSources (config, view );65 psphotMergeSources (config, view, "PSPHOT.INPUT"); 66 66 67 67 // linear PSF fit to source peaks 68 psphotFitSourcesLinear (config, view, false);68 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); 69 69 70 70 // XXX eventually, add the extended source fits here 71 71 # if (0) 72 72 // measure source size for the remaining sources 73 psphotSourceSize (config, view );73 psphotSourceSize (config, view, "PSPHOT.INPUT"); 74 74 75 psphotExtendedSourceAnalysis (config, view );75 psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT"); 76 76 77 psphotExtendedSourceFits (config, view );77 psphotExtendedSourceFits (config, view, "PSPHOT.INPUT"); 78 78 # endif 79 79 80 80 // calculate source magnitudes 81 psphotMagnitudes(config, view );81 psphotMagnitudes(config, view, "PSPHOT.INPUT"); 82 82 83 83 // XXX ensure this is measured if the analysis succeeds (even if quality is low) 84 if (!psphotEfficiency(config, view )) {84 if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) { 85 85 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 86 86 psErrorClear(); … … 88 88 89 89 // drop the references to the image pixels held by each source 90 psphotSourceFreePixels (config, view );90 psphotSourceFreePixels (config, view, "PSPHOT.INPUT"); 91 91 92 92 // create the exported-metadata and free local data 93 return psphotReadoutCleanup (config, view);93 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT"); 94 94 } -
branches/eam_branches/psphot.20100506/src/psphotReplaceUnfit.c
r26894 r27909 23 23 24 24 // for now, let's store the detections on the readout->analysis for each readout 25 bool psphotReplaceAllSources (pmConfig *config, const pmFPAview *view )25 bool psphotReplaceAllSources (pmConfig *config, const pmFPAview *view, const char *filerule) 26 26 { 27 27 bool status = true; … … 36 36 // loop over the available readouts 37 37 for (int i = 0; i < num; i++) { 38 if (!psphotReplaceAllSourcesReadout (config, view, "PSPHOT.INPUT", i, recipe)) {38 if (!psphotReplaceAllSourcesReadout (config, view, filerule, i, recipe)) { 39 39 psError (PSPHOT_ERR_CONFIG, false, "failed to replace all sources for PSPHOT.INPUT entry %d", i); 40 40 return false; -
branches/eam_branches/psphot.20100506/src/psphotRoughClass.c
r27657 r27909 8 8 9 9 // for now, let's store the detections on the readout->analysis for each readout 10 bool psphotRoughClass (pmConfig *config, const pmFPAview *view )10 bool psphotRoughClass (pmConfig *config, const pmFPAview *view, const char *filerule) 11 11 { 12 12 bool status = true; … … 26 26 for (int i = 0; i < num; i++) { 27 27 if (i == chisqNum) continue; // skip chisq image 28 if (!psphotRoughClassReadout (config, view, "PSPHOT.INPUT", i, recipe)) {29 psError (PSPHOT_ERR_CONFIG, false, "failed on rough classification for PSPHOT.INPUT entry %d", i);28 if (!psphotRoughClassReadout (config, view, filerule, i, recipe)) { 29 psError (PSPHOT_ERR_CONFIG, false, "failed on rough classification for %s entry %d", filerule, i); 30 30 return false; 31 31 } … … 34 34 } 35 35 36 bool psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe) {36 bool psphotRoughClassReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) { 37 37 38 38 bool status; … … 41 41 42 42 // find the currently selected readout 43 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest43 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 44 44 psAssert (file, "missing file?"); 45 45 -
branches/eam_branches/psphot.20100506/src/psphotSkyReplace.c
r27657 r27909 1 1 # include "psphotInternal.h" 2 2 3 bool psphotSkyReplace (pmConfig *config, const pmFPAview *view )3 bool psphotSkyReplace (pmConfig *config, const pmFPAview *view, const char *filerule) 4 4 { 5 5 bool status = true; … … 15 15 for (int i = 0; i < num; i++) { 16 16 if (i == chisqNum) continue; // skip chisq image 17 if (!psphotSkyReplaceReadout (config, view, "PSPHOT.INPUT", i)) {18 psError (PSPHOT_ERR_CONFIG, false, "failed to replace sky for PSPHOT.INPUT entry %d", i);17 if (!psphotSkyReplaceReadout (config, view, filerule, i)) { 18 psError (PSPHOT_ERR_CONFIG, false, "failed to replace sky for %s entry %d", filerule, i); 19 19 return false; 20 20 } … … 25 25 // XXX make this an option? 26 26 // in order to successfully replace the sky, we must define a corresponding file... 27 bool psphotSkyReplaceReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index) {27 bool psphotSkyReplaceReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) { 28 28 29 29 psTimerStart ("psphot.skyreplace"); 30 30 31 31 // find the currently selected readout 32 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest32 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 33 33 psAssert (file, "missing file?"); 34 34 -
branches/eam_branches/psphot.20100506/src/psphotSourceFreePixels.c
r26894 r27909 1 1 # include "psphotInternal.h" 2 2 3 bool psphotSourceFreePixels (pmConfig *config, const pmFPAview *view )3 bool psphotSourceFreePixels (pmConfig *config, const pmFPAview *view, const char *filerule) 4 4 { 5 5 bool status = true; … … 10 10 // loop over the available readouts 11 11 for (int i = 0; i < num; i++) { 12 if (!psphotSourceFreePixelsReadout (config, view, "PSPHOT.INPUT", i)) {13 psError (PSPHOT_ERR_CONFIG, false, "failed to free source pixels for PSPHOT.INPUT entry %d", i);12 if (!psphotSourceFreePixelsReadout (config, view, filerule, i)) { 13 psError (PSPHOT_ERR_CONFIG, false, "failed to free source pixels for %s entry %d", filerule, i); 14 14 return false; 15 15 } … … 18 18 } 19 19 20 bool psphotSourceFreePixelsReadout(pmConfig *config, const pmFPAview *view, const char *file name, int index) {20 bool psphotSourceFreePixelsReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index) { 21 21 22 22 bool status; 23 23 24 24 // find the currently selected readout 25 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest25 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 26 26 psAssert (file, "missing file?"); 27 27 -
branches/eam_branches/psphot.20100506/src/psphotSourceMatch.c
r27657 r27909 1 1 # include "psphotInternal.h" 2 2 3 bool psphotMatchSourcesGenerate (pmConfig *config, const pmFPAview *view, psArray *objects);4 5 psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view )3 bool psphotMatchSourcesGenerate (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *objects); 4 5 psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view, const char *filerule) 6 6 { 7 7 bool status = true; … … 14 14 // loop over the available readouts 15 15 for (int i = 0; i < num; i++) { 16 if (!psphotMatchSourcesReadout (objects, config, view, "PSPHOT.INPUT", i)) {16 if (!psphotMatchSourcesReadout (objects, config, view, filerule, i)) { 17 17 psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for PSPHOT.INPUT entry %d", i); 18 18 psFree (objects); … … 21 21 } 22 22 23 psphotMatchSourcesGenerate (config, view, objects);23 psphotMatchSourcesGenerate (config, view, filerule, objects); 24 24 25 25 return objects; 26 26 } 27 27 28 bool psphotMatchSourcesReadout (psArray *objects, pmConfig *config, const pmFPAview *view, c har *filename, int index) {28 bool psphotMatchSourcesReadout (psArray *objects, pmConfig *config, const pmFPAview *view, const char *filerule, int index) { 29 29 30 30 bool status = false; … … 38 38 39 39 // find the currently selected readout 40 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest40 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 41 41 psAssert (file, "missing file?"); 42 42 … … 145 145 } 146 146 147 bool psphotMatchSourcesGenerate (pmConfig *config, const pmFPAview *view, psArray *objects) {147 bool psphotMatchSourcesGenerate (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *objects) { 148 148 149 149 bool status = false; … … 167 167 168 168 // find the currently selected readout 169 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PSPHOT.INPUT", i); // File of interest169 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest 170 170 psAssert (file, "missing file?"); 171 171 -
branches/eam_branches/psphot.20100506/src/psphotSourceSize.c
r27695 r27909 33 33 34 34 // for now, let's store the detections on the readout->analysis for each readout 35 bool psphotSourceSize (pmConfig *config, const pmFPAview *view, bool getPSFsize)35 bool psphotSourceSize (pmConfig *config, const pmFPAview *view, const char *filerule, bool getPSFsize) 36 36 { 37 37 bool status = true; … … 51 51 for (int i = 0; i < num; i++) { 52 52 if (i == chisqNum) continue; // skip chisq image 53 if (!psphotSourceSizeReadout (config, view, "PSPHOT.INPUT", i, recipe, getPSFsize)) {53 if (!psphotSourceSizeReadout (config, view, filerule, i, recipe, getPSFsize)) { 54 54 psError (PSPHOT_ERR_CONFIG, false, "failed on source size analysis for PSPHOT.INPUT entry %d", i); 55 55 return false; … … 60 60 61 61 // this function use an internal flag to mark sources which have already been measured 62 bool psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe, bool getPSFsize)62 bool psphotSourceSizeReadout(pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool getPSFsize) 63 63 { 64 64 bool status; … … 68 68 69 69 // find the currently selected readout 70 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest70 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 71 71 psAssert (file, "missing file?"); 72 72 -
branches/eam_branches/psphot.20100506/src/psphotSourceStats.c
r27657 r27909 5 5 // The new sources are added to any existing sources on detections->newSources. The sources 6 6 // on detections->allSources are ignored. 7 bool psphotSourceStats (pmConfig *config, const pmFPAview *view, bool setWindow)7 bool psphotSourceStats (pmConfig *config, const pmFPAview *view, const char *filerule, bool setWindow) 8 8 { 9 9 bool status = true; … … 18 18 // loop over the available readouts 19 19 for (int i = 0; i < num; i++) { 20 if (!psphotSourceStatsReadout (config, view, "PSPHOT.INPUT", i, recipe, setWindow)) {21 psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for PSPHOT.INPUT entry %d", i);20 if (!psphotSourceStatsReadout (config, view, filerule, i, recipe, setWindow)) { 21 psError (PSPHOT_ERR_CONFIG, false, "failed to find initial detections for %s entry %d", filerule, i); 22 22 return false; 23 23 } … … 26 26 } 27 27 28 bool psphotSourceStatsReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe, bool setWindow) {28 bool psphotSourceStatsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe, bool setWindow) { 29 29 30 30 bool status = false; … … 34 34 35 35 // find the currently selected readout 36 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest36 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 37 37 psAssert (file, "missing file?"); 38 38 -
branches/eam_branches/psphot.20100506/src/psphotStackChisqImage.c
r27657 r27909 6 6 7 7 // XXX supply filename or keep PSPHOT.INPUT fixed? 8 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view )8 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view, const char *filerule) 9 9 { 10 10 bool status = false; … … 22 22 // loop over the available readouts 23 23 for (int i = 0; i < num; i++) { 24 if (!psphotStackChisqImageAddReadout(config, view, &chiReadout, "PSPHOT.INPUT", i)) {25 psError (PSPHOT_ERR_CONFIG, false, "failed to model background for PSPHOT.INPUT entry %d", i);24 if (!psphotStackChisqImageAddReadout(config, view, filerule, &chiReadout, i)) { 25 psError (PSPHOT_ERR_CONFIG, false, "failed to model background for %s entry %d", filerule, i); 26 26 return false; 27 27 } … … 35 35 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "", num); 36 36 37 // need to save the resulting image somewhere (PSPHOT.INPUT?)38 if (!psMetadataAddPtr(config->files, PS_LIST_TAIL, "PSPHOT.INPUT", PS_DATA_UNKNOWN | PS_META_DUPLICATE_OK, "", chisqFile)) {37 // save the resulting image 38 if (!psMetadataAddPtr(config->files, PS_LIST_TAIL, filerule, PS_DATA_UNKNOWN | PS_META_DUPLICATE_OK, "", chisqFile)) { 39 39 psError(PM_ERR_CONFIG, false, "could not add chisqFPA to config files"); 40 40 return false; … … 48 48 bool psphotStackChisqImageAddReadout(const pmConfig *config, // Configuration 49 49 const pmFPAview *view, 50 const char *filerule, 50 51 pmReadout **chiReadout, 51 char *filename,52 52 int index) 53 53 { … … 55 55 56 56 // find the currently selected readout 57 pmFPAfile *input = pmFPAfileSelectSingle(config->files, file name, index); // File of interest57 pmFPAfile *input = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 58 58 psAssert (input, "missing file?"); 59 59 … … 111 111 } 112 112 113 bool psphotStackRemoveChisqFromInputs (pmConfig *config ) {113 bool psphotStackRemoveChisqFromInputs (pmConfig *config, const char *filerule) { 114 114 115 115 bool status = false; … … 121 121 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 122 122 123 pmFPAfileRemoveSingle (config->files, "PSPHOT.INPUT", chisqNum);123 pmFPAfileRemoveSingle (config->files, filerule, chisqNum); 124 124 125 125 inputNum --; -
branches/eam_branches/psphot.20100506/src/psphotStackImageLoop.c
r27888 r27909 53 53 54 54 // XXX for now, we assume there is only a single chip in the PHU: 55 if ( 0 &&!psphotStackReadout (config, view)) {55 if (!psphotStackReadout (config, view)) { 56 56 psError(psErrorCodeLast(), false, "failure in psphotStackReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 57 57 psFree (view); -
branches/eam_branches/psphot.20100506/src/psphotStackReadout.c
r27657 r27909 1 1 # include "psphotInternal.h" 2 3 # define STACK_RAW "PSPHOT.STACK.INPUT.RAW" 4 # define STACK_OUT "PSPHOT.STACK.OUTPUT.IMAGE" 2 5 3 6 bool psphotStackReadout (pmConfig *config, const pmFPAview *view) { … … 17 20 PS_ASSERT_PTR_NON_NULL (breakPt, false); 18 21 22 // we have 3 relevant files: RAW, CNV, OUT 23 19 24 // set the photcode for each image 20 if (!psphotAddPhotcode (config, view )) {25 if (!psphotAddPhotcode (config, view, STACK_OUT)) { 21 26 psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 22 27 return false; … … 24 29 25 30 // Generate the mask and weight images 26 if (!psphotSetMaskAndVariance (config, view)) { 27 return psphotReadoutCleanup (config, view); 31 // XXX this should be done before we perform the convolutions 32 if (!psphotSetMaskAndVariance (config, view, STACK_RAW)) { 33 return psphotReadoutCleanup (config, view, STACK_OUT); 28 34 } 29 35 if (!strcasecmp (breakPt, "NOTHING")) { 30 return psphotReadoutCleanup (config, view );36 return psphotReadoutCleanup (config, view, STACK_OUT); 31 37 } 32 38 33 39 // generate a background model (median, smoothed image) 34 40 // XXX I think this is not defined correctly for an array of images. 35 if (!psphotModelBackground (config, view )) {36 return psphotReadoutCleanup (config, view );41 if (!psphotModelBackground (config, view, STACK_RAW)) { 42 return psphotReadoutCleanup (config, view, STACK_OUT); 37 43 } 38 if (!psphotSubtractBackground (config, view )) {39 return psphotReadoutCleanup (config, view );44 if (!psphotSubtractBackground (config, view, STACK_RAW)) { 45 return psphotReadoutCleanup (config, view, STACK_OUT); 40 46 } 41 47 if (!strcasecmp (breakPt, "BACKMDL")) { 42 return psphotReadoutCleanup (config, view );48 return psphotReadoutCleanup (config, view, STACK_OUT); 43 49 } 44 50 … … 47 53 if (!psphotLoadPSF (config, view)) { 48 54 psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model"); 49 return psphotReadoutCleanup (config, view );55 return psphotReadoutCleanup (config, view, STACK_OUT); 50 56 } 51 57 52 if (!psphotStackChisqImage(config, view )) {58 if (!psphotStackChisqImage(config, view, STACK_RAW)) { 53 59 psError (PSPHOT_ERR_UNKNOWN, false, "failure to generate chisq image"); 54 return psphotReadoutCleanup (config, view );60 return psphotReadoutCleanup (config, view, STACK_OUT); 55 61 } 56 62 if (!strcasecmp (breakPt, "CHISQ")) { 57 return psphotReadoutCleanup (config, view );63 return psphotReadoutCleanup (config, view, STACK_OUT); 58 64 } 59 65 60 66 // find the detections (by peak and/or footprint) in the image. 61 67 // This finds the detections on Chisq image as well as the individuals 62 if (!psphotFindDetections (config, view, true)) { // pass 168 if (!psphotFindDetections (config, view, STACK_RAW, true)) { // pass 1 63 69 // this only happens if we had an error in psphotFindDetections 64 70 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 65 return psphotReadoutCleanup (config, view );71 return psphotReadoutCleanup (config, view, STACK_OUT); 66 72 } 67 73 68 74 // construct sources and measure basic stats (saved on detections->newSources) 69 75 // only run this on detections from the input images, not chisq image 70 if (!psphotSourceStats (config, view, true)) { // pass 176 if (!psphotSourceStats (config, view, STACK_OUT, true)) { // pass 1 71 77 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 72 return psphotReadoutCleanup (config, view );78 return psphotReadoutCleanup (config, view, STACK_OUT); 73 79 } 74 80 75 81 // *** generate the objects (which unify the sources from the different images) 76 psArray *objects = psphotMatchSources (config, view );82 psArray *objects = psphotMatchSources (config, view, STACK_OUT); 77 83 78 84 // construct sources for the newly-generated sources (from other images) 79 if (!psphotSourceStats (config, view, false)) { // pass 185 if (!psphotSourceStats (config, view, STACK_OUT, false)) { // pass 1 80 86 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 81 return psphotReadoutCleanup (config, view );87 return psphotReadoutCleanup (config, view, STACK_OUT); 82 88 } 83 89 … … 85 91 // if (!psphotDeblendSatstars (config, view)) { 86 92 // psError (PSPHOT_ERR_UNKNOWN, false, "failed on satstar deblend analysis"); 87 // return psphotReadoutCleanup (config, view );93 // return psphotReadoutCleanup (config, view, STACK_OUT); 88 94 // } 89 95 … … 91 97 // if (!psphotBasicDeblend (config, view)) { 92 98 // psError (PSPHOT_ERR_UNKNOWN, false, "failed on deblend analysis"); 93 // return psphotReadoutCleanup (config, view );99 // return psphotReadoutCleanup (config, view, STACK_OUT); 94 100 // } 95 101 96 102 // classify sources based on moments, brightness 97 103 // only run this on detections from the input images, not chisq image 98 if (!psphotRoughClass (config, view )) {104 if (!psphotRoughClass (config, view, STACK_OUT)) { 99 105 psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough classifications"); 100 return psphotReadoutCleanup (config, view );106 return psphotReadoutCleanup (config, view, STACK_OUT); 101 107 } 102 108 // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources) 103 109 // only run this on detections from the input images, not chisq image 104 if (!psphotImageQuality (config, view )) { // pass 1110 if (!psphotImageQuality (config, view, STACK_OUT)) { // pass 1 105 111 psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality"); 106 return psphotReadoutCleanup (config, view);112 return psphotReadoutCleanup (config, view, STACK_OUT); 107 113 } 108 114 if (!strcasecmp (breakPt, "MOMENTS")) { 109 return psphotReadoutCleanup (config, view );115 return psphotReadoutCleanup (config, view, STACK_OUT); 110 116 } 111 117 112 118 // use bright stellar objects to measure PSF if we were supplied a PSF for any input file, 113 119 // this step is skipped 114 if (!psphotChoosePSF (config, view )) { // pass 1120 if (!psphotChoosePSF (config, view, STACK_OUT)) { // pass 1 115 121 psLogMsg ("psphot", 3, "failure to construct a psf model"); 116 return psphotReadoutCleanup (config, view );122 return psphotReadoutCleanup (config, view, STACK_OUT); 117 123 } 118 124 if (!strcasecmp (breakPt, "PSFMODEL")) { 119 return psphotReadoutCleanup (config, view );125 return psphotReadoutCleanup (config, view, STACK_OUT); 120 126 } 121 127 122 128 // include externally-supplied sources 123 129 // XXX fix this in the new multi-input context 124 // psphotLoadExtSources (config, view ); // pass 1130 // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1 125 131 126 132 // construct an initial model for each object, set the radius to fitRadius, set circular fit mask 127 psphotGuessModels (config, view );133 psphotGuessModels (config, view, STACK_OUT); 128 134 129 135 // merge the newly selected sources into the existing list 130 136 // NOTE: merge OLD and NEW 131 psphotMergeSources (config, view );137 psphotMergeSources (config, view, STACK_OUT); 132 138 133 139 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) … … 136 142 137 143 // identify CRs and extended sources 138 psphotSourceSize (config, view, TRUE);144 psphotSourceSize (config, view, STACK_OUT, TRUE); 139 145 140 146 // measure aperture photometry corrections 141 if (!psphotApResid (config, view )) {147 if (!psphotApResid (config, view, STACK_OUT)) { 142 148 psLogMsg ("psphot", 3, "failed on psphotApResid"); 143 return psphotReadoutCleanup (config, view );149 return psphotReadoutCleanup (config, view, STACK_OUT); 144 150 } 145 151 152 psphotExtendedSourceAnalysis (config, view, STACK_OUT); // pass 1 (detections->allSources) 153 psphotExtendedSourceFits (config, view, STACK_OUT); // pass 1 (detections->allSources) 154 146 155 // calculate source magnitudes 147 psphotMagnitudes(config, view );156 psphotMagnitudes(config, view, STACK_OUT); 148 157 149 if (!psphotEfficiency(config, view )) {158 if (!psphotEfficiency(config, view, STACK_OUT)) { 150 159 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 151 160 psErrorClear(); … … 156 165 157 166 // replace background in residual image 158 psphotSkyReplace (config, view );167 psphotSkyReplace (config, view, STACK_RAW); 159 168 160 169 // drop the references to the image pixels held by each source 161 psphotSourceFreePixels (config, view );170 psphotSourceFreePixels (config, view, STACK_OUT); 162 171 163 172 // remove chisq image from config->file:PSPHOT.INPUT (why?) 164 psphotStackRemoveChisqFromInputs(config );173 psphotStackRemoveChisqFromInputs(config, STACK_RAW); 165 174 166 175 // create the exported-metadata and free local data 167 return psphotReadoutCleanup (config, view );176 return psphotReadoutCleanup (config, view, STACK_OUT); 168 177 } 169 178 -
branches/eam_branches/psphot.20100506/src/psphotSubtractBackground.c
r27657 r27909 4 4 // generate the median in NxN boxes, clipping heavily 5 5 // linear interpolation to generate full-scale model 6 bool psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *file name, int index, psMetadata *recipe)6 bool psphotSubtractBackgroundReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index, psMetadata *recipe) 7 7 { 8 8 bool status = true; … … 13 13 14 14 // find the currently selected readout 15 pmFPAfile *file = pmFPAfileSelectSingle(config->files, file name, index); // File of interest15 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 16 16 17 17 pmFPA *inFPA = file->fpa; … … 124 124 } 125 125 126 bool psphotSubtractBackground (pmConfig *config, const pmFPAview *view )126 bool psphotSubtractBackground (pmConfig *config, const pmFPAview *view, const char *filerule) 127 127 { 128 128 bool status = false; … … 137 137 // loop over the available readouts 138 138 for (int i = 0; i < num; i++) { 139 if (!psphotSubtractBackgroundReadout (config, view, "PSPHOT.INPUT", i, recipe)) {139 if (!psphotSubtractBackgroundReadout (config, view, filerule, i, recipe)) { 140 140 psError (PSPHOT_ERR_CONFIG, false, "failed to subtract background for PSPHOT.INPUT entry %d", i); 141 141 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
