Changeset 32695 for trunk/psphot/src/psphotReadout.c
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20111110 (added) merged: 32645-32647,32660-32663,32685-32686,32689-32694
- Property svn:mergeinfo changed
-
trunk/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20111110/psphot (added) merged: 32685-32686,32689,32692,32694
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphotReadout.c
r32633 r32695 9 9 } 10 10 11 // for now, let's store the detections on the readout->analysis for each readout12 bool psphotDumpChisqs (pmConfig *config, const pmFPAview *view, const char *filerule)13 {14 static int npass = 0;15 char filename[64];16 17 return true;18 19 bool status = true;20 21 int num = psphotFileruleCount(config, filerule);22 23 snprintf (filename, 64, "chisq.%02d.dat", npass);24 FILE *f = fopen (filename, "w");25 26 // loop over the available readouts27 for (int i = 0; i < num; i++) {28 29 // find the currently selected readout30 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest31 psAssert (file, "missing file?");32 33 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa);34 psAssert (readout, "missing readout?");35 36 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS");37 psAssert (detections, "missing detections?");38 39 psArray *sources = detections->allSources;40 psAssert (sources, "missing sources?");41 42 for (int i = 0; i < sources->n; i++) {43 pmSource *source = sources->data[i];44 if (!source) continue;45 46 pmModel *model = pmSourceGetModel (NULL, source);47 if (!model) continue;48 49 if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) {50 fprintf (f, "%f %f %f %d %d %f 1 NONLINEAR\n", model->mag, model->params->data.F32[1], model->chisq, model->nDOF, model->nPix, model->chisqNorm);51 } else {52 fprintf (f, "%f %f %f %d %d %f 0 LINEAR\n", model->mag, model->params->data.F32[1], model->chisq, model->nDOF, model->nPix, model->chisqNorm);53 }54 }55 }56 fclose (f);57 npass ++;58 59 return true;60 }61 62 11 bool psphotReadout(pmConfig *config, const pmFPAview *view, const char *filerule) { 63 12 … … 188 137 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 189 138 psphotFitSourcesLinear (config, view, filerule, false); // pass 1 (detections->allSources) 190 psphotDumpChisqs (config, view, filerule);191 139 192 140 // measure the radial profiles to the sky … … 208 156 // replace model flux, adjust mask as needed, fit, subtract the models (full stamp) 209 157 psphotBlendFit (config, view, filerule); // pass 1 (detections->allSources) 210 psphotDumpChisqs (config, view, filerule);211 158 212 159 // replace all sources 213 psphotReplaceAllSources (config, view, filerule ); // pass 1 (detections->allSources)160 psphotReplaceAllSources (config, view, filerule, false); // pass 1 (detections->allSources) 214 161 215 162 // linear fit to include all sources (subtract again) 216 163 // NOTE : apply to ALL sources (extended + psf) 217 164 psphotFitSourcesLinear (config, view, filerule, true); // pass 2 (detections->allSources) 218 psphotDumpChisqs (config, view, filerule);219 165 220 166 // if we only do one pass, skip to extended source analysis … … 253 199 // replace all sources so fit below applies to all at once 254 200 // NOTE: apply only to OLD sources (which have been subtracted) 255 psphotReplaceAllSources (config, view, filerule ); // pass 2201 psphotReplaceAllSources (config, view, filerule, false); // pass 2 256 202 257 203 // merge the newly selected sources into the existing list … … 262 208 // NOTE: apply to ALL sources 263 209 psphotFitSourcesLinear (config, view, filerule, true); // pass 3 (detections->allSources) 264 psphotDumpChisqs (config, view, filerule);265 210 } 266 211 … … 295 240 // replace all sources so fit below applies to all at once 296 241 // NOTE: apply only to OLD sources (which have been subtracted) 297 psphotReplaceAllSources (config, view, filerule ); // pass 2242 psphotReplaceAllSources (config, view, filerule, false); // pass 2 298 243 299 244 // merge the newly selected sources into the existing list
Note:
See TracChangeset
for help on using the changeset viewer.
