- Timestamp:
- Mar 3, 2011, 3:11:09 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psphot/src/psphotReadout.c
r30749 r30784 9 9 } 10 10 11 // for now, let's store the detections on the readout->analysis for each readout 12 bool psphotDumpChisqs (pmConfig *config, const pmFPAview *view, const char *filerule) 13 { 14 static int npass = 0; 15 char filename[64]; 16 17 bool status = true; 18 19 int num = psphotFileruleCount(config, filerule); 20 21 snprintf (filename, 64, "chisq.%02d.dat", npass); 22 FILE *f = fopen (filename, "w"); 23 24 // loop over the available readouts 25 for (int i = 0; i < num; i++) { 26 27 // find the currently selected readout 28 pmFPAfile *file = pmFPAfileSelectSingle(config->files, filerule, i); // File of interest 29 psAssert (file, "missing file?"); 30 31 pmReadout *readout = pmFPAviewThisReadout(view, file->fpa); 32 psAssert (readout, "missing readout?"); 33 34 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 35 psAssert (detections, "missing detections?"); 36 37 psArray *sources = detections->allSources; 38 psAssert (sources, "missing sources?"); 39 40 for (int i = 0; i < sources->n; i++) { 41 pmSource *source = sources->data[i]; 42 if (!source) continue; 43 44 pmModel *model = pmSourceGetModel (NULL, source); 45 if (!model) continue; 46 47 if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) { 48 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); 49 } else { 50 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); 51 } 52 } 53 } 54 fclose (f); 55 npass ++; 56 57 return true; 58 } 59 11 60 bool psphotReadout(pmConfig *config, const pmFPAview *view, const char *filerule) { 12 61 … … 147 196 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 148 197 psphotFitSourcesLinear (config, view, filerule, false); // pass 1 (detections->allSources) 198 psphotDumpChisqs (config, view, filerule); 149 199 150 200 // identify CRs and extended sources (only unmeasured sources are measured) … … 157 207 // replace model flux, adjust mask as needed, fit, subtract the models (full stamp) 158 208 psphotBlendFit (config, view, filerule); // pass 1 (detections->allSources) 209 psphotDumpChisqs (config, view, filerule); 159 210 160 211 // replace all sources … … 164 215 // NOTE : apply to ALL sources (extended + psf) 165 216 psphotFitSourcesLinear (config, view, filerule, true); // pass 2 (detections->allSources) 217 psphotDumpChisqs (config, view, filerule); 166 218 167 219 // if we only do one pass, skip to extended source analysis … … 209 261 // NOTE: apply to ALL sources 210 262 psphotFitSourcesLinear (config, view, filerule, true); // pass 3 (detections->allSources) 263 psphotDumpChisqs (config, view, filerule); 211 264 } 212 265
Note:
See TracChangeset
for help on using the changeset viewer.
