IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28904


Ignore:
Timestamp:
Aug 12, 2010, 8:22:30 AM (16 years ago)
Author:
eugene
Message:

add pixel weights for not bad and not poor pixels

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

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20100621/psModules/src/imcombine/pmSubtraction.c

    r28866 r28904  
    12231223    bool threaded = pmSubtractionThreaded(); // Running threaded?
    12241224
     1225    // XXX This is no longer used
    12251226    psImage *convMask = NULL;           // Convolved mask image (common to inputs 1 and 2)
    12261227    if (subMask) {
  • branches/eam_branches/ipp-20100621/psModules/src/objects/pmSource.h

    r28822 r28904  
    7474    float errMag;                       ///< error in psfMag OR extMag (depending on type)
    7575    float apMag;                        ///< apMag corresponding to psfMag or extMag (depending on type)
    76     float pixWeight;                    ///< model-weighted coverage of valid pixels
     76    float apMagRaw;                     ///< raw mag in given aperture
     77    float apRadius;                     ///< radius for aperture magnitude
     78
     79    float psfWeightNotBad;              ///< PSF-weighted coverage of unmasked (not BAD) pixels
     80    float psfWeightNotPoor;             ///< PSF-weighted coverage of unmasked (not POOR) pixels
     81
    7782    float psfChisq;                     ///< probability of PSF
    7883    float crNsigma;                     ///< Nsigma deviation from PSF to CR
    7984    float extNsigma;                    ///< Nsigma deviation from PSF to EXT
    8085    float sky, skyErr;                  ///< The sky and its error at the center of the object
    81     float apRadius;
    8286    psRegion region;                    ///< area on image covered by selected pixels
    8387    pmSourceExtendedPars *extpars;      ///< extended source parameters
  • branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourcePhotometry.c

    r28796 r28904  
    155155    // measure the contribution of included pixels
    156156    if (mode & PM_SOURCE_PHOT_WEIGHT) {
    157         pmSourcePixelWeight (&source->pixWeight, model, source->maskObj, maskVal);
     157        pmSourcePixelWeight (&source->pixWeightNotBad, &source->pixWeightNotPoor, model, source->maskObj, maskVal, markVal);
    158158    }
    159159
     
    201201
    202202    // measure object aperture photometry
    203     status = pmSourcePhotometryAper  (&source->apMag, model, flux, mask, maskVal);
     203    status = pmSourcePhotometryAper  (&source->apMagRaw, model, flux, mask, maskVal);
    204204    if (!status) {
    205205        psTrace ("psModules.objects", 3, "fail mag : bad Ap Mag");
     
    211211    if (isfinite (source->apMag) && isPSF && psf) {
    212212        if (psf->growth && (mode & PM_SOURCE_PHOT_GROWTH)) {
    213             source->apMag += pmGrowthCurveCorrect (psf->growth, source->apRadius);
     213            source->apMag = source->apMagRaw + pmGrowthCurveCorrect (psf->growth, source->apRadius);
    214214        }
    215215        if (mode & PM_SOURCE_PHOT_APCORR) {
    216216            // XXX this should be removed -- we no longer fit for the 'sky bias'
     217            // XXX is this happening???
    217218            rflux   = pow (10.0, 0.4*source->psfMag);
     219            psAssert (psf->skyBias == 0.0, "sky bias not 0");
     220            psAssert (psf->skySat == 0.0, "sky sat not 0");
    218221            source->apMag -= PS_SQR(source->apRadius)*rflux * psf->skyBias + psf->skySat / rflux;
    219222        }
     
    306309
    307310// return source aperture magnitude
    308 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *mask, psImageMaskType maskVal)
     311bool pmSourcePixelWeight (float *pixWeightNotBad, float *pixWeightNotPoor, pmModel *model, psImage *mask, psImageMaskType maskVal, psImageMaskType markVal)
    309312{
    310313    PS_ASSERT_PTR_NON_NULL(pixWeight, false);
     
    313316
    314317    float modelSum = 0;
    315     float validSum = 0;
     318    float notBadSum = 0;
     319    float notPoorSum = 0;
    316320    float sky = 0;
    317321    float value;
     
    321325    int dY, DY, NY;
    322326
    323     *pixWeight = 0.0;
     327    *pixWeightNotBad = 0.0;
     328    *pixWeightNotPoor = 0.0;
    324329
    325330    // we only care about the value of the object model, not the local sky
     
    361366
    362367            // for the full model, add all points
    363             value = model->modelFunc (NULL, params, coord) - sky;
     368            value = fabs(model->modelFunc (NULL, params, coord) - sky);
    364369            modelSum += value;
    365370
    366371            // include count only the unmasked pixels within the image area
    367             if (mx < 0)
    368                 continue;
    369             if (my < 0)
    370                 continue;
    371             if (mx >= NX)
    372                 continue;
    373             if (my >= NY)
    374                 continue;
    375             if (mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskVal)
    376                 continue;
    377 
    378             validSum += value;
     372            if (mx < 0) continue;
     373            if (my < 0) continue;
     374            if (mx >= NX) continue;
     375            if (my >= NY) continue;
     376
     377            if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & maskVal)) {
     378                notBadSum += value;
     379            }
     380            if (!(mask->data.PS_TYPE_IMAGE_MASK_DATA[my][mx] & ~markVal)) {
     381                notPoorSum += value;
     382            }
    379383        }
    380384    }
    381385    psFree (coord);
    382386
    383     if (validSum <= 0)
    384         return false;
    385 
    386     *pixWeight = validSum / modelSum;
     387    *pixWeightNotBad  = notBadSum  / modelSum;
     388    *pixWeightNotPoor = notPoorSum / modelSum;
     389
    387390    return (true);
    388391}
  • branches/eam_branches/ipp-20100621/psModules/src/objects/pmSourcePhotometry.h

    r28692 r28904  
    5353bool pmSourceMagnitudesInit (psMetadata *config);
    5454bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psImageMaskType maskVal, psImageMaskType markVal);
    55 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *mask, psImageMaskType maskVal);
     55
     56bool pmSourcePixelWeight (float *pixWeightNotBad, float *pixWeightNotPoor, pmModel *model, psImage *mask, psImageMaskType maskVal, psImageMaskType markVal);
     57
    5658bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psImageMaskType maskVal, const float covarFactor);
    5759
Note: See TracChangeset for help on using the changeset viewer.