IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 3, 2013, 2:43:13 PM (13 years ago)
Author:
eugene
Message:

thread psphotModelBackground, psphotAddOrSubNoise, psphotGuessModel; add recipe options to control selection of extended models fitted; iterate on the trail window a bit

Location:
trunk/psphot
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot

  • trunk/psphot/src

  • trunk/psphot/src/psphotBlendFit.c

    r34418 r35769  
    8686    if (!status || !isfinite(fitMaxTol) || fitMaxTol <= 0) {
    8787        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;
    88100    }
    89101
     
    119131    fitOptions->mode          = PM_SOURCE_FIT_PSF;
    120132    fitOptions->covarFactor   = psImageCovarianceFactorForAperture(readout->covariance, 10.0); // Covariance matrix
     133
     134    fitOptions->gainFactorMode = gainFactorMode;
     135    fitOptions->chisqConvergence = chisqConvergence;
    121136
    122137    psphotInitLimitsPSF (recipe, readout);
     
    211226
    212227    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 ();
    213229
    214230    psphotVisualShowResidualImage (readout, false);
     
    271287
    272288        // 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;
    277293
    278294        // 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;
    280296
    281297        // 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;
    283299
    284300        // 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;
    286302
    287303        // limit selection to some SN limit
    288304        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;
    290306        } else {
    291             if (sqrt(source->peak->detValue) < FIT_SN_LIM) continue;
     307            if (sqrt(source->peak->detValue) < FIT_SN_LIM) goto skip_generic;
    292308        }
    293309        // 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;
    298314
    299315        // 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;
    301317
    302318        // skip sources which are insignificant flux?
     
    307323                     source->modelPSF->params->data.F32[2],
    308324                     source->modelPSF->params->data.F32[3]);
    309             continue;
     325            goto skip_generic;
    310326        }
    311327
     
    357373        pmSourceCacheModel (source, maskVal);
    358374        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;
    359392    }
    360393
Note: See TracChangeset for help on using the changeset viewer.