IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31327


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

Location:
branches/eam_branches/ipp-20110404/psModules/src/objects
Files:
4 edited

Legend:

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

    r29546 r31327  
    197197        // mask the given aperture and measure the apMag
    198198        psImageKeepCircle (mask, xc, yc, radius, "OR", markVal);
    199         if (!pmSourcePhotometryAper (&apMag, NULL, NULL, model, pixels, NULL, mask, maskVal)) {
     199        if (!pmSourcePhotometryAper (NULL, &apMag, NULL, NULL, model, pixels, NULL, mask, maskVal)) {
    200200            psFree (growth);
    201201            psFree (view);
  • branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourceMoments.c

    r31312 r31327  
    130130    Sum = 0.0;  // the second pass may include slightly different pixels, re-determine Sum
    131131
     132    // float dX = source->moments->Mx - source->peak->xf;
     133    // float dY = source->moments->My - source->peak->yf;
     134    // float dR = hypot(dX, dY);
     135    // float Xo = (dR < 2.0) ? source->moments->Mx : source->peak->xf;
     136    // float Yo = (dR < 2.0) ? source->moments->My : source->peak->yf;
     137    float Xo = source->moments->Mx;
     138    float Yo = source->moments->My;
     139
    132140    // center of mass in subimage.  Note: the calculation below uses pixel index, so we correct
    133141    // xCM, yCM from pixel coords to pixel index here.
    134     psF32 xCM = source->moments->Mx - 0.5 - source->pixels->col0; // coord of peak in subimage
    135     psF32 yCM = source->moments->My - 0.5 - source->pixels->row0; // coord of peak in subimage
     142    psF32 xCM = Xo - 0.5 - source->pixels->col0; // coord of peak in subimage
     143    psF32 yCM = Yo - 0.5 - source->pixels->row0; // coord of peak in subimage
    136144
    137145    for (psS32 row = 0; row < source->pixels->numRows ; row++) {
     
    142150        psF32 *vPix = source->pixels->data.F32[row];
    143151        psF32 *vWgt = source->variance->data.F32[row];
     152
    144153        psImageMaskType  *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row];
     154        // psImageMaskType  *vMsk = (source->maskView == NULL) ? NULL : source->maskView->data.PS_TYPE_IMAGE_MASK_DATA[row];
    145155
    146156        for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) {
     
    280290        psF32 *vPix = source->pixels->data.F32[row];
    281291        psF32 *vWgt = source->variance->data.F32[row];
     292
    282293        psImageMaskType  *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row];
     294        // psImageMaskType  *vMsk = (source->maskView == NULL) ? NULL : source->maskView->data.PS_TYPE_IMAGE_MASK_DATA[row];
    283295
    284296        for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) {
     
    391403        psF32 *vPix = source->pixels->data.F32[row];
    392404        psF32 *vWgt = source->variance->data.F32[row];
     405
    393406        psImageMaskType *vMsk = (source->maskObj == NULL) ? NULL : source->maskObj->data.PS_TYPE_IMAGE_MASK_DATA[row];
     407        // psImageMaskType *vMsk = (source->maskView == NULL) ? NULL : source->maskView->data.PS_TYPE_IMAGE_MASK_DATA[row];
    394408
    395409        for (psS32 col = 0; col < source->pixels->numCols ; col++, vPix++, vWgt++) {
  • 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) {
  • branches/eam_branches/ipp-20110404/psModules/src/objects/pmSourcePhotometry.h

    r31153 r31327  
    4545
    4646bool pmSourcePhotometryAper(
     47    int *nPixOut,
    4748    float *apMag,
    4849    float *apFluxOut,
Note: See TracChangeset for help on using the changeset viewer.