IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 26, 2010, 9:18:39 AM (16 years ago)
Author:
Serge CHASTEL
Message:

Merging trunk in branch

Location:
branches/sc_branches/trunkTest
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/sc_branches/trunkTest

  • branches/sc_branches/trunkTest/psphot

    • Property svn:mergeinfo deleted
  • branches/sc_branches/trunkTest/psphot/src/psphotSourceSize.c

    r28013 r29060  
    11# include "psphotInternal.h"
    22# include <gsl/gsl_sf_gamma.h>
     3
     4# define KRON 1
    35
    46typedef struct {
     
    168170    psVector *ApErr = psVectorAllocEmpty (100, PS_TYPE_F32);
    169171
     172    psImageMaskType markVal = options->markVal;
    170173    psImageMaskType maskVal = options->maskVal | options->markVal;
    171174
     
    189192
    190193        // XXX can we test if psfMag is set and calculate only if needed?
    191         pmSourceMagnitudes (source, psf, photMode, maskVal); // maskVal includes markVal
     194        pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
    192195
    193196        // clear the mask bit
     
    197200        pmSourceSub (source, PM_MODEL_OP_FULL, options->maskVal);
    198201
     202        // XXX test: switch to kron flux
     203# if (KRON)
     204        float apMag = -2.5*log10(source->moments->KronFlux);
     205# else
    199206        float apMag = -2.5*log10(source->moments->Sum);
     207# endif
    200208        float dMag = source->psfMag - apMag;
    201209
     
    288296    pmSourcePhotometryMode photMode = PM_SOURCE_PHOT_WEIGHT;
    289297
     298    psImageMaskType markVal = options->markVal;
    290299    psImageMaskType maskVal = options->maskVal | options->markVal;
    291300
     
    335344
    336345        // XXX can we test if psfMag is set and calculate only if needed?
    337         pmSourceMagnitudes (source, psf, photMode, maskVal); // maskVal includes markVal
     346        pmSourceMagnitudes (source, psf, photMode, maskVal, markVal);
    338347
    339348        // clear the mask bit
     
    343352        pmSourceSub (source, PM_MODEL_OP_FULL, options->maskVal);
    344353
     354# if (KRON)
     355        float apMag = -2.5*log10(source->moments->KronFlux);
     356# else
    345357        float apMag = -2.5*log10(source->moments->Sum);
     358# endif
    346359        float dMag = source->psfMag - apMag;
    347360
    348361        // set nSigma to include both systematic and poisson error terms
    349362        // XXX the 'poisson error' contribution for size is probably wrong...
    350         float nSigmaMAG = (dMag - options->ApResid) / hypot(source->errMag, options->ApSysErr);
     363        // XXX add in a hard floor on the Ap Sys Err (to be a bit generous)
     364        float nSigmaMAG = (dMag - options->ApResid) / hypot(source->errMag, hypot(options->ApSysErr, 0.025));
    351365        float nSigmaMXX = (Mxx - psfClump->X) / hypot(psfClump->dX, psfClump->X*psfClump->X*source->errMag);
    352366        float nSigmaMYY = (Myy - psfClump->Y) / hypot(psfClump->dY, psfClump->Y*psfClump->Y*source->errMag);
    353367
    354         // partially-masked sources are more likely to be mis-measured PSFs
     368        // fprintf (stderr, "%f %f : Mxx: %f, Myy: %f, dx: %f, dy: %f, psfMag: %f, apMag: %f, dMag: %f, errMag: %f, nSigmaMag: %f, nSigmaMxx: %f, nSigmaMyy: %f\n",
     369        // source->peak->xf, source->peak->yf, Mxx, Myy, source->peak->xf - source->moments->Mx, source->peak->yf - source->moments->My,
     370        // source->psfMag, apMag, dMag, source->errMag, nSigmaMAG, nSigmaMXX, nSigmaMYY);
     371
     372        // XXX double check on ths stuff!! partially-masked sources are more likely to be mis-measured PSFs
    355373        float sizeBias = 1.0;
    356         if (source->pixWeight < 0.9) {
     374        if (source->pixWeightNotBad < 0.9) {
     375            sizeBias = 3.0;
     376        }
     377        if (source->pixWeightNotPoor < 0.9) {
    357378            sizeBias = 3.0;
    358379        }
     
    389410        if (isCR) {
    390411            psTrace("psphotSourceClassRegion.CR",4,"CLASS: %g %g %f\t%g %g  %g %g  %g %g\t%g %g\t%g CR\t%g %g\n",
    391                     source->peak->xf,source->peak->yf,source->pixWeight,Mxx,Myy,psfClump->X,psfClump->Y,psfClump->dX,psfClump->dY,apMag,dMag,nSigmaMAG,
     412                    source->peak->xf,source->peak->yf,source->pixWeightNotBad,Mxx,Myy,psfClump->X,psfClump->Y,psfClump->dX,psfClump->dY,apMag,dMag,nSigmaMAG,
    392413                    options->nSigmaApResid,sizeBias*options->nSigmaMoments);
    393414            source->mode |= PM_SOURCE_MODE_DEFECT;
Note: See TracChangeset for help on using the changeset viewer.