IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 4, 2011, 1:12:39 PM (15 years ago)
Author:
eugene
Message:

use the smoothed image for footprint culling; use a more stringent culling for saturated stars; more tweaks to get sat stars to be fitted; various updates to psphotStack; unify psphotImageLoop varients; be a bit careful about number of stars in a PSF clump

Location:
trunk/psphot
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot

  • trunk/psphot/src/psphotSourceFits.c

    r30624 r31154  
    5151    psArrayAdd (sourceSet, 16, source);
    5252
    53     psTrace ("psphot", 4, "fitting blended source at %f %f : %f\n", source->peak->xf, source->peak->yf, source->peak->flux);
     53    psTrace ("psphot", 4, "fitting blended source at %f %f : %f\n", source->peak->xf, source->peak->yf, source->peak->rawFlux);
    5454
    5555    // we need to include all blends in the fit (unless primary is saturated?)
     
    6969
    7070        // XXX assume local sky is 0.0?
    71         model->params->data.F32[PM_PAR_I0] = blend->peak->flux;
     71        model->params->data.F32[PM_PAR_I0] = blend->peak->rawFlux;
    7272        model->params->data.F32[PM_PAR_XPOS] = blend->peak->xf;
    7373        model->params->data.F32[PM_PAR_YPOS] = blend->peak->yf;
     
    8383        psArrayAdd (sourceSet, 16, blend);
    8484
    85         psTrace ("psphot", 5, "adding source at %f %f : %f\n", blend->peak->xf, blend->peak->yf, blend->peak->flux);
     85        psTrace ("psphot", 5, "adding source at %f %f : %f\n", blend->peak->xf, blend->peak->yf, blend->peak->rawFlux);
    8686
    8787        // free to avoid double counting model
     
    100100
    101101    if (!isfinite(PSF->params->data.F32[PM_PAR_I0])) psAbort("nan in fit");
    102 
    103     // correct model chisq for flux trend
    104     double chiTrend = psPolynomial1DEval (psf->ChiTrend, PSF->params->data.F32[PM_PAR_I0]);
    105     PSF->chisqNorm = PSF->chisq / chiTrend;
    106102
    107103    // evaluate the blend objects, subtract if good, free otherwise
     
    111107
    112108        if (!isfinite(model->params->data.F32[PM_PAR_I0])) psAbort("nan in fit");
    113 
    114         // correct model chisq for flux trend
    115         chiTrend = psPolynomial1DEval (psf->ChiTrend, model->params->data.F32[PM_PAR_I0]);
    116         model->chisqNorm = model->chisq / chiTrend;
    117109
    118110        // if this one failed, skip it
     
    159151bool psphotFitPSF (pmReadout *readout, pmSource *source, pmPSF *psf, pmSourceFitOptions *fitOptions, psImageMaskType maskVal, psImageMaskType markVal) {
    160152
    161     double chiTrend;
    162153    pmSourceFitOptions options = *fitOptions;
    163154
     
    182173    // clear the circular mask
    183174    psImageMaskPixels (source->maskObj, "AND", PS_NOT_IMAGE_MASK(markVal));
    184 
    185     // correct model chisq for flux trend
    186     chiTrend = psPolynomial1DEval (psf->ChiTrend, PSF->params->data.F32[PM_PAR_I0]);
    187     PSF->chisqNorm = PSF->chisq / chiTrend;
    188175
    189176    // does the PSF model succeed?
     
    224211    float radius;
    225212    bool okEXT, okDBL;
    226     float chiEXT, chiDBL;
    227     double chiTrend;
    228213    pmModel *ONE = NULL;
    229214    pmSource *tmpSrc = NULL;
     
    258243    maskVal |= markVal;
    259244
     245    float chiEXT = NAN;
     246    float chiDBL = NAN;
     247
    260248    // this temporary source is used as a place-holder by the psphotEval functions below
    261249    tmpSrc = pmSourceAlloc ();
     
    271259
    272260        // correct first model chisqs for flux trend
    273         chiDBL = NAN;
    274261        ONE = DBL->data[0];
    275262        if (ONE) {
    276263            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
     264            chiDBL = ONE->chisqNorm; // save chisq for double-star/galaxy comparison
    280265            ONE->fitRadius = radius;
    281266        }
     
    285270        if (ONE) {
    286271            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;
    289272            ONE->fitRadius = radius;
    290273        }
     
    298281
    299282        okEXT = psphotEvalEXT (tmpSrc, EXT);
    300         chiEXT = EXT ? EXT->chisq / EXT->nDOF : NAN;
     283        chiEXT = EXT ? EXT->chisqNorm : NAN;
    301284    }
    302285
Note: See TracChangeset for help on using the changeset viewer.