IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 11, 2006, 5:27:13 PM (20 years ago)
Author:
eugene
Message:

major revisions to use the new pmFPAfile,view I/O handling

File:
1 edited

Legend:

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

    r6495 r6571  
    11# include "psphot.h"
    2 
    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
    6 pmModel *pmSourceMagnitudes (pmSource *source, pmPSF *psf, float apRadius) {
    7 
    8     int status;
    9     bool isPSF;
    10     float x, y;
    11     float rflux;
    12     float radius;
    13     pmModel *model;
    14 
    15     switch (source->type) {
    16       case PM_SOURCE_STAR:
    17         model = source->modelPSF;
    18         if (model == NULL) return NULL;
    19         radius = (apRadius > 0) ? apRadius : model->radius;
    20         isPSF = true;
    21         break;
    22 
    23       case PM_SOURCE_EXTENDED:
    24         model = source->modelEXT;
    25         if (model == NULL) return NULL;
    26         radius = model->radius;
    27         isPSF = false;
    28         break;
    29            
    30       default:
    31         return NULL;
    32     }
    33 
    34     x = model->params->data.F32[2];
    35     y = model->params->data.F32[3];
    36 
    37     // replace source flux
    38     pmSourceAddModel (source->pixels, source->mask, model, false, false);
    39 
    40     // set aperture mask circle of PSF_FIT_RADIUS
    41     psImageKeepCircle (source->mask, x, y, radius, "OR", PSPHOT_MASK_MARKED);
    42 
    43     // measure object photometry
    44     status = pmSourcePhotometry (&source->fitMag, &source->apMag, model, source->pixels, source->mask);
    45 
    46     // for PSFs, correct both apMag and fitMag to same system, consistent with infinite flux star in aperture RADIUS
    47     if (isPSF && (psf != NULL)) {
    48       if (psf->growth != NULL) {
    49           source->apMag += pmGrowthCurveCorrect (psf->growth, model->radius);
    50       }
    51 
    52       rflux   = pow (10.0, 0.4*source->fitMag);
    53       source->apMag  -= PS_SQR(model->radius)*rflux * psf->skyBias + psf->skySat / rflux;
    54       source->fitMag += psPolynomial4DEval (psf->ApTrend, x, y, 0.0, 0.0);
    55     }
    56 
    57     // unmask aperture
    58     psImageKeepCircle (source->mask, x, y, radius, "AND", ~PSPHOT_MASK_MARKED);
    59 
    60     // subtract object, leave local sky
    61     pmSourceSubModel (source->pixels, source->mask, model, false, false);
    62 
    63     if (!status) return NULL;
    64     return model;
    65 }
    66 
    67 /*
    68 aprMag' - fitMag = flux*skySat + r^2*rflux*skyBias + ApTrend(x,y)
    69 (aprMag - flux*skySat - r^2*rflux*skyBias) - fitMAg = ApTrend(x,y)
    70 (aprMag - flux*skySat - r^2*rflux*skyBias) = fitMAg + ApTrend(x,y)
    71 
    72 */
    732
    743bool psphotMagnitudes (psMetadata *config, psArray *sources, pmPSF *psf) {
     
    8817}
    8918
     19// XXX should this function use RADIUS or should it
Note: See TracChangeset for help on using the changeset viewer.