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/psphotSourceFits.c

    r35559 r35769  
    33// given a source with an existing modelPSF, attempt a full PSF fit, subtract if successful
    44
     5static int NfitBlend = 0;
     6
    57static int NfitPSF = 0;
    6 static int NfitBlend = 0;
     8static int NfitIterPSF = 0;
     9
    710static int NfitDBL = 0;
     11static int NfitIterDBL = 0;
     12static int NfitPixDBL = 0;
     13
    814static int NfitEXT = 0;
     15static int NfitIterEXT = 0;
     16static int NfitPixEXT = 0;
     17
    918static int NfitPCM = 0;
     19static int NfitIterPCM = 0;
     20static int NfitPixPCM = 0;
    1021
    1122bool psphotFitInit (int nThreads) {
     
    1728bool psphotFitSummary () {
    1829
    19     psLogMsg ("psphot.pspsf", PS_LOG_INFO, "fitted %5d psf, %5d blend, %5d ext, %5d dbl : %6.2f sec\n",
    20               NfitPSF, NfitBlend, NfitEXT, NfitDBL, psTimerMark ("psphot.fits"));
     30    psLogMsg ("psphot.pspsf", PS_LOG_INFO, "fitted %5d psf (%d iter), %5d blend: %5d ext (%d iter, %d pix), %5d dbl (%d iter, %d pix) : %6.2f sec\n",
     31              NfitPSF, NfitIterPSF, NfitBlend, NfitEXT, NfitIterEXT, NfitPixEXT, NfitDBL, NfitIterDBL, NfitPixDBL, psTimerMark ("psphot.fits"));
     32    return true;
     33}
     34
     35bool psphotFitSummaryExtended () {
     36
     37    psLogMsg ("psphot.pspsf", PS_LOG_INFO, "fitted %5d ext (%d iter, %d pix), %5d pcm (%d iter, %d pix)\n",
     38              NfitEXT, NfitIterEXT, NfitPixEXT, NfitPCM, NfitIterPCM, NfitPixPCM);
     39    return true;
     40}
     41
     42bool psphotFitInitExtended () {
     43    NfitEXT = 0;
     44    NfitIterEXT = 0;
     45    NfitPixEXT = 0;
     46    NfitPCM = 0;
     47    NfitIterPCM = 0;
     48    NfitPixPCM = 0;
    2149    return true;
    2250}
     
    169197    options.mode = PM_SOURCE_FIT_PSF;
    170198    pmSourceFitModel (source, PSF, &options, maskVal);
     199    NfitIterPSF += PSF->nIter;
    171200
    172201    if (!isfinite(PSF->params->data.F32[PM_PAR_I0])) psAbort("nan in fit");
     
    268297    {
    269298        // XXX need to handle failures better here
    270         EXT = psphotFitEXT (readout, source, fitOptions, modelTypeEXT, maskVal, markVal);
     299        EXT = psphotFitEXT (NULL, readout, source, fitOptions, modelTypeEXT, maskVal, markVal);
    271300        if (!EXT) goto escape;
    272301        if (!isfinite(EXT->params->data.F32[PM_PAR_I0])) goto escape;
     
    440469    options.mode = PM_SOURCE_FIT_PSF;
    441470    pmSourceFitSet (source, modelSet, &options, maskVal);
     471    NfitIterDBL += DBL->nIter;
     472    NfitPixDBL += DBL->nDOF;
     473
    442474    return (modelSet);
    443475}
    444476
    445 pmModel *psphotFitEXT (pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) {
     477pmModel *psphotFitEXT (pmModel *guessModel, pmReadout *readout, pmSource *source, pmSourceFitOptions *fitOptions, pmModelType modelType, psImageMaskType maskVal, psImageMaskType markVal) {
    446478
    447479    if ((source->moments->Mxx < 1e-3) || (source->moments->Myy < 1e-3)) {
     
    457489
    458490    // use the source moments, etc to guess basic model parameters
    459     pmModel *model = pmSourceModelGuess (source, modelType, maskVal, markVal);
     491    pmModel *model = guessModel ? guessModel : pmSourceModelGuess (source, modelType, maskVal, markVal);
    460492    if (!model) {
    461493        psTrace ("psphot", 5, "failed to generate a model for source: moments: %f %f\n", source->moments->Mxx, source->moments->Myy);
     
    507539
    508540    pmSourceFitModel (source, model, &options, maskVal);
     541    NfitIterEXT += model->nIter;
     542    NfitPixEXT += model->nDOF;
    509543
    510544# if (PS_TRACE_ON)
     
    587621    // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 5);
    588622    pmSourceFitPCM (pcm, source, &options, maskVal, markVal, psfSize);  // NOTE : 1687 allocs in here
     623    NfitIterPCM += pcm->modelConv->nIter;
     624    NfitPixPCM += pcm->modelConv->nDOF;
    589625    if (TIMING) { t5 = psTimerMark ("psphotFitPCM"); }
    590626
Note: See TracChangeset for help on using the changeset viewer.