Changeset 35769 for trunk/psphot/src/psphotBlendFit.c
- Timestamp:
- Jul 3, 2013, 2:43:13 PM (13 years ago)
- Location:
- trunk/psphot
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130509/psphot (added) merged: 35594,35614,35630-35634,35640-35641,35650-35652,35654-35655,35659,35661,35701,35751
- Property svn:mergeinfo changed
-
trunk/psphot/src
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20130509/psphot/src (added) merged: 35594,35614,35630-35634,35640,35651,35654,35659,35661,35751
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphotBlendFit.c
r34418 r35769 86 86 if (!status || !isfinite(fitMaxTol) || fitMaxTol <= 0) { 87 87 fitMaxTol = 1.0; 88 } 89 90 bool chisqConvergence = psMetadataLookupBool (&status, recipe, "LMM_FIT_CHISQ_CONVERGENCE"); // Fit tolerance 91 if (!status) { 92 // default to the old method (chisqConvergence) 93 chisqConvergence = true; 94 } 95 96 int gainFactorMode = psMetadataLookupS32 (&status, recipe, "LMM_FIT_GAIN_FACTOR_MODE"); // Fit tolerance 97 if (!status) { 98 // default to the old method (chisqConvergence) 99 gainFactorMode = 0; 88 100 } 89 101 … … 119 131 fitOptions->mode = PM_SOURCE_FIT_PSF; 120 132 fitOptions->covarFactor = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix 133 134 fitOptions->gainFactorMode = gainFactorMode; 135 fitOptions->chisqConvergence = chisqConvergence; 121 136 122 137 psphotInitLimitsPSF (recipe, readout); … … 211 226 212 227 psLogMsg ("psphot.psphotBlendFit", PS_LOG_WARN, "fit models: %f sec for %d objects (%d psf, %d ext, %d failed, %ld skipped)\n", psTimerMark ("psphot.fit.nonlinear"), Nfit, Npsf, Next, Nfail, sources->n - Nfit); 228 psphotFitSummary (); 213 229 214 230 psphotVisualShowResidualImage (readout, false); … … 271 287 272 288 // skip non-astronomical objects (very likely defects) 273 if (source->mode & PM_SOURCE_MODE_BLEND) continue;274 if (source->mode & PM_SOURCE_MODE_CR_LIMIT) continue;275 if (source->type == PM_SOURCE_TYPE_DEFECT) continue;276 if (source->type == PM_SOURCE_TYPE_SATURATED) continue;289 if (source->mode & PM_SOURCE_MODE_BLEND) goto skip_blend; 290 if (source->mode & PM_SOURCE_MODE_CR_LIMIT) goto skip_cr; 291 if (source->type == PM_SOURCE_TYPE_DEFECT) goto skip_defect; 292 if (source->type == PM_SOURCE_TYPE_SATURATED) goto skip_sat; 277 293 278 294 // skip saturated stars modeled with a radial profile 279 if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) continue;295 if (source->mode2 & PM_SOURCE_MODE2_SATSTAR_PROFILE) goto skip_sat; 280 296 281 297 // skip DBL second sources (ie, added by psphotFitBlob 282 if (source->mode & PM_SOURCE_MODE_PAIR) continue;298 if (source->mode & PM_SOURCE_MODE_PAIR) goto skip_blend; 283 299 284 300 // do not include MOMENTS_FAILURES in the fit 285 if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) continue;301 if (source->mode & PM_SOURCE_MODE_MOMENTS_FAILURE) goto skip_generic; 286 302 287 303 // limit selection to some SN limit 288 304 if (source->mode & PM_SOURCE_MODE_EXT_LIMIT) { 289 if (source->moments->KronFlux < FIT_SN_LIM * source->moments->KronFluxErr) continue;305 if (source->moments->KronFlux < FIT_SN_LIM * source->moments->KronFluxErr) goto skip_generic; 290 306 } else { 291 if (sqrt(source->peak->detValue) < FIT_SN_LIM) continue;307 if (sqrt(source->peak->detValue) < FIT_SN_LIM) goto skip_generic; 292 308 } 293 309 // exclude sources outside optional analysis region 294 if (source->peak->xf < AnalysisRegion.x0) continue;295 if (source->peak->yf < AnalysisRegion.y0) continue;296 if (source->peak->xf > AnalysisRegion.x1) continue;297 if (source->peak->yf > AnalysisRegion.y1) continue;310 if (source->peak->xf < AnalysisRegion.x0) goto skip_generic; 311 if (source->peak->yf < AnalysisRegion.y0) goto skip_generic; 312 if (source->peak->xf > AnalysisRegion.x1) goto skip_generic; 313 if (source->peak->yf > AnalysisRegion.y1) goto skip_generic; 298 314 299 315 // if model is NULL, we don't have a starting guess 300 if (source->modelPSF == NULL) continue;316 if (source->modelPSF == NULL) goto skip_generic; 301 317 302 318 // skip sources which are insignificant flux? … … 307 323 source->modelPSF->params->data.F32[2], 308 324 source->modelPSF->params->data.F32[3]); 309 continue;325 goto skip_generic; 310 326 } 311 327 … … 357 373 pmSourceCacheModel (source, maskVal); 358 374 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); 375 continue; 376 377 skip_blend: 378 psTrace ("psphot", 5, "source at %7.1f, %7.1f skipped", source->peak->xf, source->peak->yf); 379 continue; 380 skip_cr: 381 psTrace ("psphot", 5, "source at %7.1f, %7.1f skipped", source->peak->xf, source->peak->yf); 382 continue; 383 skip_defect: 384 psTrace ("psphot", 5, "source at %7.1f, %7.1f skipped", source->peak->xf, source->peak->yf); 385 continue; 386 skip_sat: 387 psTrace ("psphot", 5, "source at %7.1f, %7.1f skipped", source->peak->xf, source->peak->yf); 388 continue; 389 skip_generic: 390 psTrace ("psphot", 5, "source at %7.1f, %7.1f skipped", source->peak->xf, source->peak->yf); 391 continue; 359 392 } 360 393
Note:
See TracChangeset
for help on using the changeset viewer.
