IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 31, 2006, 4:47:20 PM (20 years ago)
Author:
magnier
Message:

fixed up low-level issues with sky levels, sky bias

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/rel10_ifa/psModules/src/objects/pmSourcePhotometry.c

    r6556 r6751  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.1.2.2 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2006-03-09 03:14:23 $
     5 *  @version $Revision: 1.1.2.3 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2006-04-01 02:47:20 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5555// XXX EAM : masked region should be (optionally) elliptical
    5656// XXX curve of growth is corrected to
    57 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, float apRadius)
     57pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, bool growthCorr, bool apTrendCorr)
    5858{
    5959
     
    6262    float x, y;
    6363    float rflux;
    64     float radius;
    6564    float SN;
    6665    pmModel *model;
     
    7170        if (model == NULL)
    7271            return NULL;
    73         radius = (apRadius > 0) ? apRadius : model->radius;
    7472        isPSF = true;
    7573        break;
     
    7977        if (model == NULL)
    8078            return NULL;
    81         radius = model->radius;
    8279        isPSF = false;
    8380        break;
     
    10198    pmModelAdd (source->pixels, source->mask, model, false, false);
    10299
    103     // set aperture mask circle to scaled radius
    104     psImageKeepCircle (source->mask, x, y, model->radius, "OR", PM_SOURCE_MASK_MARKED);
     100    // set aperture mask circle to model radius
     101    psImageKeepCircle (source->mask, x, y, model->radiusTMP, "OR", PM_SOURCE_MASK_MARKED);
    105102
    106103    // measure object model photometry
     
    110107    // measure object aperture photometry
    111108    if (SN > AP_MIN_SN) {
    112         status = pmSourcePhotometryAper  (&source->apMag,  model, source->pixels, source->mask);
     109        status = pmSourcePhotometryAper  (&source->apMag, model, source->pixels, source->mask);
    113110    } else {
    114111        source->apMag = 99.0;
     
    118115    if (isPSF && (psf != NULL)) {
    119116        if (SN > AP_MIN_SN) {
    120             if (psf->growth != NULL) {
    121                 source->apMag += pmGrowthCurveCorrect (psf->growth, radius);
     117            if ((psf->growth != NULL) && growthCorr) {
     118                source->apMag += pmGrowthCurveCorrect (psf->growth, model->radiusTMP);
    122119            }
    123             rflux   = pow (10.0, 0.4*source->psfMag);
    124             source->apMag  -= PS_SQR(model->radius)*rflux * psf->skyBias + psf->skySat / rflux;
    125         }
    126         source->psfMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0);
     120            if (apTrendCorr) {
     121                rflux   = pow (10.0, 0.4*source->psfMag);
     122                source->apMag  -= PS_SQR(model->radiusTMP)*rflux * psf->skyBias + psf->skySat / rflux;
     123            }
     124        }
     125        if (apTrendCorr) {
     126            source->psfMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0);
     127        }
    127128    }
    128129
    129130    // unmask aperture
    130     psImageKeepCircle (source->mask, x, y, model->radius, "AND", ~PM_SOURCE_MASK_MARKED);
     131    psImageKeepCircle (source->mask, x, y, model->radiusTMP, "AND", ~PM_SOURCE_MASK_MARKED);
    131132
    132133    // subtract object, leave local sky
     
    168169}
    169170
     171# define DO_SKY 0
    170172// return source aperture magnitude
    171173bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask)
    172174{
    173 
    174175    float apSum = 0;
     176    float sky = 0;
    175177    *apMag = 99.0;
    176178
     
    179181    }
    180182
    181     float sky = model->params->data.F32[0];
     183    if (DO_SKY) {
     184        sky = model->params->data.F32[0];
     185    } else {
     186        sky = 0;
     187    }
    182188
    183189    // measure apMag
     
    191197    if (apSum <= 0)
    192198        return false;
     199
    193200    *apMag = -2.5*log10(apSum);
    194 
    195201    return (true);
    196202}
Note: See TracChangeset for help on using the changeset viewer.