Changeset 12805
- Timestamp:
- Apr 11, 2007, 1:57:26 PM (19 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 2 added
- 9 edited
-
Makefile.am (modified) (4 diffs)
-
psphot.c (modified) (1 diff)
-
psphot.h (modified) (2 diffs)
-
psphotArguments.c (modified) (1 diff)
-
psphotCleanup.c (modified) (1 diff)
-
psphotDefineFiles.c (added)
-
psphotImageLoop.c (modified) (1 diff)
-
psphotInternal.h (modified) (2 diffs)
-
psphotParseCamera.c (modified) (3 diffs)
-
psphotStandAlone.h (added)
-
psphotVersion.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/Makefile.am
r12792 r12805 8 8 psphot_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PSPHOT_LIBS) 9 9 psphot_LDADD = libpsphot.la 10 10 11 psphot_SOURCES = psphot.c \ 11 12 psphotArguments.c \ … … 20 21 psphotModelGroupInit.c \ 21 22 psphotMaskReadout.c \ 23 psphotDefineFiles.c \ 22 24 psphotReadout.c \ 23 25 psphotImageMedian.c \ … … 56 58 psphotAddNoise.c 57 59 58 59 60 include_HEADERS = \ 60 61 psphot.h \ … … 62 63 63 64 noinst_HEADERS = \ 64 psphotInternal.h 65 psphotInternal.h \ 66 psphotStandAlone.h 65 67 66 68 clean-local: -
trunk/psphot/src/psphot.c
r12792 r12805 1 # include "psphot Internal.h"1 # include "psphotStandAlone.h" 2 2 3 3 static void usage (void) { -
trunk/psphot/src/psphot.h
r12792 r12805 1 # ifdef HAVE_CONFIG_H 2 # include <config.h> 3 # endif 1 /* This file defines the library functions available to external programs. It must be included 2 * by programs which are compiled against psphot functions. 3 */ 4 4 5 #ifndef PS_PHOT_H 6 #define PS_PHOT_H 7 8 #include <stdio.h> 9 #include <pslib.h> 10 #include <psmodules.h> 5 #ifndef PSPHOT_H 6 #define PSPHOT_H 11 7 12 8 #include "psphotErrorCodes.h" … … 14 10 15 11 // top-level psphot functions 16 const char *psphotCVSName(void);17 psString psphotVersion(void);18 psString psphotVersionLong(void);12 const char *psphotCVSName(void); 13 psString psphotVersion(void); 14 psString psphotVersionLong(void); 19 15 20 16 bool psphotModelTest (pmReadout *readout, psMetadata *recipe); 21 17 bool psphotReadout (pmConfig *config, pmFPAview *view); 22 18 bool psphotReadoutCleanup (pmConfig *config, pmReadout *readout, psMetadata *recipe, pmPSF *psf, psArray *sources); 19 bool psphotDefineFiles (pmConfig *config, pmFPAfile *input); 20 21 // XXX test functions 22 bool psphotTestPSF (pmReadout *readout, psArray *sources, psMetadata *recipe); 23 bool pmPSFtestModel (psArray *sources, char *modelName, float RADIUS, bool poissonErrors, psPolynomial2D *psfTrendMask); 24 25 psArray *psphotFakeSources (); 26 27 // psphotReadout functions 28 bool psphotImageMedian (pmConfig *config, pmFPAview *view); 29 psArray *psphotFindPeaks (pmReadout *readout, psMetadata *recipe, int pass); 30 psArray *psphotSourceStats (pmReadout *readout, psMetadata *recipe, psArray *allpeaks); 31 bool psphotRoughClass (psArray *sources, psMetadata *recipe); 32 bool psphotBasicDeblend (psArray *sources, psMetadata *recipe); 33 pmPSF *psphotChoosePSF (pmReadout *readout, psArray *sources, psMetadata *recipe); 34 bool psphotPSFstats (pmReadout *readout, psMetadata *recipe, pmPSF *psf); 35 bool psphotMomentsStats (pmReadout *readout, psMetadata *recipe, psArray *sources); 36 bool psphotEnsemblePSF (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf, bool final); 37 bool psphotGuessModels (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf); 38 bool psphotBlendFit (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf); 39 bool psphotReplaceUnfit (psArray *sources); 40 bool psphotReplaceAll (psArray *sources); 41 bool psphotApResid (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf); 42 bool psphotMagnitudes (psArray *sources, psMetadata *recipe, pmPSF *psf, pmReadout *background); 43 bool psphotSkyReplace (pmConfig *config, pmFPAview *view); 44 45 // basic support functions 46 void psphotModelGroupInit (void); 47 int psphotSortBySN (const void **a, const void **b); 48 int psphotSortByY (const void **a, const void **b); 49 bool psphotGrowthCurve (pmReadout *readout, pmPSF *psf, bool ignore); 50 void psphotTestArguments (int *argc, char **argv); 51 bool psphotMaskReadout (pmReadout *readout, psMetadata *recipe); 52 void psphotSourceFreePixels (psArray *sources); 53 54 // functions to set the correct source pixels 55 bool psphotInitRadiusPSF (const psMetadata *recipe, const pmModelType type); 56 bool psphotCheckRadiusPSF (pmReadout *readout, pmSource *source, pmModel *model); 57 bool psphotCheckRadiusPSFBlend (pmReadout *readout, pmSource *source, pmModel *model, float dR); 58 bool psphotInitRadiusEXT (psMetadata *recipe, pmModelType type); 59 bool psphotCheckRadiusEXT (pmReadout *readout, pmSource *source, pmModel *model); 60 61 // output functions 62 bool psphotAddPhotcode (psMetadata *recipe, pmConfig *config, pmFPAview *view); 63 bool psphotDumpMoments (psMetadata *recipe, psArray *sources); 64 psMetadata *psphotDefineHeader (psMetadata *recipe); 65 bool psphotWeightBias (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf); 66 int psphotSaveImage (psMetadata *header, psImage *image, char *filename); 67 bool psphotDumpConfig (pmConfig *config); 68 pmReadout *psphotSelectBackground (pmConfig *config, pmFPAview *view); 69 70 // PSF / DBL / EXT evaluation functions 71 bool psphotEvalPSF (pmSource *source, pmModel *model); 72 bool psphotEvalDBL (pmSource *source, pmModel *model); 73 bool psphotEvalEXT (pmSource *source, pmModel *model); 74 75 // functions to support the source fitting process 76 bool psphotInitLimitsPSF (psMetadata *recipe, pmReadout *readout); 77 bool psphotInitLimitsEXT (psMetadata *recipe); 78 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf); 79 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf); 80 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf); 81 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source); 82 psArray *psphotFitDBL (pmReadout *readout, pmSource *source); 83 84 // functions to support simultaneous multi-source fitting 85 bool psphotFitSet (pmSource *oneSrc, pmModel *oneModel, char *fitset, pmSourceFitMode mode); 86 87 // plotting functions (available if libkapa is installed) 88 bool psphotPlotMoments (pmConfig *config, pmFPAview *view, psArray *sources); 89 bool psphotPlotPSFModel (pmConfig *config, pmFPAview *view, psArray *sources); 90 bool psphotFitInit (); 91 bool psphotFitSummary (); 92 bool psphotMergeSources (psArray *oldSources, psArray *newSources); 93 bool psphotLoadExtSources (pmConfig *config, pmFPAview *view, psArray *sources); 94 bool psphotSetHeaderNstars (psMetadata *recipe, psArray *sources); 95 bool psphotAddNoise (pmReadout *readout, psArray *sources, psMetadata *recipe, bool add); 96 bool psphotRadialPlot (int *kapa, char *filename, pmSource *source); 97 bool psphotSourcePlots (pmReadout *readout, psArray *sources, psMetadata *recipe); 98 bool psphotMosaicSubimage (psImage *outImage, pmSource *source, int Xo, int Yo, int DX, int DY); 99 100 bool psphotAddWithTest (pmSource *source, bool useState); 101 bool psphotSubWithTest (pmSource *source, bool useState); 102 bool psphotSetState (pmSource *source, bool curState); 103 bool psphotDeblendSatstars (psArray *sources, psMetadata *recipe); 23 104 24 105 #endif -
trunk/psphot/src/psphotArguments.c
r12792 r12805 1 # include "psphot Internal.h"1 # include "psphotStandAlone.h" 2 2 3 3 pmConfig *psphotArguments(int argc, char **argv) { -
trunk/psphot/src/psphotCleanup.c
r12792 r12805 1 # include "psphot Internal.h"1 # include "psphotStandAlone.h" 2 2 3 3 void psphotCleanup (pmConfig *config) { -
trunk/psphot/src/psphotImageLoop.c
r12792 r12805 1 # include "psphot Internal.h"1 # include "psphotStandAlone.h" 2 2 3 3 bool psphotImageLoop (pmConfig *config) { -
trunk/psphot/src/psphotInternal.h
r12792 r12805 1 /* this file is included by the internal, library functions. */ 2 1 3 #ifdef HAVE_CONFIG_H 2 4 #include <config.h> 3 5 #endif 4 6 5 #ifndef PS _PHOT_INTERNAL_H6 #define PS _PHOT_INTERNAL_H7 #ifndef PSPHOT_INTERNAL_H 8 #define PSPHOT_INTERNAL_H 7 9 8 10 #include <stdio.h> … … 11 13 #include <pslib.h> 12 14 #include <psmodules.h> 13 14 15 #include "psphot.h" 15 16 16 // Top level functions17 pmConfig *psphotArguments (int argc, char **argv);18 bool psphotParseCamera (pmConfig *config);19 bool psphotImageLoop (pmConfig *config);20 bool psphotMosaicChip(pmConfig *config, const pmFPAview *view, char *outFile, char *inFile);21 void psphotCleanup (pmConfig *config);22 23 // XXX test functions24 bool psphotTestPSF (pmReadout *readout, psArray *sources, psMetadata *recipe);25 bool pmPSFtestModel (psArray *sources, char *modelName, float RADIUS, bool poissonErrors, psPolynomial2D *psfTrendMask);26 27 psArray *psphotFakeSources ();28 29 // psphotReadout functions30 bool psphotImageMedian (pmConfig *config, pmFPAview *view);31 psArray *psphotFindPeaks (pmReadout *readout, psMetadata *recipe, int pass);32 psArray *psphotSourceStats (pmReadout *readout, psMetadata *recipe, psArray *allpeaks);33 bool psphotRoughClass (psArray *sources, psMetadata *recipe);34 bool psphotBasicDeblend (psArray *sources, psMetadata *recipe);35 pmPSF *psphotChoosePSF (pmReadout *readout, psArray *sources, psMetadata *recipe);36 bool psphotPSFstats (pmReadout *readout, psMetadata *recipe, pmPSF *psf);37 bool psphotMomentsStats (pmReadout *readout, psMetadata *recipe, psArray *sources);38 bool psphotEnsemblePSF (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf, bool final);39 bool psphotGuessModels (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf);40 bool psphotBlendFit (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf);41 bool psphotReplaceUnfit (psArray *sources);42 bool psphotReplaceAll (psArray *sources);43 bool psphotApResid (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf);44 bool psphotMagnitudes (psArray *sources, psMetadata *recipe, pmPSF *psf, pmReadout *background);45 bool psphotSkyReplace (pmConfig *config, pmFPAview *view);46 47 // basic support functions48 void psphotModelGroupInit (void);49 int psphotSortBySN (const void **a, const void **b);50 int psphotSortByY (const void **a, const void **b);51 bool psphotGrowthCurve (pmReadout *readout, pmPSF *psf, bool ignore);52 void psphotTestArguments (int *argc, char **argv);53 bool psphotMaskReadout (pmReadout *readout, psMetadata *recipe);54 void psphotSourceFreePixels (psArray *sources);55 56 // functions to set the correct source pixels57 bool psphotInitRadiusPSF (const psMetadata *recipe, const pmModelType type);58 bool psphotCheckRadiusPSF (pmReadout *readout, pmSource *source, pmModel *model);59 bool psphotCheckRadiusPSFBlend (pmReadout *readout, pmSource *source, pmModel *model, float dR);60 bool psphotInitRadiusEXT (psMetadata *recipe, pmModelType type);61 bool psphotCheckRadiusEXT (pmReadout *readout, pmSource *source, pmModel *model);62 63 // output functions64 bool psphotAddPhotcode (psMetadata *recipe, pmConfig *config, pmFPAview *view);65 bool psphotDumpMoments (psMetadata *recipe, psArray *sources);66 psMetadata *psphotDefineHeader (psMetadata *recipe);67 bool psphotWeightBias (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf);68 int psphotSaveImage (psMetadata *header, psImage *image, char *filename);69 bool psphotDumpConfig (pmConfig *config);70 pmReadout *psphotSelectBackground (pmConfig *config, pmFPAview *view);71 72 // PSF / DBL / EXT evaluation functions73 bool psphotEvalPSF (pmSource *source, pmModel *model);74 bool psphotEvalDBL (pmSource *source, pmModel *model);75 bool psphotEvalEXT (pmSource *source, pmModel *model);76 77 // functions to support the source fitting process78 bool psphotInitLimitsPSF (psMetadata *recipe, pmReadout *readout);79 bool psphotInitLimitsEXT (psMetadata *recipe);80 bool psphotFitBlend (pmReadout *readout, pmSource *source, pmPSF *psf);81 bool psphotFitBlob (pmReadout *readout, pmSource *source, psArray *sources, pmPSF *psf);82 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf);83 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source);84 psArray *psphotFitDBL (pmReadout *readout, pmSource *source);85 86 // functions to support simultaneous multi-source fitting87 bool psphotFitSet (pmSource *oneSrc, pmModel *oneModel, char *fitset, pmSourceFitMode mode);88 89 // plotting functions (available if libkapa is installed)90 bool psphotPlotMoments (pmConfig *config, pmFPAview *view, psArray *sources);91 bool psphotPlotPSFModel (pmConfig *config, pmFPAview *view, psArray *sources);92 93 bool psphotFitInit ();94 bool psphotFitSummary ();95 bool psphotMergeSources (psArray *oldSources, psArray *newSources);96 bool psphotLoadExtSources (pmConfig *config, pmFPAview *view, psArray *sources);97 psExit psphotGetExitStatus ();98 bool psphotSetHeaderNstars (psMetadata *recipe, psArray *sources);99 bool psphotAddNoise (pmReadout *readout, psArray *sources, psMetadata *recipe, bool add);100 bool psphotRadialPlot (int *kapa, char *filename, pmSource *source);101 bool psphotSourcePlots (pmReadout *readout, psArray *sources, psMetadata *recipe);102 bool psphotMosaicSubimage (psImage *outImage, pmSource *source, int Xo, int Yo, int DX, int DY);103 104 bool psphotAddWithTest (pmSource *source, bool useState);105 bool psphotSubWithTest (pmSource *source, bool useState);106 bool psphotSetState (pmSource *source, bool curState);107 bool psphotDeblendSatstars (psArray *sources, psMetadata *recipe);108 109 110 17 #endif -
trunk/psphot/src/psphotParseCamera.c
r12792 r12805 1 # include "psphot Internal.h"1 # include "psphotStandAlone.h" 2 2 3 3 // define the needed / desired I/O files … … 15 15 load->dataLevel = PM_FPA_LEVEL_CHIP; // force load at the CHIP level 16 16 17 // if MASK or WEIGHT was supplied on command line, bind files to 'load' 18 // the mask and weight will be mosaicked with the image 19 pmFPAfileBindFromArgs (NULL, load, config, "PSPHOT.MASK", "MASK"); 20 pmFPAfileBindFromArgs (NULL, load, config, "PSPHOT.WEIGHT", "WEIGHT"); 21 17 22 // the psphot analysis is performed on chips 18 23 pmFPAfile *input = pmFPAfileDefineChipMosaic(config, load->fpa, "PSPHOT.INPUT"); … … 22 27 } 23 28 24 // if we have requested PSPHOT.SRC, attempt to resolve it 25 // this is a list of input sources, stored in a psphot output format file 26 # if (0) 27 if (psMetadataLookupPtr(NULL, config->arguments, "SRC")) { 28 pmFPAfileDefineFromArgs (&status, config, "PSPHOT.SRC", "SRC"); 29 if (!status) { 30 psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.SRC"); 31 return status; 32 } 29 // define the additional input/output files associated with psphot 30 if (!psphotDefineFiles (config, input)) { 31 psError(PSPHOT_ERR_CONFIG, false, "Trouble defining the additional input/output files"); 32 return false; 33 33 } 34 # endif35 36 // select recipe options supplied on command line37 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSPHOT_RECIPE);38 39 // these values are used below to define the background subtraction images.40 41 // if MASK or WEIGHT was supplied on command line, bind files to input fpa42 // XXX these do not quite yet work: pmFPAAddSourceFromHeader is not appropriate43 // the mask and weight will be mosaic'ed with the image44 pmFPAfileBindFromArgs (NULL, load, config, "PSPHOT.MASK", "MASK");45 pmFPAfileBindFromArgs (NULL, load, config, "PSPHOT.WEIGHT", "WEIGHT");46 47 // optionally load the PSF Model and/or fixed stars48 // XXX bind this to the input or the load file?49 // if the readout->analysis entries are copied, we can bind to the load file50 // XXX add this back in later51 // pmFPAfileBindFromArgs (NULL, input, config, "PSPHOT.PSF", "PSF");52 53 // XXX we need to be able to distinguish several cases:54 // 1) the particular output data was not requested55 // 2) the particular output data was requested but was not generated (skipped)56 // 3) the particular output data was requested but was not generated (for valid failure)57 // 4) the particular output data was requested but was not generated (surprising failure)58 59 // the output sources are carried on the input->fpa structures60 if (psMetadataLookupBool (NULL, recipe, "SAVE.OUTPUT")) {61 if (!pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.OUTPUT")) {62 psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.OUTPUT");63 return false;64 }65 }66 // optionally save the residual image67 if (psMetadataLookupBool(NULL, recipe, "SAVE.RESID")) {68 if (!pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.RESID")) {69 psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.BACKMDL");70 return false;71 }72 }73 // optionally save the background model (small FITS image)74 if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKMDL")) {75 int DX = psMetadataLookupS32 (&status, recipe, "BACKGROUND.XBIN");76 int DY = psMetadataLookupS32 (&status, recipe, "BACKGROUND.YBIN");77 if (!pmFPAfileDefineFromFPA (config, input->fpa, DX, DY, "PSPHOT.BACKMDL")) {78 psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.BACKMDL");79 return false;80 }81 }82 // optionally save the full background image83 if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKGND")) {84 if (!pmFPAfileDefineFromFPA (config, input->fpa, 1, 1, "PSPHOT.BACKGND")) {85 psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.BACKGND");86 return false;87 }88 }89 // optionally save the background-subtracted image90 if (psMetadataLookupBool(NULL, recipe, "SAVE.BACKSUB")) {91 if (!pmFPAfileDefineFromFPA (config, input->fpa, 1, 1, "PSPHOT.BACKSUB")) {92 psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.");93 return false;94 }95 }96 // optionally save the PSF Model97 if (psMetadataLookupBool(NULL, recipe, "SAVE.PSF")) {98 if (!pmFPAfileDefineOutput (config, input->fpa, "PSPHOT.PSF.SAVE")) {99 psError(PSPHOT_ERR_CONFIG, false, "Cannot find a rule for PSPHOT.PSF.SAVE");100 return false;101 }102 }103 104 // optionally save output plots105 if (psMetadataLookupBool(NULL, recipe, "SAVE.PLOTS")) {106 if (!pmFPAfileDefineOutput (config, input->fpa, "SOURCE.PLOT.MOMENTS")) {107 psTrace ("psphot", 3, "Cannot find a rule for SOURCE.PLOT.MOMENTS");108 }109 if (!pmFPAfileDefineOutput (config, input->fpa, "SOURCE.PLOT.PSFMODEL")) {110 psTrace ("psphot", 3, "Cannot find a rule for SOURCE.PLOT.PSFMODEL");111 }112 }113 114 // XXX add in example PSF image thumbnails115 // pmFPAfileConstruct (config->files, format, config->camera, "PSPHOT.PSF_SAMPLE");116 34 117 35 // Chip selection: turn on only the chips specified (pass status to suppress missing-key log msg) -
trunk/psphot/src/psphotVersion.c
r12792 r12805 1 # include "psphotInternal.h"1 # include "psphotInternal.h" 2 2 3 3 # if (HAVE_KAPA)
Note:
See TracChangeset
for help on using the changeset viewer.
