Changeset 5986
- Timestamp:
- Jan 13, 2006, 9:03:34 PM (21 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 3 added
- 2 deleted
- 9 edited
-
modelTestArguments.c (deleted)
-
pmPeaksSigmaLimit.c (deleted)
-
psphot.c (modified) (4 diffs)
-
psphot.h (modified) (2 diffs)
-
psphotArguments.c (modified) (1 diff)
-
psphotBasicDeblend.c (modified) (1 diff)
-
psphotChoosePSF.c (modified) (2 diffs)
-
psphotFindPeaks.c (added)
-
psphotGrowthCurve.c (added)
-
psphotModelTest.c (modified) (2 diffs)
-
psphotOutput.c (modified) (1 diff)
-
psphotRoughClass.c (added)
-
psphotSetup.c (modified) (1 diff)
-
psphotSourceStats.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphot.c
r5980 r5986 1 1 # include "psphot.h" 2 2 3 // XXX need a better structure for handling optional sequence 3 4 int main (int argc, char **argv) { 4 5 … … 9 10 pmPSF *psf = NULL; 10 11 psStats *sky = NULL; 11 pmPSFClump psfClump;12 12 bool status; 13 13 14 14 psTimerStart ("complete"); 15 15 16 psphotModelGroupInit (); 17 16 // load command-line arguments and options 18 17 config = psphotArguments (&argc, argv); 19 18 20 19 // load input data (config and images (signal, noise, mask) 21 // XXX we have memory leaks here -- may be from psMetadata22 20 imdata = psphotSetup (config); 23 21 24 char *breakPt = psMetadataLookupPtr (&status, config, "BREAK_POINT"); 25 if (!status) breakPt = psStringCopy ("NONE"); 26 27 int FITMODE = psMetadataLookupS32 (&status, config, "FIT_MODE"); 28 if (!status) FITMODE = 2; 29 30 // run model fitting tests on a single source 31 if (psMetadataLookupBool (&status, config, "TEST_FIT")) { 32 psphotModelTest (imdata, config); 33 exit (0); 34 } 22 // run a single-model test if desired 23 psphotModelTest (imdata, config); 35 24 36 25 // measure image stats for initial guess … … 42 31 43 32 // find the peaks in the image 44 peaks = pmPeaksSigmaLimit (imdata, config, sky); 45 if (!strcasecmp (breakPt, "PEAKS")) exit (0); 33 peaks = psphotFindPeaks (imdata, config, sky); 46 34 47 35 // construct sources and measure basic stats 48 36 sources = psphotSourceStats (imdata, config, peaks); 49 if (!strcasecmp (breakPt, "STATS")) exit (0);50 37 51 38 // classify sources based on moments, brightness 52 // XXX - this has 1 leak 53 psfClump = pmSourcePSFClump (sources, config); 54 55 // group into STAR, COSMIC, GALAXY, SATURATED, etc. 56 pmSourceRoughClass (sources, config, psfClump); 39 psphotRoughClass (sources, config); 57 40 58 41 // mark blended peaks PS_SOURCE_BLEND 59 42 psphotBasicDeblend (sources, config, sky); 60 if (!strcasecmp (breakPt, "DEBLEND")) exit (0);61 62 // source analysis is done in S/N order (brightest first)63 sources = psArraySort (sources, psphotSortBySN);64 psphotDumpMoments (config, sources);65 if (!strcasecmp (breakPt, "CLASS")) exit (0);66 43 67 44 // use bright stellar objects to measure PSF 68 45 psf = psphotChoosePSF (config, sources, sky); 69 if (!strcasecmp (breakPt, "PSFFIT")) exit (0);70 46 47 // XXX change FITMODE to a string 48 int FITMODE = psMetadataLookupS32 (&status, config, "FIT_MODE"); 71 49 switch (FITMODE) { 72 50 case 0: … … 101 79 102 80 // write out data in appropriate format 103 psphotSamplePSFs (config, psf, imdata->image);104 81 psphotOutput (imdata, config, sources, psf, sky); 105 82 psLogMsg ("psphot", 3, "wrote output: %f sec\n", psTimerMark ("psphot")); -
trunk/psphot/src/psphot.h
r5980 r5986 25 25 eamReadout *psphotSetup (psMetadata *config); 26 26 psStats *psphotImageStats (eamReadout *imdata, psMetadata *config); 27 psArray *psphotFindPeaks (eamReadout *imdata, psMetadata *config, psStats *sky); 27 28 psArray *psphotSourceStats (eamReadout *imdata, psMetadata *config, psArray *allpeaks); 29 bool psphotRoughClass (psArray *sources, psMetadata *config); 28 30 pmPSF *psphotChoosePSF (psMetadata *config, psArray *sources, psStats *sky); 29 31 bool psphotApplyPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); … … 42 44 43 45 bool pmSourceFitFixed (pmSource *source, pmModel *model); 44 psArray *pmPeaksSigmaLimit (eamReadout *imdata, psMetadata *config, psStats *sky);45 46 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, float apRadius); 46 47 pmModel *pmSourceSelectModel (pmSource *source); -
trunk/psphot/src/psphotArguments.c
r5980 r5986 117 117 psMetadata *config = psMetadataAlloc (); 118 118 119 // add default values 120 psMetadataAddStr (config, PS_LIST_TAIL, "BREAK_POINT", 0, "", "NONE"); 121 psMetadataAddS32 (config, PS_LIST_TAIL, "FIT_MODE", 0, "", 2); 122 119 123 psMetadataAdd (config, PS_LIST_TAIL, "PSF_MODEL", PS_DATA_METADATA_MULTI, "folder for psf model entries", NULL); 124 120 125 config = psMetadataConfigParse (config, &Nfail, argv[3], FALSE); 121 126 -
trunk/psphot/src/psphotBasicDeblend.c
r5828 r5986 132 132 } 133 133 psLogMsg ("psphot.deblend", 3, "identified %d blended objects (%f sec)\n", Nblend, psTimerMark ("psphot")); 134 135 char *breakPt = psMetadataLookupPtr (&status, config, "BREAK_POINT"); 136 if (!strcasecmp (breakPt, "DEBLEND")) exit (0); 137 134 138 return true; 135 139 } -
trunk/psphot/src/psphotChoosePSF.c
r5828 r5986 12 12 13 13 psTimerStart ("psphot"); 14 15 // examine PSF sources in S/N order (brightest first) 16 sources = psArraySort (sources, psphotSortBySN); 14 17 15 18 // array to store candidate PSF stars … … 88 91 psLogMsg ("psphot.pspsf", 3, "selected psf model %s, ApResid: %f +/- %f\n", modelName, psf->ApResid, psf->dApResid); 89 92 93 char *breakPt = psMetadataLookupPtr (&status, config, "BREAK_POINT"); 94 if (!strcasecmp (breakPt, "PSFFIT")) exit (0); 95 90 96 return (psf); 91 97 } -
trunk/psphot/src/psphotModelTest.c
r5837 r5986 11 11 12 12 psMetadataItem *item = NULL; 13 14 // run model fitting tests on a single source 15 if (!psMetadataLookupBool (&status, config, "TEST_FIT")) return false; 13 16 14 17 // what fitting mode to use? … … 166 169 psphotSaveImage (NULL, source->pixels, "resid.fits"); 167 170 psphotSaveImage (NULL, source->mask, "mask.fits"); 168 return true; 171 172 exit (0); 169 173 } -
trunk/psphot/src/psphotOutput.c
r5980 r5986 15 15 if (residImage != NULL) psphotSaveImage (imdata->header, imdata->image, residImage); 16 16 if (psfFile != NULL) psphotWritePSF (psf, psfFile); 17 psphotSamplePSFs (config, psf, imdata->image); 17 18 18 19 if (outputFile == NULL) { -
trunk/psphot/src/psphotSetup.c
r5828 r5986 17 17 18 18 psTimerStart ("psphot"); 19 20 // load implementation-specific models 21 psphotModelGroupInit (); 19 22 20 23 // setup header template, specify COMMENT and HISTORY as MULTI -
trunk/psphot/src/psphotSourceStats.c
r5802 r5986 61 61 62 62 psLogMsg ("psphot", 3, "%d moments: %f sec\n", sources->n, psTimerMark ("psphot")); 63 64 char *breakPt = psMetadataLookupPtr (&status, config, "BREAK_POINT"); 65 if (!strcasecmp (breakPt, "STATS")) exit (0); 66 63 67 return (sources); 64 68 }
Note:
See TracChangeset
for help on using the changeset viewer.
