Changeset 29936
- Timestamp:
- Dec 5, 2010, 9:42:25 PM (15 years ago)
- Location:
- trunk/psphot
- Files:
-
- 6 deleted
- 50 edited
- 1 copied
-
. (modified) (1 prop)
-
src/Makefile.am (modified) (2 diffs)
-
src/psphot.h (modified) (4 diffs)
-
src/psphotAddNoise.c (modified) (1 diff)
-
src/psphotApResid.c (modified) (4 diffs)
-
src/psphotBasicDeblend.c (modified) (1 diff)
-
src/psphotBlendFit.c (modified) (1 diff)
-
src/psphotChoosePSF.c (modified) (1 diff)
-
src/psphotDeblendSatstars.c (modified) (1 diff)
-
src/psphotDetect.c (deleted)
-
src/psphotDetect.h (deleted)
-
src/psphotDetectArguments.c (deleted)
-
src/psphotDetectImageLoop.c (deleted)
-
src/psphotDetectParseCamera.c (deleted)
-
src/psphotDetectReadout.c (deleted)
-
src/psphotEfficiency.c (modified) (1 diff)
-
src/psphotExtendedSourceAnalysis.c (modified) (1 diff)
-
src/psphotExtendedSourceAnalysisByObject.c (modified) (1 diff)
-
src/psphotExtendedSourceFits.c (modified) (1 diff)
-
src/psphotFindDetections.c (modified) (1 diff)
-
src/psphotFitSourcesLinear.c (modified) (1 diff)
-
src/psphotForcedImageLoop.c (modified) (1 diff)
-
src/psphotForcedReadout.c (modified) (5 diffs)
-
src/psphotGuessModels.c (modified) (1 diff)
-
src/psphotImageLoop.c (modified) (1 diff)
-
src/psphotImageQuality.c (modified) (2 diffs)
-
src/psphotLoadPSF.c (modified) (3 diffs)
-
src/psphotMagnitudes.c (modified) (1 diff)
-
src/psphotMakePSFImageLoop.c (modified) (1 diff)
-
src/psphotMakePSFReadout.c (modified) (4 diffs)
-
src/psphotMaskReadout.c (modified) (2 diffs)
-
src/psphotMergeSources.c (modified) (4 diffs)
-
src/psphotModelBackground.c (modified) (1 diff)
-
src/psphotOutput.c (modified) (4 diffs)
-
src/psphotParseCamera.c (modified) (1 diff)
-
src/psphotRadialApertures.c (modified) (1 diff)
-
src/psphotRadialAperturesByObject.c (modified) (1 diff)
-
src/psphotRadiusChecks.c (modified) (1 diff)
-
src/psphotReadout.c (modified) (8 diffs)
-
src/psphotReadoutCleanup.c (modified) (1 diff)
-
src/psphotReadoutFindPSF.c (modified) (5 diffs)
-
src/psphotReadoutForcedKnownSources.c (copied) (copied from branches/eam_branches/ipp-20101103/psphot/src/psphotReadoutForcedKnownSources.c )
-
src/psphotReadoutKnownSources.c (modified) (5 diffs)
-
src/psphotReadoutMinimal.c (modified) (4 diffs)
-
src/psphotReplaceUnfit.c (modified) (1 diff)
-
src/psphotRoughClass.c (modified) (1 diff)
-
src/psphotSkyReplace.c (modified) (1 diff)
-
src/psphotSourceFreePixels.c (modified) (1 diff)
-
src/psphotSourceMatch.c (modified) (2 diffs)
-
src/psphotSourceSize.c (modified) (2 diffs)
-
src/psphotSourceStats.c (modified) (1 diff)
-
src/psphotStackChisqImage.c (modified) (4 diffs)
-
src/psphotStackImageLoop.c (modified) (3 diffs)
-
src/psphotStackMatchPSFs.c (modified) (1 diff)
-
src/psphotStackReadout.c (modified) (1 diff)
-
src/psphotSubtractBackground.c (modified) (1 diff)
-
src/psphotTest.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20101103/psphot (added) merged: 29660,29824-29825,29904,29914,29918,29920
- Property svn:mergeinfo changed
-
trunk/psphot/src/Makefile.am
r29004 r29936 103 103 psphotCleanup.c 104 104 105 106 107 # # psphot analysis of the detectability of specified positions108 # psphotDetect_SOURCES = \109 # psphotDetect.c \110 # psphotDetectArguments.c \111 # psphotDetectParseCamera.c \112 # psphotDetectImageLoop.c \113 # psphotDetectReadout.c \114 # psphotMosaicChip.c \115 # psphotCleanup.c116 117 105 # psphotTest_SOURCES = \ 118 106 # psphotTest.c … … 137 125 psphotReadoutFindPSF.c \ 138 126 psphotReadoutKnownSources.c \ 127 psphotReadoutForcedKnownSources.c \ 139 128 psphotReadoutMinimal.c \ 140 129 psphotModelBackground.c \ -
trunk/psphot/src/psphot.h
r29608 r29936 24 24 bool psphotModelTest (pmConfig *config, const pmFPAview *view, psMetadata *recipe); 25 25 bool psphotInit (void); 26 bool psphotReadout (pmConfig *config, const pmFPAview *view); 27 bool psphotReadoutFindPSF(pmConfig *config, const pmFPAview *view, psArray *inSources); 28 bool psphotReadoutKnownSources(pmConfig *config, const pmFPAview *view, psArray *inSources); 29 bool psphotReadoutMinimal(pmConfig *config, const pmFPAview *view); 26 bool psphotReadout (pmConfig *config, const pmFPAview *view, const char *filerule); 27 bool psphotReadoutFindPSF(pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources); 28 bool psphotReadoutKnownSources(pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources); 29 bool psphotReadoutForcedKnownSources(pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources); 30 bool psphotReadoutMinimal(pmConfig *config, const pmFPAview *view, const char *filerule); 30 31 31 32 bool psphotReadoutCleanup (pmConfig *config, const pmFPAview *view, const char *filerule); … … 219 220 bool psphotFitSummary (void); 220 221 221 bool psphotLoadPSF (pmConfig *config, const pmFPAview *view );222 bool psphotLoadPSF (pmConfig *config, const pmFPAview *view, const char *filerule); 222 223 bool psphotLoadPSFReadout (pmConfig *config, const pmFPAview *view, const char *outFilename, const char *inFilename, int index); 223 224 … … 304 305 pmConfig *psphotForcedArguments(int argc, char **argv); 305 306 bool psphotForcedImageLoop (pmConfig *config); 306 bool psphotForcedReadout(pmConfig *config, const pmFPAview *view );307 bool psphotForcedReadout(pmConfig *config, const pmFPAview *view, const char *filerule); 307 308 308 309 pmConfig *psphotMakePSFArguments(int argc, char **argv); 309 310 bool psphotMakePSFImageLoop (pmConfig *config); 310 bool psphotMakePSFReadout(pmConfig *config, const pmFPAview *view); 311 bool psphotMakePSFReadout(pmConfig *config, const pmFPAview *view, const char *filerule); 312 313 int psphotFileruleCount(const pmConfig *config, const char *filerule); 314 315 bool psphotAddKnownSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources); 316 311 317 312 318 /**** psphotStack prototypes ****/ … … 432 438 pmModel *psphotFitPCM (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal, int psfSize); 433 439 440 bool psphotCleanInputs (pmConfig *config, const pmFPAview *view, const char *filerule); 441 434 442 #endif -
trunk/psphot/src/psphotAddNoise.c
r29004 r29936 18 18 psAssert (recipe, "missing recipe?"); 19 19 20 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 21 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 20 int num = psphotFileruleCount(config, filerule); 22 21 23 22 // loop over the available readouts -
trunk/psphot/src/psphotApResid.c
r29548 r29936 13 13 psAssert (recipe, "missing recipe?"); 14 14 15 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 16 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 15 int num = psphotFileruleCount(config, filerule); 17 16 18 17 // skip the chisq image (optionally?) … … 72 71 if (!measureAptrend) { 73 72 // save nan values since these were not calculated 74 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_DATA_F32 |PS_META_REPLACE, "aperture residual", NAN);75 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_DATA_F32 |PS_META_REPLACE, "ap residual scatter", NAN);76 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_DATA_S32 |PS_META_REPLACE, "number of apresid stars", 0);77 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_DATA_F32 |PS_META_REPLACE, "aperture loss (mag)", NAN);73 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_META_REPLACE, "aperture residual", NAN); 74 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_META_REPLACE, "ap residual scatter", NAN); 75 psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_META_REPLACE, "number of apresid stars", 0); 76 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_META_REPLACE, "aperture loss (mag)", NAN); 78 77 return true; 79 78 } … … 325 324 326 325 // save results for later output 327 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_DATA_F32 |PS_META_REPLACE, "aperture residual", psf->ApResid);328 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_DATA_F32 |PS_META_REPLACE, "ap residual scatter", psf->dApResid);329 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_DATA_S32 |PS_META_REPLACE, "number of apresid stars", psf->nApResid);330 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_DATA_F32 |PS_META_REPLACE, "aperture loss (mag)", psf->growth ? psf->growth->apLoss : NAN);326 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_META_REPLACE, "aperture residual", psf->ApResid); 327 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_META_REPLACE, "ap residual scatter", psf->dApResid); 328 psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_META_REPLACE, "number of apresid stars", psf->nApResid); 329 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_META_REPLACE, "aperture loss (mag)", psf->growth ? psf->growth->apLoss : NAN); 331 330 332 331 psLogMsg ("psphot.apresid", PS_LOG_DETAIL, "aperture residual: %f +/- %f\n", psf->ApResid, psf->dApResid); … … 345 344 escape: 346 345 // save nan values since these were not calculated 347 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_DATA_F32 |PS_META_REPLACE, "aperture residual", NAN);348 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_DATA_F32 |PS_META_REPLACE, "ap residual scatter", NAN);349 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_DATA_S32 |PS_META_REPLACE, "number of apresid stars", 0);350 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_DATA_F32 |PS_META_REPLACE, "aperture loss (mag)", NAN);346 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APMIFIT", PS_META_REPLACE, "aperture residual", NAN); 347 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "DAPMIFIT", PS_META_REPLACE, "ap residual scatter", NAN); 348 psMetadataAddS32 (readout->analysis, PS_LIST_TAIL, "NAPMIFIT", PS_META_REPLACE, "number of apresid stars", 0); 349 psMetadataAddF32 (readout->analysis, PS_LIST_TAIL, "APLOSS", PS_META_REPLACE, "aperture loss (mag)", NAN); 351 350 352 351 psFree (xPos); -
trunk/psphot/src/psphotBasicDeblend.c
r28013 r29936 4 4 bool psphotBasicDeblend (pmConfig *config, const pmFPAview *view, const char *filerule) 5 5 { 6 bool status = true; 7 8 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 9 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 6 int num = psphotFileruleCount(config, filerule); 10 7 11 8 // loop over the available readouts -
trunk/psphot/src/psphotBlendFit.c
r29017 r29936 10 10 psAssert (recipe, "missing recipe?"); 11 11 12 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 13 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 12 int num = psphotFileruleCount(config, filerule); 14 13 15 14 // loop over the available readouts -
trunk/psphot/src/psphotChoosePSF.c
r29004 r29936 10 10 psAssert (recipe, "missing recipe?"); 11 11 12 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 13 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 12 int num = psphotFileruleCount(config, filerule); 14 13 15 14 // skip the chisq image (optionally?) -
trunk/psphot/src/psphotDeblendSatstars.c
r29606 r29936 4 4 bool psphotDeblendSatstars (pmConfig *config, const pmFPAview *view, const char *filerule) 5 5 { 6 bool status = true; 7 8 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 9 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 6 int num = psphotFileruleCount(config, filerule); 10 7 11 8 // loop over the available readouts -
trunk/psphot/src/psphotEfficiency.c
r29902 r29936 164 164 psAssert (recipe, "missing recipe?"); 165 165 166 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 167 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 166 int num = psphotFileruleCount(config, filerule); 168 167 169 168 // skip the chisq image (optionally?) -
trunk/psphot/src/psphotExtendedSourceAnalysis.c
r29027 r29936 22 22 } 23 23 24 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 25 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 24 int num = psphotFileruleCount(config, filerule); 26 25 27 26 // loop over the available readouts -
trunk/psphot/src/psphotExtendedSourceAnalysisByObject.c
r29548 r29936 41 41 42 42 // number of images used to define sources 43 int nImages = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 44 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 43 int nImages = psphotFileruleCount(config, filerule); 45 44 46 45 // generate look-up arrays for readouts -
trunk/psphot/src/psphotExtendedSourceFits.c
r29548 r29936 16 16 } 17 17 18 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 19 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 18 int num = psphotFileruleCount(config, filerule); 20 19 21 20 // loop over the available readouts -
trunk/psphot/src/psphotFindDetections.c
r29548 r29936 12 12 psAssert (recipe, "missing recipe?"); 13 13 14 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 15 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 14 int num = psphotFileruleCount(config, filerule); 16 15 17 16 // loop over the available readouts -
trunk/psphot/src/psphotFitSourcesLinear.c
r29548 r29936 21 21 assert (recipe); 22 22 23 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 24 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 23 int num = psphotFileruleCount(config, filerule); 25 24 26 25 // loop over the available readouts -
trunk/psphot/src/psphotForcedImageLoop.c
r25981 r29936 84 84 85 85 // run the actual photometry analysis on this chip/cell/readout 86 if (!psphotForcedReadout (config, view )) {86 if (!psphotForcedReadout (config, view, "PSPHOT.INPUT")) { 87 87 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 88 88 psFree (view); -
trunk/psphot/src/psphotForcedReadout.c
r28013 r29936 1 1 # include "psphotInternal.h" 2 2 3 bool psphotForcedReadout(pmConfig *config, const pmFPAview *view ) {3 bool psphotForcedReadout(pmConfig *config, const pmFPAview *view, const char *filerule) { 4 4 5 5 // measure the total elapsed time in psphotReadout. XXX the current threading plan … … 20 20 21 21 // set the photcode for this image 22 if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {22 if (!psphotAddPhotcode (config, view, filerule)) { 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, "PSPHOT.INPUT");32 psphotSetMaskAndVariance (config, view, filerule); 33 33 if (!strcasecmp (breakPt, "NOTHING")) { 34 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");34 return psphotReadoutCleanup (config, view, filerule); 35 35 } 36 36 37 37 // generate a background model (median, smoothed image) 38 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {39 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");38 if (!psphotModelBackground (config, view, filerule)) { 39 return psphotReadoutCleanup (config, view, filerule); 40 40 } 41 if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {42 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");41 if (!psphotSubtractBackground (config, view, filerule)) { 42 return psphotReadoutCleanup (config, view, filerule); 43 43 } 44 44 if (!strcasecmp (breakPt, "BACKMDL")) { 45 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");45 return psphotReadoutCleanup (config, view, filerule); 46 46 } 47 47 48 if (!psphotLoadPSF (config, view )) {48 if (!psphotLoadPSF (config, view, filerule)) { 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, "PSPHOT.INPUT");51 return psphotReadoutCleanup (config, view, filerule); 52 52 } 53 53 54 54 // include externally-supplied sources 55 psphotLoadExtSources (config, view, "PSPHOT.INPUT");55 psphotLoadExtSources (config, view, filerule); 56 56 57 57 // construct an initial model for each object, set the radius to fitRadius, set circular fit mask 58 psphotGuessModels (config, view, "PSPHOT.INPUT");58 psphotGuessModels (config, view, filerule); 59 59 60 60 // merge the newly selected sources into the existing list 61 61 // NOTE: merge OLD and NEW 62 psphotMergeSources (config, view, "PSPHOT.INPUT");62 psphotMergeSources (config, view, filerule); 63 63 64 64 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 65 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false);65 psphotFitSourcesLinear (config, view, filerule, false); 66 66 67 67 // identify CRs and extended sources … … 71 71 72 72 // calculate source magnitudes 73 psphotMagnitudes(config, view, "PSPHOT.INPUT");73 psphotMagnitudes(config, view, filerule); 74 74 75 75 // XXX do I want to do this? … … 80 80 81 81 // replace background in residual image 82 psphotSkyReplace (config, view, "PSPHOT.INPUT");82 psphotSkyReplace (config, view, filerule); 83 83 84 84 // drop the references to the image pixels held by each source 85 psphotSourceFreePixels (config, view, "PSPHOT.INPUT");85 psphotSourceFreePixels (config, view, filerule); 86 86 87 87 // create the exported-metadata and free local data 88 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");88 return psphotReadoutCleanup (config, view, filerule); 89 89 } -
trunk/psphot/src/psphotGuessModels.c
r29605 r29936 12 12 bool status = true; 13 13 14 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 15 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 14 int num = psphotFileruleCount(config, filerule); 16 15 17 16 // skip the chisq image (optionally?) -
trunk/psphot/src/psphotImageLoop.c
r29548 r29936 109 109 110 110 // run the actual photometry analysis on this chip/cell/readout 111 if (!psphotReadout (config, view )) {111 if (!psphotReadout (config, view, "PSPHOT.INPUT")) { 112 112 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 113 113 psFree (view); -
trunk/psphot/src/psphotImageQuality.c
r28013 r29936 13 13 psAssert (recipe, "missing recipe?"); 14 14 15 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 16 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 15 int num = psphotFileruleCount(config, filerule); 17 16 18 17 // skip the chisq image (optionally?) … … 99 98 // r^2 sin(2t) = r^2 2 cos t sin t = 2 x y 100 99 101 // r^ 2 cos(3t) = r^2 cos^3 t - r^2 3 cos t sin^2 t = (x^3 - 3 x y^2) / r102 // r^ 2 sin(3t) = r^2 3 cos^2 t sin t - sin^3 t = (3 x^2 y - y^3) / r103 104 // r^ 2 cos(4t) = r^2 cos^4 t - r^2 6 cos^2 t sin^2 t + r^2 sin^4 t = (x^4 - 6 x^2 y^2 + y^4) / r^2105 // r^ 2 sin(4t) = r^2 4 cos^3 t sin t - 4 sin^3 t cos t = (4 x^3 y - 4 y^3 x) / r^2100 // r^3 cos(3t) = r^3 cos^3 t - r^2 3 cos t sin^2 t = (x^3 - 3 x y^2) 101 // r^3 sin(3t) = r^3 3 cos^2 t sin t - sin^3 t = (3 x^2 y - y^3) 102 103 // r^4 cos(4t) = r^4 cos^4 t - r^2 6 cos^2 t sin^2 t + r^2 sin^4 t = (x^4 - 6 x^2 y^2 + y^4) 104 // r^4 sin(4t) = r^4 4 cos^3 t sin t - 4 sin^3 t cos t = (4 x^3 y - 4 y^3 x) 106 105 107 106 num++; -
trunk/psphot/src/psphotLoadPSF.c
r26894 r29936 6 6 7 7 // XXX for now (2010.01.27), the supporting programs do not define multiple PSPHOT.PSF.LOAD 8 // files to go with multiple PSPHOT.INPUTfiles. as a result, the implementation below is8 // files to go with multiple input files. as a result, the implementation below is 9 9 // currently going to work for the case of a single input file, but will fail if we try with a 10 10 // stack of images. … … 59 59 } 60 60 61 bool psphotLoadPSF (pmConfig *config, const pmFPAview *view) { 61 // PSPHOT.PSF.LOAD vs input file -- see note at top 62 bool psphotLoadPSF (pmConfig *config, const pmFPAview *view, const char *filerule) { 62 63 63 bool status = false; 64 65 // XXX PSPHOT.PSF.LOAD vs PSPHOT.INPUT -- see note at top 66 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 67 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 64 int num = psphotFileruleCount(config, filerule); 68 65 69 66 // loop over the available readouts … … 71 68 72 69 // Generate the mask and weight images, including the user-defined analysis region of interest 73 if (!psphotLoadPSFReadout (config, view, "PSPHOT.INPUT", "PSPHOT.PSF.LOAD", i)) {70 if (!psphotLoadPSFReadout (config, view, filerule, "PSPHOT.PSF.LOAD", i)) { 74 71 psError (PSPHOT_ERR_CONFIG, false, "failed to load PSF model for PSPHOT.PSF.LOAD entry %d", i); 75 72 return false; -
trunk/psphot/src/psphotMagnitudes.c
r29004 r29936 9 9 psAssert (recipe, "missing recipe?"); 10 10 11 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 12 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 11 int num = psphotFileruleCount(config, filerule); 13 12 14 13 // skip the chisq image (optionally?) -
trunk/psphot/src/psphotMakePSFImageLoop.c
r25982 r29936 84 84 85 85 // run the actual photometry analysis on this chip/cell/readout 86 if (!psphotMakePSFReadout (config, view )) {86 if (!psphotMakePSFReadout (config, view, "PSPHOT.INPUT")) { 87 87 psError(psErrorCodeLast(), false, "failure in psphotReadout for chip %d, cell %d, readout %d\n", view->chip, view->cell, view->readout); 88 88 psFree (view); -
trunk/psphot/src/psphotMakePSFReadout.c
r28013 r29936 1 1 # include "psphotInternal.h" 2 2 3 bool psphotMakePSFReadout(pmConfig *config, const pmFPAview *view ) {3 bool psphotMakePSFReadout(pmConfig *config, const pmFPAview *view, const char *filerule) { 4 4 5 5 // measure the total elapsed time in psphotReadout. XXX the current threading plan … … 19 19 20 20 // set the photcode for this image 21 if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {21 if (!psphotAddPhotcode (config, view, filerule)) { 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, "PSPHOT.INPUT");31 psphotSetMaskAndVariance (config, view, filerule); 32 32 if (!strcasecmp (breakPt, "NOTHING")) { 33 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");33 return psphotReadoutCleanup (config, view, filerule); 34 34 } 35 35 36 36 // generate a background model (median, smoothed image) 37 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {38 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");37 if (!psphotModelBackground (config, view, filerule)) { 38 return psphotReadoutCleanup (config, view, filerule); 39 39 } 40 if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {41 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");40 if (!psphotSubtractBackground (config, view, filerule)) { 41 return psphotReadoutCleanup (config, view, filerule); 42 42 } 43 43 if (!strcasecmp (breakPt, "BACKMDL")) { 44 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");44 return psphotReadoutCleanup (config, view, filerule); 45 45 } 46 46 47 psphotLoadExtSources (config, view, "PSPHOT.INPUT");47 psphotLoadExtSources (config, view, filerule); 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, "PSPHOT.INPUT")) {55 if (!psphotCheckExtSources (config, view, filerule)) { 56 56 psLogMsg ("psphot", 3, "failure to select possible PSF sources (external or internal)"); 57 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");57 return psphotReadoutCleanup (config, view, filerule); 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, "PSPHOT.INPUT")) {62 if (!psphotChoosePSF (config, view, filerule)) { 63 63 psLogMsg ("psphot", 3, "failure to construct a psf model"); 64 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");64 return psphotReadoutCleanup (config, view, filerule); 65 65 } 66 66 67 67 // measure aperture photometry corrections 68 68 # if 0 69 if (!psphotApResid (config, view, "PSPHOT.INPUT")) {69 if (!psphotApResid (config, view, filerule)) { 70 70 psLogMsg ("psphot", 3, "failed on psphotApResid"); 71 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");71 return psphotReadoutCleanup (config, view, filerule); 72 72 } 73 73 # endif 74 74 75 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");75 return psphotReadoutCleanup (config, view, filerule); 76 76 } -
trunk/psphot/src/psphotMaskReadout.c
r28013 r29936 9 9 psAssert (recipe, "missing recipe?"); 10 10 11 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 12 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 11 int num = psphotFileruleCount(config, filerule); 13 12 14 13 // loop over the available readouts … … 17 16 // Generate the mask and weight images, including the user-defined analysis region of interest 18 17 if (!psphotSetMaskAndVarianceReadout (config, view, filerule, i, recipe)) { 19 psError (PSPHOT_ERR_CONFIG, false, "failed to generate mask for PSPHOT.INPUT entry %d", i);18 psError (PSPHOT_ERR_CONFIG, false, "failed to generate mask for %s entry %d", filerule, i); 20 19 return false; 21 20 } -
trunk/psphot/src/psphotMergeSources.c
r28013 r29936 8 8 bool psphotMergeSources (pmConfig *config, const pmFPAview *view, const char *filerule) 9 9 { 10 bool status = true; 11 12 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 13 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 10 int num = psphotFileruleCount(config, filerule); 14 11 15 12 // loop over the available readouts … … 70 67 // XXX This function needs to be updated to loop over set of input files. At the moment, we 71 68 // only expect a single entry for PSPHOT.INPUT.CMF and PSPHOT.SOURCES.TEXT, so we can only 72 // associate input sources with a single entry for PSPHOT.INPUT69 // associate input sources with a single entry for the filerule 73 70 bool psphotLoadExtSources (pmConfig *config, const pmFPAview *view, const char *filerule) { 74 71 … … 166 163 } 167 164 165 // copy the known sources (as external) to the detection list of the given filerule 166 bool psphotAddKnownSources (pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources) { 167 168 bool status = false; 169 170 // select the appropriate recipe information 171 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE); 172 psAssert (recipe, "missing recipe?"); 173 174 // determine properties (sky, moments) of initial sources 175 float OUTER = psMetadataLookupF32 (&status, recipe, "SKY_OUTER_RADIUS"); 176 psAssert (status, "missing SKY_OUTER_RADIUS in recipe?"); 177 178 // XXX this seems like an arbitrary number... 179 OUTER = PS_MAX(OUTER, 20.0); // XXX Guarantee that we can encompass the max moments radius 180 181 // find the currently selected readout 182 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, 0); // File of interest 183 psAssert (file, "missing file?"); 184 185 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 186 psAssert (readout, "missing readout?"); 187 188 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 189 if (!detections) { 190 detections = pmDetectionsAlloc(); 191 detections->newSources = psArrayAllocEmpty (100); 192 // save detections on the readout->analysis 193 if (!psMetadataAddPtr (readout->analysis, PS_LIST_TAIL, "PSPHOT.DETECTIONS", PS_META_REPLACE | PS_DATA_UNKNOWN, "psphot detections", detections)) { 194 psError (PSPHOT_ERR_CONFIG, false, "problem saving detections on readout"); 195 return false; 196 } 197 } else { 198 psMemIncrRefCounter(detections); // so we can free the detections below 199 } 200 201 // copy the sources from inSources to the new detection structure 202 for (int i = 0; i < inSources->n; i++) { 203 pmSource *inSource = inSources->data[i]; 204 205 pmSource *newSource = pmSourceCopy(inSource); 206 newSource->mode |= PM_SOURCE_MODE_EXTERNAL; 207 208 // drop the loaded source modelPSF 209 psFree (newSource->modelPSF); 210 // source->modelPSF = NULL; check this! 211 212 // drop the references to the original image pixels: 213 pmSourceFreePixels (newSource); 214 215 // allocate image, weight, mask for the new image for each peak (square of radius OUTER) 216 pmSourceDefinePixels (newSource, readout, newSource->peak->x, newSource->peak->y, OUTER); 217 218 newSource->imageID = 0; 219 // XXX reset the source ID? raised questions about the meaning of this ID... 220 // P_PM_SOURCE_SET_ID(source, i); 221 222 psArrayAdd (detections->newSources, 100, newSource); 223 } 224 psLogMsg ("psphot", 3, "%ld known sources supplied", detections->newSources->n); 225 226 psFree (detections); 227 return true; 228 } 229 168 230 // extract the input sources corresponding to this readout 169 231 // XXX this function needs to be updated to work with the new context of psphot inputs … … 405 467 bool status = true; 406 468 407 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 408 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 469 int num = psphotFileruleCount(config, ruleSrc); 409 470 410 471 // skip the chisq image because it is a duplicate of the detection version -
trunk/psphot/src/psphotModelBackground.c
r28013 r29936 383 383 } 384 384 385 // XXX supply filename or keep PSPHOT.INPUT fixed?386 385 bool psphotModelBackground (pmConfig *config, const pmFPAview *view, const char *filerule) 387 386 { 388 bool status = false; 389 390 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 391 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 387 int num = psphotFileruleCount(config, filerule); 392 388 393 389 // loop over the available readouts 394 390 for (int i = 0; i < num; i++) { 395 391 if (!psphotModelBackgroundReadoutFileIndex(config, view, filerule, i)) { 396 psError (PSPHOT_ERR_CONFIG, false, "failed to model background for PSPHOT.INPUT entry %d", i);392 psError (PSPHOT_ERR_CONFIG, false, "failed to model background for %s entry %d", filerule, i); 397 393 return false; 398 394 } -
trunk/psphot/src/psphotOutput.c
r29902 r29936 1 1 # include "psphotInternal.h" 2 3 // convert filerule to filerule.NUM and look up in the config->arguments metadata 4 int psphotFileruleCount(const pmConfig *config, const char *filerule) { 5 6 bool status = false; 7 8 psString name = NULL; 9 psStringAppend(&name, "%s.NUM", filerule); 10 int num = psMetadataLookupS32 (&status, config->arguments, name); 11 if (!status) { 12 // we only explicitly define (filerule.NUM) if we have more than 1 13 num = 1; 14 } 15 psFree (name); 16 return num; 17 } 2 18 3 19 pmReadout *psphotSelectBackground (pmConfig *config, … … 63 79 fclose (f); 64 80 return true; 65 }66 67 // XXX replace this with a call to a pmConfig function (pmConfigDump...)68 bool psphotDumpConfig (pmConfig *config) {69 70 psMetadataConfigWrite (config->user, "user.md");71 psMetadataConfigWrite (config->camera, "camera.md");72 psMetadataConfigWrite (config->recipes, "recipes.md");73 psMetadataConfigWrite (config->arguments, "arguments.md");74 psMetadataConfigWrite (config->files, "files.md");75 return true;76 81 } 77 82 … … 126 131 } 127 132 133 bool psphotCleanInputsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index); 134 bool psphotCleanInputs (pmConfig *config, const pmFPAview *view, const char *filerule) { 135 136 int num = psphotFileruleCount(config, filerule); 137 138 // loop over the available readouts 139 for (int i = 0; i < num; i++) { 140 if (!psphotCleanInputsReadout (config, view, filerule, i)) { 141 psError (PSPHOT_ERR_CONFIG, false, "failed to clean inputs for %s entry %d", filerule, i); 142 return false; 143 } 144 } 145 return true; 146 } 147 148 bool psphotCleanInputsReadout (pmConfig *config, const pmFPAview *view, const char *filerule, int index) { 149 150 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, index); // File of interest 151 PS_ASSERT (file, false); 152 153 pmReadout *readout = pmFPAviewThisReadout (view, file->fpa); 154 155 // XXX anything else to remove? 156 if (psMetadataLookup(readout->analysis, "PSPHOT.DETECTIONS")) { 157 psMetadataRemoveKey(readout->analysis, "PSPHOT.DETECTIONS"); 158 } 159 160 return true; 161 } 162 128 163 bool psphotAddPhotcode (pmConfig *config, const pmFPAview *view, const char *filerule) { 129 164 130 bool status = false; 131 132 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 133 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 165 int num = psphotFileruleCount(config, filerule); 134 166 135 167 // loop over the available readouts 136 168 for (int i = 0; i < num; i++) { 137 169 if (!psphotAddPhotcodeReadout (config, view, filerule, i)) { 138 psError (PSPHOT_ERR_CONFIG, false, "failed to add photcode to PSPHOT.INPUT entry %d", i);170 psError (PSPHOT_ERR_CONFIG, false, "failed to add photcode to %s entry %d", filerule, i); 139 171 return false; 140 172 } … … 357 389 // XXX need alternative output function 358 390 // psMetadata *psfData = pmPSFtoMetadata (NULL, try->psf); 359 // psMetadataConfigWrite (psfData, "psfmodel.dat" );391 // psMetadataConfigWrite (psfData, "psfmodel.dat", NULL); 360 392 psLogMsg ("psphot.choosePSF", PS_LOG_INFO, "wrote out psf-subtracted image, psf data, exiting\n"); 361 393 -
trunk/psphot/src/psphotParseCamera.c
r26894 r29936 39 39 return NULL; 40 40 } 41 // specify the number of psphot input images42 psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);43 41 44 42 // define the additional input/output files associated with psphot -
trunk/psphot/src/psphotRadialApertures.c
r28013 r29936 18 18 } 19 19 20 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 21 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 20 int num = psphotFileruleCount(config, filerule); 22 21 23 22 // loop over the available readouts -
trunk/psphot/src/psphotRadialAperturesByObject.c
r28013 r29936 21 21 22 22 // number of images used to define sources 23 int nImages = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 24 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 23 int nImages = psphotFileruleCount(config, filerule); 25 24 26 25 // radMax stores the upper bounds of the annuli -
trunk/psphot/src/psphotRadiusChecks.c
r29004 r29936 135 135 EXT_FIT_MAX_RADIUS = psMetadataLookupF32 (&status, recipe, "EXT_FIT_MAX_RADIUS"); 136 136 137 float skyMean = psMetadataLookupF32 (&status, readout->analysis, "SKY_MEAN");138 137 float skyStdev = psMetadataLookupF32 (&status, readout->analysis, "SKY_STDEV"); 139 140 fprintf (stderr, "sky: %f +/- %f\n", skyMean, skyStdev);141 138 142 139 EXT_FIT_SKY_SIG = skyStdev; -
trunk/psphot/src/psphotReadout.c
r29004 r29936 9 9 } 10 10 11 bool psphotReadout(pmConfig *config, const pmFPAview *view ) {11 bool psphotReadout(pmConfig *config, const pmFPAview *view, const char *filerule) { 12 12 13 13 // measure the total elapsed time in psphotReadout. dtime is the elapsed time used jointly … … 27 27 psAssert (breakPt, "configuration error: set BREAK_POINT"); 28 28 29 // remove cruft from the input analysis structure 30 if (!psphotCleanInputs (config, view, filerule)) { 31 psError (PSPHOT_ERR_PROG, false, "trouble setting up the inputs"); 32 return false; 33 } 34 29 35 // set the photcode for this image 30 if (!psphotAddPhotcode (config, view, "PSPHOT.INPUT")) {36 if (!psphotAddPhotcode (config, view, filerule)) { 31 37 psError (PSPHOT_ERR_CONFIG, false, "trouble defining the photcode"); 32 38 return false; … … 34 40 35 41 // Generate the mask and weight images, including the user-defined analysis region of interest 36 if (!psphotSetMaskAndVariance (config, view, "PSPHOT.INPUT")) {37 return psphotReadoutCleanup(config, view, "PSPHOT.INPUT");42 if (!psphotSetMaskAndVariance (config, view, filerule)) { 43 return psphotReadoutCleanup(config, view, filerule); 38 44 } 39 45 if (!strcasecmp (breakPt, "NOTHING")) { 40 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");46 return psphotReadoutCleanup (config, view, filerule); 41 47 } 42 48 43 49 // generate a background model (median, smoothed image) 44 if (!psphotModelBackground (config, view, "PSPHOT.INPUT")) {45 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");46 } 47 48 if (!psphotSubtractBackground (config, view, "PSPHOT.INPUT")) {49 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");50 if (!psphotModelBackground (config, view, filerule)) { 51 return psphotReadoutCleanup (config, view, filerule); 52 } 53 54 if (!psphotSubtractBackground (config, view, filerule)) { 55 return psphotReadoutCleanup (config, view, filerule); 50 56 } 51 57 if (!strcasecmp (breakPt, "BACKMDL")) { 52 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");58 return psphotReadoutCleanup (config, view, filerule); 53 59 } 54 60 55 61 // load the psf model, if suppled. FWHM_MAJ,FWHM_MIN,etc are determined and saved on 56 // readout->analysis. XXX Note: this function currently only works with a single 57 // PSPHOT.INPUT 58 if (!psphotLoadPSF (config, view)) { // ??? need to supply 2 ? 62 // readout->analysis. NOTE: this function currently only loads from PSPHOT.PSF.LOAD 63 if (!psphotLoadPSF (config, view, filerule)) { // ??? need to supply 2 ? 59 64 psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model"); 60 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");65 return psphotReadoutCleanup (config, view, filerule); 61 66 } 62 67 63 68 // find the detections (by peak and/or footprint) in the image. 64 if (!psphotFindDetections (config, view, "PSPHOT.INPUT", true)) { // pass 169 if (!psphotFindDetections (config, view, filerule, true)) { // pass 1 65 70 // this only happens if we had an error in psphotFindDetections 66 71 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 67 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");72 return psphotReadoutCleanup (config, view, filerule); 68 73 } 69 74 70 75 // construct sources and measure basic stats (saved on detections->newSources) 71 if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) { // pass 176 if (!psphotSourceStats (config, view, filerule, true)) { // pass 1 72 77 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 73 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");78 return psphotReadoutCleanup (config, view, filerule); 74 79 } 75 80 if (!strcasecmp (breakPt, "PEAKS")) { 76 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");81 return psphotReadoutCleanup (config, view, filerule); 77 82 } 78 83 79 84 // find blended neighbors of very saturated stars (detections->newSources) 80 if (!psphotDeblendSatstars (config, view, "PSPHOT.INPUT")) {85 if (!psphotDeblendSatstars (config, view, filerule)) { 81 86 psError (PSPHOT_ERR_UNKNOWN, false, "failed on satstar deblend analysis"); 82 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");87 return psphotReadoutCleanup (config, view, filerule); 83 88 } 84 89 85 90 // mark blended peaks PS_SOURCE_BLEND (detections->newSources) 86 if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) {91 if (!psphotBasicDeblend (config, view, filerule)) { 87 92 psError (PSPHOT_ERR_UNKNOWN, false, "failed on deblend analysis"); 88 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");93 return psphotReadoutCleanup (config, view, filerule); 89 94 } 90 95 91 96 // classify sources based on moments, brightness. if a PSF model has been loaded, the PSF 92 97 // clump defined for it is used not measured (detections->newSources) 93 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { // pass 198 if (!psphotRoughClass (config, view, filerule)) { // pass 1 94 99 psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough classifications"); 95 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");100 return psphotReadoutCleanup (config, view, filerule); 96 101 } 97 102 98 103 // if we were not supplied a PSF model, determine the IQ stats here (detections->newSources) 99 if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) { // pass 1104 if (!psphotImageQuality (config, view, filerule)) { // pass 1 100 105 psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality"); 101 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");106 return psphotReadoutCleanup (config, view, filerule); 102 107 } 103 108 if (!strcasecmp (breakPt, "MOMENTS")) { 104 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");109 return psphotReadoutCleanup (config, view, filerule); 105 110 } 106 111 107 112 // use bright stellar objects to measure PSF if we were supplied a PSF for any input file, 108 113 // this step is skipped 109 if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) { // pass 1114 if (!psphotChoosePSF (config, view, filerule)) { // pass 1 110 115 psLogMsg ("psphot", 3, "failure to construct a psf model"); 111 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");116 return psphotReadoutCleanup (config, view, filerule); 112 117 } 113 118 if (!strcasecmp (breakPt, "PSFMODEL")) { 114 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");119 return psphotReadoutCleanup (config, view, filerule); 115 120 } 116 121 117 122 // include externally-supplied sources 118 123 // XXX fix this in the new multi-input context 119 // psphotLoadExtSources (config, view, "PSPHOT.INPUT"); // pass 1124 // psphotLoadExtSources (config, view, filerule); // pass 1 120 125 121 126 // construct an initial model for each object, set the radius to fitRadius, set circular 122 127 // fit mask (detections->newSources) 123 psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 1128 psphotGuessModels (config, view, filerule); // pass 1 124 129 125 130 // merge the newly selected sources into the existing list 126 131 // NOTE: merge OLD and NEW 127 psphotMergeSources (config, view, "PSPHOT.INPUT");132 psphotMergeSources (config, view, filerule); 128 133 129 134 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 130 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false); // pass 1 (detections->allSources)135 psphotFitSourcesLinear (config, view, filerule, false); // pass 1 (detections->allSources) 131 136 132 137 // identify CRs and extended sources (only unmeasured sources are measured) 133 psphotSourceSize (config, view, "PSPHOT.INPUT", true); // pass 1 (detections->allSources)138 psphotSourceSize (config, view, filerule, true); // pass 1 (detections->allSources) 134 139 if (!strcasecmp (breakPt, "ENSEMBLE")) { 135 140 goto finish; … … 138 143 // non-linear PSF and EXT fit to brighter sources 139 144 // replace model flux, adjust mask as needed, fit, subtract the models (full stamp) 140 psphotBlendFit (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)145 psphotBlendFit (config, view, filerule); // pass 1 (detections->allSources) 141 146 142 147 // replace all sources 143 psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)148 psphotReplaceAllSources (config, view, filerule); // pass 1 (detections->allSources) 144 149 145 150 // linear fit to include all sources (subtract again) 146 151 // NOTE : apply to ALL sources (extended + psf) 147 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 2 (detections->allSources)152 psphotFitSourcesLinear (config, view, filerule, true); // pass 2 (detections->allSources) 148 153 149 154 // if we only do one pass, skip to extended source analysis … … 153 158 154 159 // add noise for subtracted objects 155 psphotAddNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)160 psphotAddNoise (config, view, filerule); // pass 1 (detections->allSources) 156 161 157 162 // find fainter sources 158 163 // NOTE: finds new peaks and new footprints, OLD and FULL set are saved on detections 159 psphotFindDetections (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->peaks, detections->footprints)164 psphotFindDetections (config, view, filerule, false); // pass 2 (detections->peaks, detections->footprints) 160 165 161 166 // remove noise for subtracted objects (ie, return to normal noise level) 162 167 // NOTE: this needs to operate only on the OLD sources 163 psphotSubNoise (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)168 psphotSubNoise (config, view, filerule); // pass 1 (detections->allSources) 164 169 165 170 // define new sources based on only the new peaks 166 171 // NOTE: new sources are saved on detections->newSources 167 psphotSourceStats (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->newSources)172 psphotSourceStats (config, view, filerule, false); // pass 2 (detections->newSources) 168 173 169 174 // set source type 170 175 // NOTE: apply only to detections->newSources 171 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) { // pass 2 (detections->newSources)176 if (!psphotRoughClass (config, view, filerule)) { // pass 2 (detections->newSources) 172 177 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 173 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");178 return psphotReadoutCleanup (config, view, filerule); 174 179 } 175 180 176 181 // create full input models, set the radius to fitRadius, set circular fit mask 177 182 // NOTE: apply only to detections->newSources 178 psphotGuessModels (config, view, "PSPHOT.INPUT"); // pass 2 (detections->newSources)183 psphotGuessModels (config, view, filerule); // pass 2 (detections->newSources) 179 184 180 185 // replace all sources so fit below applies to all at once 181 186 // NOTE: apply only to OLD sources (which have been subtracted) 182 psphotReplaceAllSources (config, view, "PSPHOT.INPUT"); // pass 2187 psphotReplaceAllSources (config, view, filerule); // pass 2 183 188 184 189 // merge the newly selected sources into the existing list 185 190 // NOTE: merge OLD and NEW 186 191 // XXX check on free of sources... 187 psphotMergeSources (config, view, "PSPHOT.INPUT"); // (detections->newSources + detections->allSources -> detections->allSources)192 psphotMergeSources (config, view, filerule); // (detections->newSources + detections->allSources -> detections->allSources) 188 193 189 194 // NOTE: apply to ALL sources 190 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", true); // pass 3 (detections->allSources)195 psphotFitSourcesLinear (config, view, filerule, true); // pass 3 (detections->allSources) 191 196 192 197 pass1finish: … … 194 199 // measure source size for the remaining sources 195 200 // NOTE: applies only to NEW (unmeasured) sources 196 psphotSourceSize (config, view, "PSPHOT.INPUT", false); // pass 2 (detections->allSources)197 198 psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)199 psphotExtendedSourceFits (config, view, "PSPHOT.INPUT"); // pass 1 (detections->allSources)201 psphotSourceSize (config, view, filerule, false); // pass 2 (detections->allSources) 202 203 psphotExtendedSourceAnalysis (config, view, filerule); // pass 1 (detections->allSources) 204 psphotExtendedSourceFits (config, view, filerule); // pass 1 (detections->allSources) 200 205 201 206 finish: … … 205 210 206 211 // measure aperture photometry corrections 207 if (!psphotApResid (config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)212 if (!psphotApResid (config, view, filerule)) { // pass 1 (detections->allSources) 208 213 psLogMsg ("psphot", 3, "failed on psphotApResid"); 209 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");214 return psphotReadoutCleanup (config, view, filerule); 210 215 } 211 216 212 217 // calculate source magnitudes 213 if (!psphotMagnitudes(config, view, "PSPHOT.INPUT")) { // pass 1 (detections->allSources)218 if (!psphotMagnitudes(config, view, filerule)) { // pass 1 (detections->allSources) 214 219 psErrorStackPrint(stderr, "Unable to do magnitudes."); 215 220 psErrorClear(); 216 221 } 217 if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) { // pass 1222 if (!psphotEfficiency(config, view, filerule)) { // pass 1 218 223 psErrorStackPrint(stderr, "Unable to determine detection efficiencies from fake sources"); 219 224 psErrorClear(); … … 224 229 225 230 // replace background in residual image 226 if (!psphotSkyReplace (config, view, "PSPHOT.INPUT")) { // pass 1231 if (!psphotSkyReplace (config, view, filerule)) { // pass 1 227 232 psErrorStackPrint(stderr, "Unable to replace sky"); 228 233 psErrorClear(); 229 234 230 235 /* psLogMsg("psphot", 3, "failed on psphotSkyReplace"); */ 231 /* return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */236 /* return(psphotReadoutCleanup(config, view, filerule)); */ 232 237 } 233 238 // drop the references to the image pixels held by each source 234 if (!psphotSourceFreePixels (config, view, "PSPHOT.INPUT")) { // pass 1239 if (!psphotSourceFreePixels (config, view, filerule)) { // pass 1 235 240 psErrorStackPrint(stderr, "Unable to free source pixels"); 236 241 psErrorClear(); 237 242 238 243 /* psLogMsg ("psphot", 3, "failed on psphotSourceFreePixels"); */ 239 /* return(psphotReadoutCleanup(config, view, "PSPHOT.INPUT")); */244 /* return(psphotReadoutCleanup(config, view, filerule)); */ 240 245 } 241 246 // create the exported-metadata and free local data 242 return psphotReadoutCleanup(config, view, "PSPHOT.INPUT");247 return psphotReadoutCleanup(config, view, filerule); 243 248 } -
trunk/psphot/src/psphotReadoutCleanup.c
r28013 r29936 19 19 psAssert (recipe, "missing recipe?"); 20 20 21 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 22 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 21 int num = psphotFileruleCount(config, filerule); 23 22 24 23 // loop over the available readouts -
trunk/psphot/src/psphotReadoutFindPSF.c
r28013 r29936 3 3 // in this psphotReadout-variant, we are only trying to determine the PSF given an existing set 4 4 // of input source positions to use as initial PSF stars. 5 bool psphotReadoutFindPSF(pmConfig *config, const pmFPAview *view, psArray *inSources) {5 bool psphotReadoutFindPSF(pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources) { 6 6 7 7 psTimerStart ("psphotReadout"); 8 8 9 // set the photcode for the PSPHOT.INPUT10 if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) {9 // set the photcode for the input 10 if (!psphotAddPhotcode(config, view, filerule)) { 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, "PSPHOT.INPUT");16 psphotSetMaskAndVariance (config, view, filerule); 17 17 18 18 // Note that in this implementation, we do NOT model the background and we do not 19 19 // attempt to detect the sources in the image 20 20 21 // include externally-supplied sources (supplied as PSPHOT.INPUT.CMF)22 // XXX we assume a single set of input sources is supplied23 if (!psphotDetectionsFromSources (config, view, "PSPHOT.INPUT", inSources)) {21 // include the externally-supplied sources (inSources) 22 // (we assume a single set of input sources is supplied) 23 if (!psphotDetectionsFromSources (config, view, filerule, inSources)) { 24 24 psError(PSPHOT_ERR_ARGUMENTS, true, "Can't find PSF stars"); 25 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");25 return psphotReadoutCleanup (config, view, filerule); 26 26 } 27 27 28 28 // construct detections->newSources and measure basic stats (moments, local sky) 29 if (!psphotSourceStats(config, view, "PSPHOT.INPUT", true)) {29 if (!psphotSourceStats(config, view, filerule, 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, "PSPHOT.INPUT")) {35 if (!psphotRepairLoadedSources(config, view, filerule)) { 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, "PSPHOT.INPUT")) {41 if (!psphotRoughClass (config, view, filerule)) { 42 42 psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough source class"); 43 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");43 return psphotReadoutCleanup (config, view, filerule); 44 44 } 45 45 46 if (!psphotImageQuality (config, view, "PSPHOT.INPUT")) {46 if (!psphotImageQuality (config, view, filerule)) { 47 47 psError (PSPHOT_ERR_UNKNOWN, false, "failed to measure image quality"); 48 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");48 return psphotReadoutCleanup (config, view, filerule); 49 49 } 50 50 51 if (!psphotChoosePSF(config, view, "PSPHOT.INPUT")) {51 if (!psphotChoosePSF(config, view, filerule)) { 52 52 psError(PSPHOT_ERR_PSF, false, "Failed to construct a psf model"); 53 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");53 return psphotReadoutCleanup (config, view, filerule); 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, "PSPHOT.INPUT");61 psphotGuessModels (config, view, filerule); 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, "PSPHOT.INPUT");66 psphotMergeSources (config, view, filerule); 67 67 68 68 # if 0 69 69 // measure aperture photometry corrections 70 if (!psphotApResid (config, view, "PSPHOT.INPUT")) {70 if (!psphotApResid (config, view, filerule)) { 71 71 psLogMsg ("psphot", 3, "failed on psphotApResid"); 72 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");72 return psphotReadoutCleanup (config, view, filerule); 73 73 } 74 74 # endif 75 75 76 76 // drop the references to the image pixels held by each source 77 psphotSourceFreePixels(config, view, "PSPHOT.INPUT");77 psphotSourceFreePixels(config, view, filerule); 78 78 79 79 // create the exported-metadata and free local data 80 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");80 return psphotReadoutCleanup (config, view, filerule); 81 81 } -
trunk/psphot/src/psphotReadoutKnownSources.c
r28013 r29936 3 3 // in this psphotReadout-variant, we are only measuring the photometry for known sources, using 4 4 // a PSF generated for this observation from those sources 5 bool psphotReadoutKnownSources(pmConfig *config, const pmFPAview *view, psArray *inSources) {5 bool psphotReadoutKnownSources(pmConfig *config, const pmFPAview *view, const char *filerule, psArray *inSources) { 6 6 7 7 psTimerStart ("psphotReadout"); 8 8 9 9 // set the photcode for this image 10 if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) {10 if (!psphotAddPhotcode(config, view, filerule)) { 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, "PSPHOT.INPUT");16 psphotSetMaskAndVariance (config, view, filerule); 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, "PSPHOT.INPUT", inSources)) {22 if (!psphotDetectionsFromSources (config, view, filerule, inSources)) { 23 23 psError(PSPHOT_ERR_ARGUMENTS, true, "Can't find PSF stars"); 24 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");24 return psphotReadoutCleanup (config, view, filerule); 25 25 } 26 26 27 27 // construct sources and measure basic stats 28 if (!psphotSourceStats (config, view, "PSPHOT.INPUT", true)) {28 if (!psphotSourceStats (config, view, filerule, 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, "PSPHOT.INPUT")) {34 if (!psphotRepairLoadedSources(config, view, filerule)) { 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, "PSPHOT.INPUT")) {40 if (!psphotRoughClass (config, view, filerule)) { 41 41 psError (PSPHOT_ERR_UNKNOWN, false, "failed to determine rough source class"); 42 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");42 return psphotReadoutCleanup (config, view, filerule); 43 43 } 44 44 45 if (!psphotChoosePSF (config, view, "PSPHOT.INPUT")) {45 if (!psphotChoosePSF (config, view, filerule)) { 46 46 psError(PSPHOT_ERR_PSF, false, "Failed to construct a psf model"); 47 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");47 return psphotReadoutCleanup (config, view, filerule); 48 48 } 49 49 50 50 // construct an initial model for each object 51 psphotGuessModels (config, view, "PSPHOT.INPUT");51 psphotGuessModels (config, view, filerule); 52 52 53 53 // merge the newly selected sources into the existing list 54 54 // NOTE: merge OLD and NEW 55 psphotMergeSources (config, view, "PSPHOT.INPUT");55 psphotMergeSources (config, view, filerule); 56 56 57 57 // linear PSF fit to source peaks 58 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false);58 psphotFitSourcesLinear (config, view, filerule, false); 59 59 60 60 // measure aperture photometry corrections 61 if (!psphotApResid (config, view, "PSPHOT.INPUT")) {61 if (!psphotApResid (config, view, filerule)) { 62 62 psLogMsg ("psphot", 3, "failed on psphotApResid"); 63 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");63 return psphotReadoutCleanup (config, view, filerule); 64 64 } 65 65 66 66 // calculate source magnitudes 67 psphotMagnitudes(config, view, "PSPHOT.INPUT");67 psphotMagnitudes(config, view, filerule); 68 68 69 69 // drop the references to the image pixels held by each source 70 psphotSourceFreePixels (config, view, "PSPHOT.INPUT");70 psphotSourceFreePixels (config, view, filerule); 71 71 72 72 // create the exported-metadata and free local data 73 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");73 return psphotReadoutCleanup (config, view, filerule); 74 74 } -
trunk/psphot/src/psphotReadoutMinimal.c
r28013 r29936 7 7 // NOTE: ppSub needs to perform extended source analysis for comets and trails. 8 8 9 bool psphotReadoutMinimal(pmConfig *config, const pmFPAview *view ) {9 bool psphotReadoutMinimal(pmConfig *config, const pmFPAview *view, const char *filerule) { 10 10 11 11 // measure the total elapsed time in psphotReadout. XXX the current threading plan … … 18 18 19 19 // set the photcode for this image 20 if (!psphotAddPhotcode(config, view, "PSPHOT.INPUT")) {20 if (!psphotAddPhotcode(config, view, filerule)) { 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, "PSPHOT.INPUT");26 psphotSetMaskAndVariance (config, view, filerule); 27 27 28 28 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are saved on readout->analysis 29 if (!psphotLoadPSF (config, view )) {29 if (!psphotLoadPSF (config, view, filerule)) { 30 30 psError (PSPHOT_ERR_CONFIG, false, "missing psf model"); 31 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");31 return psphotReadoutCleanup (config, view, filerule); 32 32 } 33 33 34 34 // find the detections (by peak and/or footprint) in the image. (final pass) 35 if (!psphotFindDetections(config, view, "PSPHOT.INPUT", false)) {35 if (!psphotFindDetections(config, view, filerule, false)) { 36 36 psError (PSPHOT_ERR_UNKNOWN, false, "failure in peak analysis"); 37 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");37 return psphotReadoutCleanup (config, view, filerule); 38 38 } 39 39 40 40 // construct sources and measure basic stats (saved on detections->newSources) 41 if (!psphotSourceStats (config, view, "PSPHOT.INPUT", false)) { // pass 141 if (!psphotSourceStats (config, view, filerule, false)) { // pass 1 42 42 psError(PSPHOT_ERR_UNKNOWN, false, "failure to generate sources"); 43 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");43 return psphotReadoutCleanup (config, view, filerule); 44 44 } 45 45 46 46 // find blended neighbors of very saturated stars 47 psphotDeblendSatstars (config, view, "PSPHOT.INPUT");47 psphotDeblendSatstars (config, view, filerule); 48 48 49 49 // mark blended peaks PS_SOURCE_BLEND 50 if (!psphotBasicDeblend (config, view, "PSPHOT.INPUT")) {50 if (!psphotBasicDeblend (config, view, filerule)) { 51 51 psLogMsg ("psphot", 3, "failed on deblend analysis"); 52 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");52 return psphotReadoutCleanup (config, view, filerule); 53 53 } 54 54 55 55 // classify sources based on moments, brightness (use supplied psf shape parameters) 56 if (!psphotRoughClass (config, view, "PSPHOT.INPUT")) {56 if (!psphotRoughClass (config, view, filerule)) { 57 57 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 58 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");58 return psphotReadoutCleanup (config, view, filerule); 59 59 } 60 60 61 61 // construct an initial model for each object 62 psphotGuessModels (config, view, "PSPHOT.INPUT");62 psphotGuessModels (config, view, filerule); 63 63 64 64 // merge the newly selected sources into the existing list 65 psphotMergeSources (config, view, "PSPHOT.INPUT");65 psphotMergeSources (config, view, filerule); 66 66 67 67 // linear PSF fit to source peaks 68 psphotFitSourcesLinear (config, view, "PSPHOT.INPUT", false);68 psphotFitSourcesLinear (config, view, filerule, 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, "PSPHOT.INPUT");73 psphotSourceSize (config, view, filerule); 74 74 75 psphotExtendedSourceAnalysis (config, view, "PSPHOT.INPUT");75 psphotExtendedSourceAnalysis (config, view, filerule); 76 76 77 psphotExtendedSourceFits (config, view, "PSPHOT.INPUT");77 psphotExtendedSourceFits (config, view, filerule); 78 78 # endif 79 79 80 80 // calculate source magnitudes 81 psphotMagnitudes(config, view, "PSPHOT.INPUT");81 psphotMagnitudes(config, view, filerule); 82 82 83 83 // XXX ensure this is measured if the analysis succeeds (even if quality is low) 84 if (!psphotEfficiency(config, view, "PSPHOT.INPUT")) {84 if (!psphotEfficiency(config, view, filerule)) { 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, "PSPHOT.INPUT");90 psphotSourceFreePixels (config, view, filerule); 91 91 92 92 // create the exported-metadata and free local data 93 return psphotReadoutCleanup (config, view, "PSPHOT.INPUT");93 return psphotReadoutCleanup (config, view, filerule); 94 94 } -
trunk/psphot/src/psphotReplaceUnfit.c
r28013 r29936 31 31 psAssert (recipe, "missing recipe?"); 32 32 33 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 34 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 33 int num = psphotFileruleCount(config, filerule); 35 34 36 35 // loop over the available readouts 37 36 for (int i = 0; i < num; i++) { 38 37 if (!psphotReplaceAllSourcesReadout (config, view, filerule, i, recipe)) { 39 psError (PSPHOT_ERR_CONFIG, false, "failed to replace all sources for PSPHOT.INPUT entry %d", i);38 psError (PSPHOT_ERR_CONFIG, false, "failed to replace all sources for %s entry %d", filerule, i); 40 39 return false; 41 40 } -
trunk/psphot/src/psphotRoughClass.c
r28425 r29936 16 16 psAssert (recipe, "missing recipe?"); 17 17 18 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 19 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 18 int num = psphotFileruleCount(config, filerule); 20 19 21 20 // skip the chisq image (optionally?) -
trunk/psphot/src/psphotSkyReplace.c
r28013 r29936 5 5 bool status = true; 6 6 7 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 8 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 7 int num = psphotFileruleCount(config, filerule); 9 8 10 9 // skip the chisq image (optionally?) -
trunk/psphot/src/psphotSourceFreePixels.c
r28013 r29936 3 3 bool psphotSourceFreePixels (pmConfig *config, const pmFPAview *view, const char *filerule) 4 4 { 5 bool status = true; 6 7 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 8 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 5 int num = psphotFileruleCount(config, filerule); 9 6 10 7 // loop over the available readouts -
trunk/psphot/src/psphotSourceMatch.c
r29548 r29936 6 6 psArray *psphotMatchSources (pmConfig *config, const pmFPAview *view, const char *filerule) 7 7 { 8 bool status = true;9 10 8 psArray *objects = psArrayAllocEmpty(100); 11 9 12 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 13 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 10 int num = psphotFileruleCount(config, filerule); 14 11 15 12 // loop over the available readouts 16 13 for (int i = 0; i < num; i++) { 17 14 if (!psphotMatchSourcesReadout (objects, config, view, filerule, i)) { 18 psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for PSPHOT.INPUT entry %d", i);15 psError (PSPHOT_ERR_CONFIG, false, "failed to merge sources for %s entry %d", filerule, i); 19 16 psFree (objects); 20 17 return NULL; … … 162 159 psAssert (status, "missing SKY_OUTER_RADIUS in recipe?"); 163 160 164 int nImages = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 165 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 161 int nImages = psphotFileruleCount(config, filerule); 166 162 167 163 // generate look-up arrays for detections and readouts -
trunk/psphot/src/psphotSourceSize.c
r29610 r29936 49 49 psAssert (recipe, "missing recipe?"); 50 50 51 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 52 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 51 int num = psphotFileruleCount(config, filerule); 53 52 54 53 // skip the chisq image (optionally?) … … 60 59 if (i == chisqNum) continue; // skip chisq image 61 60 if (!psphotSourceSizeReadout (config, view, filerule, i, recipe, getPSFsize)) { 62 psError (PSPHOT_ERR_CONFIG, false, "failed on source size analysis for PSPHOT.INPUT entry %d", i);61 psError (PSPHOT_ERR_CONFIG, false, "failed on source size analysis for %s entry %d", filerule, i); 63 62 return false; 64 63 } -
trunk/psphot/src/psphotSourceStats.c
r29604 r29936 14 14 psAssert (recipe, "missing recipe?"); 15 15 16 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 17 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 16 int num = psphotFileruleCount(config, filerule); 18 17 19 18 // skip the chisq image (optionally?) -
trunk/psphot/src/psphotStackChisqImage.c
r28013 r29936 8 8 bool psphotStackChisqImage (pmConfig *config, const pmFPAview *view, const char *ruleDet, const char *ruleCnv) 9 9 { 10 bool status = false;11 12 10 psTimerStart ("psphot.chisq.image"); 13 11 … … 17 15 pmReadout *chiReadout = NULL; 18 16 19 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 20 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 17 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); 21 18 22 19 // loop over the available readouts … … 28 25 } 29 26 } 30 31 num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM");32 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM");33 27 34 28 psMetadataAddS32(config->arguments, PS_LIST_TAIL, "PSPHOT.CHISQ.NUM", PS_META_REPLACE, "", num); … … 125 119 psAssert (status, "programming error: must define PSPHOT.CHISQ.NUM"); 126 120 127 int inputNum = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 128 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 121 int inputNum = psphotFileruleCount(config, "PSPHOT.INPUT"); 129 122 130 123 pmFPAfileRemoveSingle (config->files, filerule, chisqNum); -
trunk/psphot/src/psphotStackImageLoop.c
r28013 r29936 105 105 bool GetAstrometryFPA (pmConfig *config, pmFPAview *view) { 106 106 107 bool status = false;108 109 107 bool foundAstrometry = false; 110 108 bool bilevelAstrometry = false; 111 109 112 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 113 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 110 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); 114 111 115 112 // loop over the available readouts … … 158 155 bool GetAstrometryChip (pmConfig *config, pmFPAview *view, bool bilevelAstrometry) { 159 156 160 bool status = false; 161 162 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 163 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 157 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); 164 158 165 159 // loop over the available readouts … … 220 214 bool SetAstrometryFPA (pmConfig *config, pmFPAview *view, bool bilevelAstrometry) { 221 215 222 bool status = false;223 224 216 if (!bilevelAstrometry) return true; 225 217 226 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 227 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 218 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); 228 219 229 220 // loop over the available readouts -
trunk/psphot/src/psphotStackMatchPSFs.c
r29548 r29936 8 8 psAssert(recipe, "We've thrown an error on this before."); 9 9 10 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 11 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 10 int num = psphotFileruleCount(config, "PSPHOT.INPUT"); 12 11 13 12 // 'options' carries info needed to perform the stack matching -
trunk/psphot/src/psphotStackReadout.c
r29548 r29936 52 52 // load the psf model, if suppled. FWHM_X,FWHM_Y,etc are determined and saved on 53 53 // readout->analysis XXX this function currently only works with a single PSPHOT.INPUT 54 if (!psphotLoadPSF (config, view )) {54 if (!psphotLoadPSF (config, view, STACK_RAW)) { 55 55 psError (PSPHOT_ERR_UNKNOWN, false, "error loading psf model"); 56 56 return psphotReadoutCleanup (config, view, STACK_OUT); -
trunk/psphot/src/psphotSubtractBackground.c
r28013 r29936 132 132 psAssert (recipe, "missing recipe?"); 133 133 134 int num = psMetadataLookupS32 (&status, config->arguments, "PSPHOT.INPUT.NUM"); 135 psAssert (status, "programming error: must define PSPHOT.INPUT.NUM"); 134 int num = psphotFileruleCount(config, filerule); 136 135 137 136 // loop over the available readouts 138 137 for (int i = 0; i < num; i++) { 139 138 if (!psphotSubtractBackgroundReadout (config, view, filerule, i, recipe)) { 140 psError (PSPHOT_ERR_CONFIG, false, "failed to subtract background for PSPHOT.INPUT entry %d", i);139 psError (PSPHOT_ERR_CONFIG, false, "failed to subtract background for %s entry %d", filerule, i); 141 140 return false; 142 141 } -
trunk/psphot/src/psphotTest.c
r28405 r29936 137 137 psMetadataItem *mdi; 138 138 139 psMetadataConfigWrite (header, argv[2] );139 psMetadataConfigWrite (header, argv[2], NULL); 140 140 141 141 // attempt to write image with NAXIS = 0
Note:
See TracChangeset
for help on using the changeset viewer.
