- Timestamp:
- Nov 17, 2011, 5:41:38 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111110/psphot/src/psphotReadout.c
r32633 r32685 1 1 # include "psphotInternal.h" 2 bool psphotDumpTest (pmConfig *config, const pmFPAview *view, const char *filerule); 2 3 3 4 // this should be called by every program that links against libpsphot … … 9 10 } 10 11 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 12 bool psphotReadout(pmConfig *config, const pmFPAview *view, const char *filerule) { 63 13 … … 133 83 return psphotReadoutCleanup (config, view, filerule); 134 84 } 85 psphotDumpTest (config, view, filerule); 135 86 136 87 // find blended neighbors of very saturated stars (detections->newSources) … … 188 139 // linear PSF fit to source peaks, subtract the models from the image (in PSF mask) 189 140 psphotFitSourcesLinear (config, view, filerule, false); // pass 1 (detections->allSources) 190 psphotDump Chisqs(config, view, filerule);141 psphotDumpTest (config, view, filerule); 191 142 192 143 // measure the radial profiles to the sky … … 208 159 // replace model flux, adjust mask as needed, fit, subtract the models (full stamp) 209 160 psphotBlendFit (config, view, filerule); // pass 1 (detections->allSources) 210 psphotDumpChisqs (config, view, filerule);211 161 212 162 // replace all sources 213 psphotReplaceAllSources (config, view, filerule ); // pass 1 (detections->allSources)163 psphotReplaceAllSources (config, view, filerule, false); // pass 1 (detections->allSources) 214 164 215 165 // linear fit to include all sources (subtract again) 216 166 // NOTE : apply to ALL sources (extended + psf) 217 167 psphotFitSourcesLinear (config, view, filerule, true); // pass 2 (detections->allSources) 218 psphotDumpChisqs (config, view, filerule);219 168 220 169 // if we only do one pass, skip to extended source analysis … … 239 188 // NOTE: new sources are saved on detections->newSources 240 189 psphotSourceStats (config, view, filerule, false); // pass 2 (detections->newSources) 190 psphotDumpTest (config, view, filerule); 241 191 242 192 // set source type … … 253 203 // replace all sources so fit below applies to all at once 254 204 // NOTE: apply only to OLD sources (which have been subtracted) 255 psphotReplaceAllSources (config, view, filerule ); // pass 2205 psphotReplaceAllSources (config, view, filerule, false); // pass 2 256 206 257 207 // merge the newly selected sources into the existing list … … 259 209 // XXX check on free of sources... 260 210 psphotMergeSources (config, view, filerule); // (detections->newSources + detections->allSources -> detections->allSources) 211 psphotDumpTest (config, view, filerule); 261 212 262 213 // NOTE: apply to ALL sources 263 214 psphotFitSourcesLinear (config, view, filerule, true); // pass 3 (detections->allSources) 264 psphotDumpChisqs (config, view, filerule);265 215 } 266 216 … … 295 245 // replace all sources so fit below applies to all at once 296 246 // NOTE: apply only to OLD sources (which have been subtracted) 297 psphotReplaceAllSources (config, view, filerule ); // pass 2247 psphotReplaceAllSources (config, view, filerule, false); // pass 2 298 248 299 249 // merge the newly selected sources into the existing list
Note:
See TracChangeset
for help on using the changeset viewer.
