IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 1, 2009, 3:53:37 PM (17 years ago)
Author:
eugene
Message:

add covarianceFactor to pmSourceChisq, pmSourceModelWeight, pmSourceModelDotModel, pmSourceDataDotModel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourcePhotometry.c

    r25754 r25980  
    545545
    546546// determine chisq, etc for linear normalization-only fit
    547 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *variance,
    548                     psImageMaskType maskVal)
     547bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *variance, psImageMaskType maskVal, const float covarFactor)
    549548{
    550549    PS_ASSERT_PTR_NON_NULL(model, false);
     
    561560            if (variance->data.F32[j][i] <= 0)
    562561                continue;
    563             dC += PS_SQR (image->data.F32[j][i]) / variance->data.F32[j][i];
     562            dC += PS_SQR (image->data.F32[j][i]) / (covarFactor * variance->data.F32[j][i]);
    564563            Npix ++;
    565564        }
     
    573572
    574573
    575 double pmSourceModelWeight(const pmSource *Mi,
    576                       int term,
    577                       const bool unweighted_sum) // should the cross product be weighted?
     574double pmSourceModelWeight(const pmSource *Mi, int term, const bool unweighted_sum, const float covarFactor)
    578575{
    579576    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
     
    594591                continue;
    595592            if (!unweighted_sum) {
    596                 wt = Wi->data.F32[yi][xi];
     593                wt = covarFactor * Wi->data.F32[yi][xi];
    597594                if (wt == 0)
    598595                    continue;
     
    623620}
    624621
    625 double pmSourceModelDotModel (const pmSource *Mi,
    626                               const pmSource *Mj,
    627                               const bool unweighted_sum) // should the cross product be weighted?
     622double pmSourceModelDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum, const float covarFactor)
    628623{
    629624    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
     
    677672                flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]);
    678673            } else {
    679                 wt = Wi->data.F32[yi][xi];
     674                wt = covarFactor * Wi->data.F32[yi][xi];
    680675                if (wt > 0) {
    681676                    flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]) / wt;
     
    687682}
    688683
    689 double pmSourceDataDotModel (const pmSource *Mi,
    690                              const pmSource *Mj,
    691                              const bool unweighted_sum) // should the cross product be weighted?
     684double pmSourceDataDotModel (const pmSource *Mi, const pmSource *Mj, const bool unweighted_sum, const float covarFactor)
    692685{
    693686    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
     
    741734                flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]);
    742735            } else {
    743                 wt = Wi->data.F32[yi][xi];
     736                wt = covarFactor * Wi->data.F32[yi][xi];
    744737                if (wt > 0) {
    745738                    flux += (Pi->data.F32[yi][xi] * Pj->data.F32[yj][xj]) / wt;
Note: See TracChangeset for help on using the changeset viewer.