IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 13, 2005, 10:03:27 AM (21 years ago)
Author:
eugene
Message:

working updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotMagnitudes.c

    r5772 r5773  
    11# include "psphot.h"
    22
    3 // XXX EAM : this aperture correction business is invalid (& wrong) for galaxies
     3// XXX EAM : the apMag should only be calculated for the brighter sources
     4// XXX EAM : SN limit set by user?
     5// XXX EAM : masked region should be (optionally) elliptical
    46pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, float apRadius) {
    57
    68    int status;
    79    float x, y;
    8     float sky, rflux, apMag, fitMag;
     10    float rflux, apMag, fitMag;
     11    pmModel *model;
    912
    1013    // use the correct model (PSF vs FLT)
    11     pmModel *model = pmSourceSelectModel (source);
     14    if (psf != NULL) {
     15      model = source->modelPSF;
     16    } else {
     17      model = source->modelFLT;
     18    }
    1219    if (model == NULL) return NULL;
    1320
     
    2027    psImageKeepCircle (source->mask, x, y, apRadius, "OR", PSPHOT_MASK_MARKED);
    2128
    22     // save local sky for later
    23     sky = model->params->data.F32[0];
    24 
    2529    // replace source flux
    2630    pmSourceAddModel (source->pixels, source->mask, model, false, false);
    2731
    2832    // measure object photometry
    29     status = pmSourcePhotometry (&fitMag, &apMag, model, source->pixels, source->mask);
     33    status = pmSourcePhotometry (&source->fitMag, &source->apMag, model, source->pixels, source->mask);
    3034
    31     // correct both apMag and fitMag to same system, consistent with infinite flux star in aperture RADIUS
    32     rflux   = pow (10.0, 0.4*fitMag);
    33     source->apMag  = apMag  - rflux * psf->skyBias * (M_PI * PS_SQR(apRadius));
    34     source->fitMag = fitMag + psf->ApResid;
     35    // for PSFs, correct both apMag and fitMag to same system, consistent with infinite flux star in aperture RADIUS
     36    if (psf != NULL) {
     37      rflux   = pow (10.0, 0.4*source->fitMag);
     38      source->apMag  -= rflux * psf->skyBias * (M_PI * PS_SQR(apRadius));
     39      source->fitMag += psf->ApResid;
     40    }
    3541
    3642    // subtract object, leave local sky
Note: See TracChangeset for help on using the changeset viewer.