IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

updates to pmPeak to better distinguish peak flux versions; updates to visualization; add bits for substantial suspect masking; consolidate assignment of source position and flux based on peak, moments, etc; improve footprint culling process; fix PSF_QF and PSF_QF_PERFECT calculations; fix source model chisq values

Location:
trunk/psModules
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules

    • Property svn:ignore
      •  

        old new  
        2828ChangeLog
        2929psmodules-*.tar.*
         30a.out.dSYM
  • trunk/psModules/src/objects/pmSourceFitSet.c

    r29004 r31153  
    3939#include "pmSourceDiffStats.h"
    4040#include "pmSource.h"
     41#include "pmSourcePhotometry.h"
    4142
    4243#include "pmSourceFitModel.h"
     
    296297
    297298// set the model parameters for this fit set
    298 bool pmSourceFitSetValues (pmSourceFitSetData *set, const psVector *dparam,
    299                            const psVector *param, pmSource *source,
    300                            psMinimization *myMin, int nPix, bool fitStatus)
     299bool pmSourceFitSetValues (pmSourceFitSetData *set,
     300                           const psVector *dparam, const psVector *param, const psImage *covar,
     301                           pmSource *source, psMinimization *myMin, int nPix,
     302                           bool fitStatus, pmSourceFitOptions *options, psImageMaskType maskVal)
    301303{
    302304    PS_ASSERT_PTR_NON_NULL(set, false);
     
    311313
    312314    int n = 0;
     315    int nStart = 0;
    313316    for (int i = 0; i < set->paramSet->n; i++) {
    314317
     
    320323            psTrace ("psModules.objects", 4, "%f +/- %f", param->data.F32[n], dparam->data.F32[n]);
    321324        }
     325        if (options->saveCovariance) {
     326            // we only save the covar matrix for this object with itself (ignore cross terms between objects)
     327            model->covar = psImageAlloc(model->params->n, model->params->n, PS_TYPE_F32);
     328            for (int ix = 0; ix < model->params->n; ix++) {
     329                for (int iy = 0; iy < model->params->n; iy++) {
     330                    model->covar->data.F32[iy][ix] = covar->data.F32[nStart+iy][nStart+ix];
     331                }
     332            }
     333        }
     334        nStart += model->params->n;
    322335        psTrace ("psModules.objects", 4, " src %d", i);
     336
     337        model->nIter = myMin->iter;
     338        // model->nPar is set by pmSourceFitSetMasks
    323339
    324340        // save the resulting chisq, nDOF, nIter
    325341        // these are not unique for any one source
    326         model->chisq = myMin->value;
    327         model->nIter = myMin->iter;
    328         model->nDOF  = nPix - model->params->n;
     342        if (options->poissonErrors) {
     343            model->chisq = myMin->value;
     344            model->nPix  = nPix;
     345            model->nDOF  = nPix - model->nPar;
     346            model->chisqNorm = model->chisq / model->nDOF;
     347        } else {
     348            pmSourceChisqUnsubtracted (source, model, maskVal);
     349        }
    329350
    330351        // set the model success or failure status
     
    380401    for (int i = 0; i < set->paramSet->n; i++) {
    381402        psVector *paramOne = set->paramSet->data[i];
     403        pmModel  *modelOne = set->modelSet->data[i];
    382404
    383405        switch (mode) {
     
    387409                if (j == PM_PAR_I0) continue;
    388410                constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[n + j] = 1;
     411                modelOne->nPar = 1;
    389412            }
    390413            break;
     
    396419                if (j == PM_PAR_I0) continue;
    397420                constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[n + j] = 1;
     421                modelOne->nPar = 3;
    398422            }
    399423            break;
     
    401425            // EXT model fits all params (except sky)
    402426            constraint->paramMask->data.PS_TYPE_VECTOR_MASK_DATA[n + PM_PAR_SKY] = 1;
     427            modelOne->nPar = paramOne->n - 1;
    403428            break;
    404429          default:
     
    550575    }
    551576
    552 // parameter errors from the covariance matrix
     577    // parameter errors from the covariance matrix
    553578    psVector *dparams = psVectorAlloc (thisSet->nParamSet, PS_TYPE_F32);
    554579    for (int i = 0; i < dparams->n; i++) {
     
    558583    }
    559584
    560 // get the Gauss-Newton distance for fixed model parameters
     585    // get the Gauss-Newton distance for fixed model parameters
    561586    if (constraint->paramMask != NULL) {
    562587        psVector *delta = psVectorAlloc (params->n, PS_TYPE_F32);
     
    580605    }
    581606
    582     pmSourceFitSetValues (thisSet, dparams, params, source, myMin, y->n, fitStatus);
     607    pmSourceFitSetValues (thisSet, dparams, params, covar, source, myMin, y->n, fitStatus, options, maskVal);
    583608    psTrace ("psModules.objects", 5, "onPic: %d, fitStatus: %d, nIter: %d, chisq: %f, nPix: %ld\n", onPic, fitStatus, myMin->iter, myMin->value, y->n);
    584609
Note: See TracChangeset for help on using the changeset viewer.