IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 3, 2011, 3:11:09 PM (15 years ago)
Author:
eugene
Message:

fix the calculation of chisq values for constant errors (re-calculated, do not attempt to correct raw value)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/psphot/src/psphotSourceFits.c

    r30624 r30784  
    101101    if (!isfinite(PSF->params->data.F32[PM_PAR_I0])) psAbort("nan in fit");
    102102
    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;
    106 
    107103    // evaluate the blend objects, subtract if good, free otherwise
    108104    for (int i = 1; i < modelSet->n; i++) {
     
    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?
     
    225212    bool okEXT, okDBL;
    226213    float chiEXT, chiDBL;
    227     double chiTrend;
    228214    pmModel *ONE = NULL;
    229215    pmSource *tmpSrc = NULL;
     
    271257
    272258        // correct first model chisqs for flux trend
    273         chiDBL = NAN;
    274259        ONE = DBL->data[0];
    275260        if (ONE) {
    276261            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
    280263            ONE->fitRadius = radius;
    281264        }
     
    285268        if (ONE) {
    286269            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;
    289270            ONE->fitRadius = radius;
    290271        }
     
    298279
    299280        okEXT = psphotEvalEXT (tmpSrc, EXT);
    300         chiEXT = EXT ? EXT->chisq / EXT->nDOF : NAN;
     281        chiEXT = EXT ? EXT->chisqNorm : NAN;
    301282    }
    302283
Note: See TracChangeset for help on using the changeset viewer.