IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 28, 2011, 2:44:39 PM (15 years ago)
Author:
eugene
Message:

unified function to generate output parameters for output cmf files; add chisqNorm calculation to pmSourceChisq, pass in nParams; re-calculate the chisq if we use constant weights; make sure we correctly set nDOF = nPoints - nParams

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20110213/psModules/src/objects/pmSourcePhotometry.c

    r29935 r30763  
    422422    *pixWeightNotPoor = notPoorSum / modelSum;
    423423
     424    if (false && isfinite(*pixWeightNotBad) && isfinite(*pixWeightNotPoor)) {
     425        psAssert (*pixWeightNotBad <= *pixWeightNotPoor, "error: all bad pixels should also be poor");
     426    }
     427
    424428    return (true);
    425429}
     
    674678
    675679// determine chisq, etc for linear normalization-only fit
    676 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *variance, psImageMaskType maskVal, const float covarFactor)
     680bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *variance, psImageMaskType maskVal, const float covarFactor, int nParams)
    677681{
    678682    PS_ASSERT_PTR_NON_NULL(model, false);
     
    689693            if (variance->data.F32[j][i] <= 0)
    690694                continue;
    691             dC += PS_SQR (image->data.F32[j][i]) / (covarFactor * variance->data.F32[j][i]);
     695            // dC += PS_SQR (image->data.F32[j][i]) / (covarFactor * variance->data.F32[j][i]);
     696            dC += PS_SQR (image->data.F32[j][i]) / variance->data.F32[j][i];
    692697            Npix ++;
    693698        }
    694699    }
     700
    695701    model->nPix = Npix;
    696     model->nDOF = Npix - 1;
     702    model->nDOF = Npix - nParams - 1;
    697703    model->chisq = dC;
     704    model->chisqNorm = dC / model->nDOF;
    698705
    699706    return (true);
Note: See TracChangeset for help on using the changeset viewer.