IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 23, 2005, 1:58:45 PM (21 years ago)
Author:
eugene
Message:

fixing output functions

File:
1 edited

Legend:

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

    r5828 r5837  
    11# include "psphot.h"
    22
    3 // XXX EAM : the apMag should only be calculated for the brighter sources
     3// XXX EAM : the apMag should only be calculated for the brighter sources?
    44// XXX EAM : SN limit set by user?
    55// XXX EAM : masked region should be (optionally) elliptical
     
    77
    88    int status;
     9    bool isPSF;
    910    float x, y;
    1011    float rflux;
     12    float radius;
    1113    pmModel *model;
    1214
    13     // use the correct model (PSF vs FLT)
    14     if (psf != NULL) {
    15       model = source->modelPSF;
    16     } else {
    17       model = source->modelFLT;
     15    switch (source->type) {
     16      case PM_SOURCE_STAR:
     17        model = source->modelPSF;
     18        if (model == NULL) return NULL;
     19        radius = apRadius;
     20        isPSF = true;
     21        break;
     22
     23      case PM_SOURCE_GALAXY:
     24        model = source->modelFLT;
     25        if (model == NULL) return NULL;
     26        radius = model->radius;
     27        isPSF = false;
     28        break;
     29           
     30      default:
     31        return NULL;
    1832    }
    19     if (model == NULL) return NULL;
    2033
    21     x = source->peak->x;
    22     y = source->peak->y;
    23 
    24     // we have already (psphotApplyPSF) defined pixels at least OUTER_RADIUS from source
    25     // we need to mask pixels to measure the aperture magnitude
    26     // set aperture mask circle of PSF_FIT_RADIUS
    27     psImageKeepCircle (source->mask, x, y, apRadius, "OR", PSPHOT_MASK_MARKED);
     34    x = model->params->data.F32[2];
     35    y = model->params->data.F32[3];
    2836
    2937    // replace source flux
    3038    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);
    3142
    3243    // measure object photometry
     
    3445
    3546    // for PSFs, correct both apMag and fitMag to same system, consistent with infinite flux star in aperture RADIUS
    36     if (psf != NULL) {
     47    if (isPSF && (psf != NULL)) {
    3748      rflux   = pow (10.0, 0.4*source->fitMag);
    3849      source->apMag  -= rflux * psf->skyBias * (M_PI * PS_SQR(apRadius));
     
    4455
    4556    // unmask aperture
    46     psImageKeepCircle (source->mask, x, y, apRadius, "AND", ~PSPHOT_MASK_MARKED);
     57    psImageKeepCircle (source->mask, x, y, radius, "AND", ~PSPHOT_MASK_MARKED);
     58
     59    if (!status) return NULL;
    4760    return model;
    48 }
    49 
    50 pmModel *pmSourceSelectModel (pmSource *source) {
    51 
    52     pmModel *model;
    53 
    54     switch (source->type) {
    55    
    56         // use PSF model with stars
    57       case PM_SOURCE_STAR:
    58         model = source->modelPSF;
    59         break;
    60 
    61         // use FLT model with galaxies
    62       case PM_SOURCE_GALAXY:
    63         model = source->modelFLT;
    64         break;
    65            
    66         // skip defects and poorly fitted stars or galaxies
    67       default:
    68         model = NULL;
    69     }
    70     return (model);
    7161}
    7262
Note: See TracChangeset for help on using the changeset viewer.