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

    r30705 r30763  
    3939#include "pmSourceDiffStats.h"
    4040#include "pmSource.h"
     41#include "pmSourcePhotometry.h"
    4142
    4243#include "pmSourceFitModel.h"
     
    299300                           const psVector *dparam, const psVector *param, const psImage *covar,
    300301                           pmSource *source, psMinimization *myMin, int nPix,
    301                            bool fitStatus, bool saveCovariance)
     302                           bool fitStatus, pmSourceFitOptions *options, psImageMaskType maskVal)
    302303{
    303304    PS_ASSERT_PTR_NON_NULL(set, false);
     
    322323            psTrace ("psModules.objects", 4, "%f +/- %f", param->data.F32[n], dparam->data.F32[n]);
    323324        }
    324         if (saveCovariance) {
     325        if (options->saveCovariance) {
    325326            // we only save the covar matrix for this object with itself (ignore cross terms between objects)
    326327            model->covar = psImageAlloc(model->params->n, model->params->n, PS_TYPE_F32);
     
    336337        // save the resulting chisq, nDOF, nIter
    337338        // these are not unique for any one source
    338         model->chisq = myMin->value;
    339         model->nIter = myMin->iter;
    340         model->nDOF  = nPix - model->params->n;
     339        if (options->poissonErrors) {
     340            model->chisq = myMin->value;
     341            model->nPix  = nPix;
     342            model->nDOF  = nPix - model->params->n;
     343            model->chisqNorm = model->chisq / model->nDOF;
     344        } else {
     345            pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal, options->covarFactor, model->params->n);
     346        }
     347        model->nIter = myMin->iter;
    341348
    342349        // set the model success or failure status
     
    592599    }
    593600
    594     pmSourceFitSetValues (thisSet, dparams, params, covar, source, myMin, y->n, fitStatus, options->saveCovariance);
     601    pmSourceFitSetValues (thisSet, dparams, params, covar, source, myMin, y->n, fitStatus, options, maskVal);
    595602    psTrace ("psModules.objects", 5, "onPic: %d, fitStatus: %d, nIter: %d, chisq: %f, nPix: %ld\n", onPic, fitStatus, myMin->iter, myMin->value, y->n);
    596603
Note: See TracChangeset for help on using the changeset viewer.