Changeset 9661
- Timestamp:
- Oct 19, 2006, 1:10:23 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotChoosePSF.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotChoosePSF.c
r9567 r9661 13 13 14 14 // check if a PSF model is supplied by the user 15 psf = psMetadataLookupPtr ( &status, readout->analysis, "PSPHOT.PSF");15 psf = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.PSF"); 16 16 if (psf != NULL) return psf; 17 17 … … 21 21 // array to store candidate PSF stars 22 22 int NSTARS = psMetadataLookupS32 (&status, recipe, "PSF_MAX_NSTARS"); 23 if (!status) NSTARS = PS_MIN (sources->n, 200); 23 if (!status) { 24 NSTARS = PS_MIN (sources->n, 200); 25 psWarning("PSF_MAX_NSTARS is not set in the recipe --- defaulting to %d\n", NSTARS); 26 } 24 27 25 28 // use poissonian errors or local-sky errors 26 29 bool POISSON_ERRORS = psMetadataLookupBool (&status, recipe, "POISSON_ERRORS"); 27 if (!status) POISSON_ERRORS = true; 30 if (!status) { 31 POISSON_ERRORS = true; 32 psWarning("POISSON_ERRORS is not set in the recipe --- defaulting to true.\n"); 33 } 28 34 29 35 // how to model the PSF variations across the field 30 36 // XXX make a default value? or not? 31 37 psMetadata *md = psMetadataLookupMetadata (&status, recipe, "PSF.TREND.MASK"); 32 psPolynomial2D *psfTrendMask = psPolynomial2DfromMetadata (md); 33 if (!psfTrendMask) { 34 psError(PSPHOT_ERR_PSF, true, "PSF.TREND.MASK is not defined in recipe"); 35 return false; 38 psPolynomial2D *psfTrendMask; 39 if (!status || !md) { 40 psWarning("PSF.TREND.MASK is not set in the recipe --- defaulting to use zeroth order.\n"); 41 psfTrendMask = psPolynomial2DAlloc(PS_POLYNOMIAL_ORD, 0, 0); 42 } else { 43 psfTrendMask = psPolynomial2DfromMetadata (md); 44 if (!psfTrendMask) { 45 psError(PSPHOT_ERR_PSF, true, "Unable to construct polynomial from PSF.TREND.MASK in the recipe"); 46 return false; 47 } 36 48 } 37 49 … … 48 60 49 61 if (stars->n == 0) { 50 psError(PSPHOT_ERR_PSF, true, "Failed to find any PSF candidates");51 return NULL;62 psError(PSPHOT_ERR_PSF, true, "Failed to find any PSF candidates"); 63 return NULL; 52 64 } 53 65 … … 55 67 // XXX EAM : check that PSF_FIT_RADIUS < SKY_OUTER_RADIUS 56 68 float RADIUS = psMetadataLookupF32 (&status, recipe, "PSF_FIT_RADIUS"); 69 if (!status) { 70 psWarning("PSF_FIT_RADIUS is not set in the recipe --- defaulting to 20.0\n"); 71 RADIUS = 20.0; 72 } 57 73 58 74 // get the list pointers for the PSF_MODEL entries … … 91 107 for (int i = 0; i < models->n; i++) { 92 108 try = models->data[i]; 93 if (try == NULL) {94 psError(PSPHOT_ERR_PSF, false, "PSF model %d is NULL", i);95 continue;96 }109 if (try == NULL) { 110 psError(PSPHOT_ERR_PSF, false, "PSF model %d is NULL", i); 111 continue; 112 } 97 113 float M = try->psf->dApResid; 98 114 if (bestN < 0 || M < bestM) { … … 104 120 // use the best model: 105 121 if (bestN < 0) { 106 psError(PSPHOT_ERR_PSF, false, "Failed to fit any models when choosing PSF");107 psFree (models);108 return NULL;109 } 110 122 psError(PSPHOT_ERR_PSF, false, "Failed to fit any models when choosing PSF"); 123 psFree (models); 124 return NULL; 125 } 126 111 127 try = models->data[bestN]; 112 128 … … 199 215 for (int i = 0; i < sources->n; i++) { 200 216 pmSource *source = sources->data[i]; 201 if (!source) continue;217 if (!source) continue; 202 218 if (!(source->mode & PM_SOURCE_MODE_PSFSTAR)) continue; 203 219
Note:
See TracChangeset
for help on using the changeset viewer.
