IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 8, 2008, 2:43:46 PM (18 years ago)
Author:
eugene
Message:

better error handling for negative aperture fluxes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects/pmSourcePhotometry.c

    r17396 r17998  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2008-04-08 18:35:38 $
     5 *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2008-06-09 00:43:46 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    246246    if (!status) {
    247247        psTrace ("psModules.objects", 3, "fail mag : bad Ap Mag");
    248         psErrorCode last = psErrorCodeLast();
    249         // XXX flag the object?
    250         if (last == PM_ERR_PHOTOM) {
    251             // the aper mag was undefined (flux < 0).  bad object, but
    252             // don't keep the error on the stack
    253             psErrorClear();
    254         }
    255248    }
    256249
    257250    // for PSFs, correct both apMag and psfMag to same system, consistent with infinite flux star in aperture RADIUS
    258     if (status && isPSF && psf) {
     251    // if the aper mag is NAN, the flux < 0.  this can happen for sources near the
     252    // detection limits (esp near bright neighbors)
     253    if (isfinite (source->apMag) && isPSF && psf) {
    259254        if (psf->growth && (mode & PM_SOURCE_PHOT_GROWTH)) {
    260255            source->apMag += pmGrowthCurveCorrect (psf->growth, model->radiusFit);
    261256        }
    262257        if (mode & PM_SOURCE_PHOT_APCORR) {
    263             rflux   = pow (10.0, 0.4*source->psfMag);
    264             source->apMag -= PS_SQR(model->radiusFit)*rflux * psf->skyBias + psf->skySat / rflux;
     258            rflux   = pow (10.0, 0.4*source->psfMag);
     259            source->apMag -= PS_SQR(model->radiusFit)*rflux * psf->skyBias + psf->skySat / rflux;
    265260        }
    266261    }
     
    343338    }
    344339    if (apSum <= 0) {
    345         psError(PM_ERR_PHOTOM, true, "apSum is negative");
    346         return false;
     340        *apMag = NAN;
     341        return true;
    347342    }
    348343
    349344    *apMag = -2.5*log10(apSum);
    350     return (true);
     345    return true;
    351346}
    352347
Note: See TracChangeset for help on using the changeset viewer.