Changeset 13225
- Timestamp:
- May 3, 2007, 4:51:40 PM (19 years ago)
- Location:
- trunk/psphot/src
- Files:
-
- 1 added
- 6 edited
-
Makefile.am (modified) (1 diff)
-
psphot.h (modified) (1 diff)
-
psphotChoosePSF.c (modified) (3 diffs)
-
psphotDefineFiles.c (modified) (2 diffs)
-
psphotLoadPSF.c (added)
-
psphotMergeSources.c (modified) (1 diff)
-
psphotReadout.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/Makefile.am
r13086 r13225 50 50 psphotSummaryPlots.c \ 51 51 psphotMergeSources.c \ 52 psphotLoadPSF.c \ 52 53 psphotReadoutCleanup.c \ 53 54 psphotSourcePlots.c \ -
trunk/psphot/src/psphot.h
r13086 r13225 98 98 bool psphotMergeSources (psArray *oldSources, psArray *newSources); 99 99 bool psphotLoadExtSources (pmConfig *config, pmFPAview *view, psArray *sources); 100 pmPSF *psphotLoadPSF (pmConfig *config, pmFPAview *view, psMetadata *recipe); 100 101 bool psphotSetHeaderNstars (psMetadata *recipe, psArray *sources); 101 102 bool psphotAddNoise (pmReadout *readout, psArray *sources, psMetadata *recipe, bool add); -
trunk/psphot/src/psphotChoosePSF.c
r13079 r13225 12 12 psTimerStart ("psphot"); 13 13 14 // check if a PSF model is supplied by the user15 psf = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.PSF");16 if (psf != NULL) {17 if (!psphotPSFstats (readout, recipe, psf)) psAbort("cannot measure PSF shape terms");18 return psf;19 }20 21 14 // examine PSF sources in S/N order (brightest first) 22 15 sources = psArraySort (sources, pmSourceSortBySN); … … 24 17 // array to store candidate PSF stars 25 18 int NSTARS = psMetadataLookupS32 (&status, recipe, "PSF_MAX_NSTARS"); 26 if (!status) { 27 NSTARS = PS_MIN (sources->n, 200); 28 psWarning("PSF_MAX_NSTARS is not set in the recipe --- defaulting to %d\n", NSTARS); 29 } 19 PS_ASSERT (status, NULL); 30 20 31 21 float PSF_MIN_DS = psMetadataLookupF32 (&status, recipe, "PSF_MIN_DS"); 32 if (!status) { 33 PSF_MIN_DS = 0.01; 34 psWarning("PSF_MIN_DS is not set --- defaulting to %f\n", PSF_MIN_DS); 35 } 22 PS_ASSERT (status, NULL); 36 23 37 24 // supply the measured sky variance for optional constant errors (non-poissonian) 38 25 float SKY_SIG = psMetadataLookupF32 (&status, recipe, "SKY_SIG"); 39 if (!status) { 40 SKY_SIG = 1.0; 41 psWarning("SKY_SIG is not set --- defaulting to %f\n", SKY_SIG); 42 } 26 PS_ASSERT (status, NULL); 27 43 28 // use poissonian errors or local-sky errors 44 29 bool POISSON_ERRORS = psMetadataLookupBool (&status, recipe, "POISSON_ERRORS"); 45 if (!status) { 46 POISSON_ERRORS = true; 47 psWarning("POISSON_ERRORS is not set in the recipe --- defaulting to true.\n"); 48 } 49 pmSourceFitModelInit (15, 0.01, PS_SQR(SKY_SIG), POISSON_ERRORS); 30 PS_ASSERT (status, NULL); 50 31 51 32 // use poissonian errors or local-sky errors 52 33 bool PSF_PARAM_WEIGHTS = psMetadataLookupBool (&status, recipe, "PSF_PARAM_WEIGHTS"); 53 if (!status) { 54 PSF_PARAM_WEIGHTS = false; 55 psWarning("PSF_PARAM_WEIGHTS is not set in the recipe --- defaulting to false.\n"); 56 } 34 PS_ASSERT (status, NULL); 57 35 58 36 // how to model the PSF variations across the field 59 // XXX make a default value? or not?60 37 psMetadata *md = psMetadataLookupMetadata (&status, recipe, "PSF.TREND.MASK"); 61 psPolynomial2D *psfTrendMask; 62 if (!status || !md) { 63 psWarning("PSF.TREND.MASK is not set in the recipe --- defaulting to use zeroth order.\n"); 64 psfTrendMask = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 0, 0); 65 } else { 66 psfTrendMask = psPolynomial2DfromMetadata (md); 67 if (!psfTrendMask) { 68 psError(PSPHOT_ERR_PSF, true, "Unable to construct polynomial from PSF.TREND.MASK in the recipe"); 69 return NULL; 70 } 38 PS_ASSERT (status, NULL); 39 40 // get the fixed PSF fit radius 41 // XXX check that PSF_FIT_RADIUS < SKY_OUTER_RADIUS 42 float RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS"); 43 PS_ASSERT (status, NULL); 44 45 pmSourceFitModelInit (15, 0.01, PS_SQR(SKY_SIG), POISSON_ERRORS); 46 47 psPolynomial2D *psfTrendMask = psPolynomial2DfromMetadata (md); 48 if (!psfTrendMask) { 49 psError(PSPHOT_ERR_PSF, true, "Unable to construct polynomial from PSF.TREND.MASK in the recipe"); 50 return NULL; 71 51 } 72 52 … … 90 70 psError(PSPHOT_ERR_PSF, true, "Failed to find any PSF candidates"); 91 71 return NULL; 92 }93 94 // get the fixed PSF fit radius95 // XXX EAM : check that PSF_FIT_RADIUS < SKY_OUTER_RADIUS96 float RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS");97 if (!status) {98 RADIUS = 20.0;99 psWarning("PSF_FIT_RADIUS is not set in the recipe --- defaulting to %g\n", RADIUS);100 72 } 101 73 -
trunk/psphot/src/psphotDefineFiles.c
r13216 r13225 87 87 } 88 88 89 if (psMetadataLookupPtr(NULL, config->arguments, "SRC")) { 90 pmFPAfileDefineFromArgs (&status, config, "PSPHOT.INPUT.CMF", "SRC"); 91 if (!status) { 92 psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.INPUT.CMF"); 93 return status; 94 } 95 } 96 97 if (psMetadataLookupPtr(NULL, config->arguments, "PSF")) { 98 pmFPAfileDefineFromArgs (&status, config, "PSPHOT.PSF.LOAD", "PSF"); 99 if (!status) { 100 psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.SRC"); 101 return status; 102 } 103 } 104 89 105 // XXX add in example PSF image thumbnails 90 106 // pmFPAfileConstruct (config->files, format, config->camera, "PSPHOT.PSF_SAMPLE"); … … 98 114 // before it is added back into the code. 99 115 # if (0) 100 if (psMetadataLookupPtr(NULL, config->arguments, "SRC")) {101 pmFPAfileDefineFromArgs (&status, config, "PSPHOT.SRC", "SRC");102 if (!status) {103 psError(PSPHOT_ERR_CONFIG, false, "Failed to find/build PSPHOT.SRC");104 return status;105 }106 }107 116 // optionally load the PSF Model and/or fixed stars 108 117 // XXX add this back in later -
trunk/psphot/src/psphotMergeSources.c
r12792 r13225 16 16 17 17 // find the currently selected readout 18 pmReadout *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT. SRC");18 pmReadout *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT.CMF"); 19 19 if (!readout) { 20 20 psLogMsg ("psphot", 3, "no external sources supplied"); -
trunk/psphot/src/psphotReadout.c
r13133 r13225 104 104 } 105 105 106 // use bright stellar objects to measure PSF 107 pmPSF *psf = psphotChoosePSF (readout, sources, recipe); 108 if (psf == NULL) { 109 psLogMsg ("psphot", 3, "failure to construct a psf model"); 110 return psphotReadoutCleanup (config, readout, recipe, psf, sources); 106 // load the psf model, if suppled 107 pmPSF *psf = psphotLoadPSF (config, view, recipe); 108 if (!psf) { 109 // use bright stellar objects to measure PSF 110 psf = psphotChoosePSF (readout, sources, recipe); 111 if (psf == NULL) { 112 psLogMsg ("psphot", 3, "failure to construct a psf model"); 113 return psphotReadoutCleanup (config, readout, recipe, psf, sources); 114 } 111 115 } 112 116 if (!strcasecmp (breakPt, "PSFMODEL")) {
Note:
See TracChangeset
for help on using the changeset viewer.
