Changeset 30784 for branches/eam_branches/ipp-20110213/psphot
- Timestamp:
- Mar 3, 2011, 3:11:09 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110213/psphot
- Files:
-
- 5 edited
-
doc/stack.txt (modified) (1 diff)
-
src/psphotFitSourcesLinear.c (modified) (1 diff)
-
src/psphotFitSourcesLinearStack.c (modified) (1 diff)
-
src/psphotReadout.c (modified) (5 diffs)
-
src/psphotSourceFits.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110213/psphot/doc/stack.txt
r30779 r30784 49 49 1652559 2000000 pmSubtractionMatch.c:189 50 50 51 52 2132413 4000000 pmFPAfileDefine.c:1275 51 chisq: 53 52 2133004 4000000 pmFPACopy.c:71 54 53 2133010 4000000 pmFPACopy.c:71 55 54 2133007 2000000 pmFPACopy.c:71 55 56 backmdl: 57 2132413 4000000 pmFPAfileDefine.c:1275 58 59 ??? 56 60 8614548 2000000 psBinaryOp.c:502 57 61 8617313 2000000 psBinaryOp.c:502 62 63 pmSource (modelFlx): 64 2775 * 6k = 16.9M 65 66 pmSource (maskObj): 67 2775 * 3k = 8.4M 68 69 (span + footprints account for ~5 - 10 M, rest in little things) 58 70 59 71 20101221 -
branches/eam_branches/ipp-20110213/psphot/src/psphotFitSourcesLinear.c
r30764 r30784 312 312 for (int i = 0; i < fitSources->n; i++) { 313 313 pmSource *source = fitSources->data[i]; 314 if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) continue;315 314 pmModel *model = pmSourceGetModel (NULL, source); 316 pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal, covarFactor, 1); 315 if (!(source->mode & PM_SOURCE_MODE_NONLINEAR_FIT)) { 316 model->nPar = 1; // LINEAR-only sources have 1 parameter; NONLINEAR sources have their original value 317 } 318 pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal); 317 319 } 318 320 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "get chisqs: %f sec (%d elements)\n", psTimerMark ("psphot.linear"), sparse->Nelem); -
branches/eam_branches/ipp-20110213/psphot/src/psphotFitSourcesLinearStack.c
r30764 r30784 163 163 for (int i = 0; i < fitSources->n; i++) { 164 164 pmSource *source = fitSources->data[i]; 165 if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) continue;166 165 pmModel *model = pmSourceGetModel (NULL, source); 167 pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal, COVAR_FACTOR, 1); 166 if (!(source->mode & PM_SOURCE_MODE_NONLINEAR_FIT)) { 167 model->nPar = 1; // LINEAR-only sources have 1 parameter; NONLINEAR sources have their original value 168 } 169 pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal); 168 170 } 169 171 psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "get chisqs: %f sec (%d elements)\n", psTimerMark ("psphot.linear"), sparse->Nelem); -
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 -
branches/eam_branches/ipp-20110213/psphot/src/psphotSourceFits.c
r30624 r30784 101 101 if (!isfinite(PSF->params->data.F32[PM_PAR_I0])) psAbort("nan in fit"); 102 102 103 // correct model chisq for flux trend104 double chiTrend = psPolynomial1DEval (psf->ChiTrend, PSF->params->data.F32[PM_PAR_I0]);105 PSF->chisqNorm = PSF->chisq / chiTrend;106 107 103 // evaluate the blend objects, subtract if good, free otherwise 108 104 for (int i = 1; i < modelSet->n; i++) { … … 111 107 112 108 if (!isfinite(model->params->data.F32[PM_PAR_I0])) psAbort("nan in fit"); 113 114 // correct model chisq for flux trend115 chiTrend = psPolynomial1DEval (psf->ChiTrend, model->params->data.F32[PM_PAR_I0]);116 model->chisqNorm = model->chisq / chiTrend;117 109 118 110 // if this one failed, skip it … … 159 151 bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal) { 160 152 161 double chiTrend;162 153 pmSourceFitOptions options = *fitOptions; 163 154 … … 182 173 // clear the circular mask 183 174 psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal)); 184 185 // correct model chisq for flux trend186 chiTrend = psPolynomial1DEval (psf->ChiTrend, PSF->params->data.F32[PM_PAR_I0]);187 PSF->chisqNorm = PSF->chisq / chiTrend;188 175 189 176 // does the PSF model succeed? … … 225 212 bool okEXT, okDBL; 226 213 float chiEXT, chiDBL; 227 double chiTrend;228 214 pmModel *ONE = NULL; 229 215 pmSource *tmpSrc = NULL; … … 271 257 272 258 // correct first model chisqs for flux trend 273 chiDBL = NAN;274 259 ONE = DBL->data[0]; 275 260 if (ONE) { 276 261 if (!isfinite(ONE->params->data.F32[PM_PAR_I0])) psAbort("nan in fit"); 277 chiTrend = psPolynomial1DEval (psf->ChiTrend, ONE->params->data.F32[1]); 278 ONE->chisqNorm = ONE->chisq / chiTrend; 279 chiDBL = ONE->chisq / ONE->nDOF; // save chisq for double-star/galaxy comparison 262 chiDBL = ONE->chisqNorm; // save chisq for double-star/galaxy comparison 280 263 ONE->fitRadius = radius; 281 264 } … … 285 268 if (ONE) { 286 269 if (!isfinite(ONE->params->data.F32[PM_PAR_I0])) psAbort("nan in fit"); 287 chiTrend = psPolynomial1DEval (psf->ChiTrend, ONE->params->data.F32[1]);288 ONE->chisqNorm = ONE->chisq / chiTrend;289 270 ONE->fitRadius = radius; 290 271 } … … 298 279 299 280 okEXT = psphotEvalEXT (tmpSrc, EXT); 300 chiEXT = EXT ? EXT->chisq / EXT->nDOF: NAN;281 chiEXT = EXT ? EXT->chisqNorm : NAN; 301 282 } 302 283
Note:
See TracChangeset
for help on using the changeset viewer.
