Changeset 11263 for trunk/psphot/src/psphotReadout.c
- Timestamp:
- Jan 24, 2007, 11:41:08 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotReadout.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotReadout.c
r11230 r11263 5 5 // select the current recipe 6 6 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE); 7 if (!recipe) { 8 psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE); 9 return false; 10 } 7 11 8 12 // find the currently selected readout 9 13 pmReadout *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT"); 14 PS_ASSERT_PTR_NON_NULL (readout, false); 10 15 11 16 // optional break-point for processing 12 17 char *breakPt = psMetadataLookupStr (NULL, recipe, "BREAK_POINT"); 18 PS_ASSERT_PTR_NON_NULL (breakPt, false); 13 19 14 20 // generate mask & weight images if they don't already exit 15 21 if (!pmReadoutGenerateMaskWeight (readout, true)) { 22 psError (PSPHOT_ERR_CONFIG, false, "trouble creating mask and/or weight"); 16 23 return false; 17 24 } … … 34 41 35 42 // generate a background model (median, smoothed image) 36 psphotImageMedian (config, view); 43 if (!psphotImageMedian (config, view)) { 44 return psphotReadoutCleanup (config, readout, recipe, NULL, NULL); 45 } 37 46 38 47 if (!strcasecmp (breakPt, "BACKMDL")) { … … 40 49 } 41 50 42 pmReadout *background = psphotSelectBackground (config, view);43 44 51 // find the peaks in the image 45 52 psArray *peaks = psphotFindPeaks (readout, recipe, 1); 53 if (!peaks) { 54 psLogMsg ("psphot", 3, "unable to find peaks in this image"); 55 return psphotReadoutCleanup (config, readout, recipe, NULL, NULL); 56 } 46 57 47 58 // construct sources and measure basic stats 48 // limit moments analysis by S/N?49 59 psArray *sources = psphotSourceStats (readout, recipe, peaks); 60 if (!sources) return false; 50 61 psFree (peaks); 51 62 … … 55 66 56 67 // mark blended peaks PS_SOURCE_BLEND 57 psphotBasicDeblend (sources, recipe); 68 if (!psphotBasicDeblend (sources, recipe)) { 69 psLogMsg ("psphot", 3, "failed on deblend analysis"); 70 return psphotReadoutCleanup (config, readout, recipe, NULL, sources); 71 } 58 72 59 73 // classify sources based on moments, brightness 60 74 if (!psphotRoughClass (sources, recipe)) { 61 psFree (sources); 62 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 63 pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL"); 64 pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND"); 65 return false; 75 psLogMsg ("psphot", 3, "failed to find a valid PSF clump for image"); 76 return psphotReadoutCleanup (config, readout, recipe, NULL, sources); 66 77 } 67 78 if (!strcasecmp (breakPt, "MOMENTS")) { … … 72 83 pmPSF *psf = psphotChoosePSF (readout, sources, recipe); 73 84 if (psf == NULL) { 74 psError(PSPHOT_ERR_UNKNOWN, false, "failure to construct a psf model");75 return false;85 psLogMsg ("psphot", 3, "failure to construct a psf model"); 86 return psphotReadoutCleanup (config, readout, recipe, psf, sources); 76 87 } 77 88 if (!strcasecmp (breakPt, "PSFMODEL")) { 78 return psphotReadoutCleanup (config, readout, recipe, psf, sources);89 return psphotReadoutCleanup (config, readout, recipe, psf, sources); 79 90 } 80 91 … … 142 153 143 154 // calculate source magnitudes 155 // XXX modify this API to take config, view? 156 pmReadout *background = psphotSelectBackground (config, view); 144 157 psphotMagnitudes(sources, recipe, psf, background); 145 158
Note:
See TracChangeset
for help on using the changeset viewer.
