IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 20, 2011, 10:52:17 AM (15 years ago)
Author:
eugene
Message:

count pixels actually used for apertures; remove deprecated sky bias correction code

File:
1 edited

Legend:

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

    r31312 r31327  
    102102    bool isPSF;
    103103    float x, y;
    104     float rflux;
    105104    float SN;
    106105    pmModel *model;
     
    246245            // XXX correct the apFlux?
    247246        }
    248         if (mode & PM_SOURCE_PHOT_APCORR) {
    249             // XXX this should be removed -- we no longer fit for the 'sky bias'
    250             // XXX is this happening???
    251             rflux   = pow (10.0, 0.4*source->psfMag);
    252             psAssert (psf->skyBias == 0.0, "sky bias not 0");
    253             psAssert (psf->skySat == 0.0, "sky sat not 0");
    254             source->apMag -= PS_SQR(source->apRadius)*rflux * psf->skyBias + psf->skySat / rflux;
    255         }
    256247    }
    257248    if (mode & PM_SOURCE_PHOT_INTERP) {
     
    309300
    310301    bool status;
    311     status = pmSourcePhotometryAper(&source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal);
     302    int nPix = 0;
     303    status = pmSourcePhotometryAper(&nPix, &source->apMagRaw, &source->apFlux, &source->apFluxErr, model, image, variance, mask, maskVal);
    312304    if (status) {
    313305        source->mode |= PM_SOURCE_MODE_AP_MAGS;
    314306    }
    315 
    316307    return status;
    317308}
    318309
    319310// return source aperture magnitude
    320 bool pmSourcePhotometryAper (float *apMag, float *apFluxOut, float *apFluxErr, pmModel *model, psImage *image, psImage *variance, psImage *mask, psImageMaskType maskVal)
     311bool pmSourcePhotometryAper (int *nPixOut, float *apMag, float *apFluxOut, float *apFluxErr, pmModel *model, psImage *image, psImage *variance, psImage *mask, psImageMaskType maskVal)
    321312{
    322313    PS_ASSERT_PTR_NON_NULL(apMag, false);
     
    331322    float apFlux = 0;
    332323    float apFluxVar = 0;
     324    int nPix = 0;
    333325
    334326    if (DO_SKY) {
     
    348340            apFlux += imData[iy][ix] - sky;
    349341            apFluxVar += varData[iy][ix];
    350         }
    351     }
     342            nPix ++;
     343        }
     344    }
     345   
    352346    if (apFluxOut) *apFluxOut = apFlux;
    353347    if (apFluxErr) *apFluxErr = sqrt(fabs(apFluxVar));
     348    if (nPixOut) *nPixOut = nPix;
    354349
    355350    if (apFlux <= 0) {
Note: See TracChangeset for help on using the changeset viewer.