Changeset 11188
- Timestamp:
- Jan 19, 2007, 12:17:35 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/psphot/src/psphotReadout.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot/src/psphotReadout.c
r11178 r11188 43 43 44 44 // find the peaks in the image 45 psArray *peaks = psphotFindPeaks (readout, recipe );45 psArray *peaks = psphotFindPeaks (readout, recipe, 1); 46 46 47 47 // construct sources and measure basic stats … … 58 58 59 59 // classify sources based on moments, brightness 60 // faint sources not classified?61 60 if (!psphotRoughClass (sources, recipe)) { 62 61 psFree (sources); … … 66 65 return false; 67 66 } 68 // XXX test the plotting function69 // psphotPlotMoments (config, view, sources);70 71 67 if (!strcasecmp (breakPt, "MOMENTS")) { 72 68 return psphotReadoutCleanup(config, readout, recipe, NULL, sources); 73 69 } 74 75 // psphotTestPSF (readout, sources, recipe);76 // exit (1);77 70 78 71 // use bright stellar objects to measure PSF … … 82 75 return false; 83 76 } 84 85 77 if (!strcasecmp (breakPt, "PSFMODEL")) { 86 78 return psphotReadoutCleanup(config, readout, recipe, psf, sources); 87 79 } 88 80 81 // construct an initial PSF model for each object 89 82 psphotGuessModels (readout, sources, recipe, psf); 90 83 … … 114 107 115 108 // find the peaks in the image 116 psMetadataAddF32 (recipe, PS_LIST_TAIL, "PEAKS_NSIGMA_LIMIT", PS_META_REPLACE, "", 5.0); 117 psArray *newPeaks = psphotFindPeaks (readout, recipe); 109 psArray *newPeaks = psphotFindPeaks (readout, recipe, 2); 118 110 119 111 // define new sources based on the new peaks … … 127 119 psphotGuessModels (readout, newSources, recipe, psf); 128 120 129 // linear PSF fit to remaining peaks130 psphot EnsemblePSF (readout, newSources, recipe, psf, TRUE);121 // replace all sources 122 psphotReplaceAll (sources); 131 123 132 124 // merge the newly selected peaks into the existing list 133 // psphotIncludeNewPeaks (sources, newSources);125 psphotMergeSources (sources, newSources); 134 126 psFree (newSources); 127 128 // linear PSF fit to remaining peaks 129 psphotEnsemblePSF (readout, sources, recipe, psf, TRUE); 135 130 136 131 finish: … … 146 141 psphotMagnitudes(sources, recipe, psf, background); 147 142 148 // replace fitted sources 149 // XXX we need to replace failed objects, not all objects 143 // replace failed sources? 150 144 // psphotReplaceUnfit (sources); 151 145 … … 155 149 // drop the references to the image pixels held by each source 156 150 psphotSourceFreePixels (sources); 157 // psphotSaveImage (NULL, readout->image, "resid.fits");158 151 159 152 // create the exported-metadata and free local data 160 153 return psphotReadoutCleanup(config, readout, recipe, psf, sources); 161 154 } 162 163 bool psphotReadoutCleanup (pmConfig *config, pmReadout *readout, psMetadata *recipe, pmPSF *psf, psArray *sources) {164 165 // use the psf-model to measure FWHM stats166 if (psf) {167 if (!psphotPSFstats (readout, recipe, psf)) {168 psError(PS_ERR_IO, true, "Failed to measure PSF shape parameters");169 return false;170 }171 } else if (sources) {172 if (!psphotMomentsStats (readout, recipe, sources)) {173 psError(PS_ERR_IO, true, "Failed to measure Moment shape parameters");174 return false;175 }176 }177 178 // create an output header with stats results179 psMetadata *header = psphotDefineHeader (recipe);180 181 // save the results of the analysis182 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.SOURCES", PS_DATA_ARRAY, "psphot sources", sources);183 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.HEADER", PS_DATA_METADATA, "header stats", header);184 psMetadataAdd (readout->analysis, PS_LIST_TAIL, "PSPHOT.PSF", PS_DATA_UNKNOWN, "psphot psf", psf);185 186 // remove internal pmFPAfiles, if created187 pmFPAfileDropInternal (config->files, "PSPHOT.BACKMDL");188 pmFPAfileDropInternal (config->files, "PSPHOT.BACKGND");189 190 // XXX move this to top of loop191 pmKapaClose ();192 193 psFree (psf);194 psFree (header);195 psFree (sources);196 197 return true;198 }
Note:
See TracChangeset
for help on using the changeset viewer.
