IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 13426


Ignore:
Timestamp:
May 18, 2007, 4:08:34 AM (19 years ago)
Author:
rhl
Message:

Check {modelFromPSFFunc,pmSourcePhotometryAper,psEllipsePolToAxes}'s return code;

File:
1 edited

Legend:

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

    r13064 r13426  
    66 *  @author EAM, IfA
    77 *
    8  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-04-27 22:14:08 $
     8 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-05-18 14:08:34 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3636#include "pmFPAMaskWeight.h"
    3737#include "psVectorBracket.h"
     38#include "pmErrorCodes.h"
    3839
    3940/*****************************************************************************/
     
    178179
    179180    // set model parameters for this source based on PSF information
    180     modelFromPSFFunc (modelPSF, modelEXT, psf);
     181    if (!modelFromPSFFunc (modelPSF, modelEXT, psf)) {
     182        psError(PM_ERR_PSF, true, "Failed to set model params from PSF");
     183        psFree(modelPSF);
     184        return NULL;
     185    }
     186    // XXX note that model->residuals is just a reference
     187    modelPSF->residuals = psf->residuals;
    181188
    182189    return (modelPSF);
     
    248255    pol.e2 = fittedPar[PM_PAR_E2];
    249256
    250     psEllipseAxes axes = psEllipsePolToAxes (pol, minMinorAxis);
     257    psEllipseAxes axes;
     258    if (psEllipsePolToAxes (pol, minMinorAxis, &axes) != PS_ERR_NONE) {
     259        psError(PM_ERR_PSF, false, "Failed to convert e[012] (%g,%g,%g) to axes",
     260                pol.e0, pol.e1, pol.e2);
     261        return false;
     262    }
    251263    psEllipseShape shape = psEllipseAxesToShape (axes);
    252264
     
    519531    // no need to interpolate since we have forced the object center
    520532    // to 0.5, 0.5 above
     533    bool completeGrowthCurve = true;            // do we have a complete curve of growth?
    521534    for (int i = 0; i < psf->growth->radius->n; i++) {
    522535
     
    525538        // mask the given aperture and measure the apMag
    526539        psImageKeepCircle (mask, xc, yc, radius, "OR", PM_MASK_MARK);
    527         pmSourcePhotometryAper (&apMag, model, image, mask);
     540        if (!pmSourcePhotometryAper (&apMag, model, image, mask)) {
     541            psError(PM_ERR_PHOTOM, false, "Measuring apMag for radius == %g", radius);
     542            completeGrowthCurve = false;
     543            break;
     544        }
    528545
    529546        // XXX since we re-mask on each pass, this could be dropped.
     
    538555    }
    539556
    540     psf->growth->apRef = psVectorInterpolate (psf->growth->radius, psf->growth->apMag, psf->growth->refRadius);
    541     psf->growth->apLoss = psf->growth->fitMag - psf->growth->apRef;
     557    if (completeGrowthCurve) {
     558        psf->growth->apRef = psVectorInterpolate (psf->growth->radius, psf->growth->apMag, psf->growth->refRadius);
     559        psf->growth->apLoss = psf->growth->fitMag - psf->growth->apRef;
     560    } else {
     561        psf->growth->apRef = NAN;
     562        psf->growth->apLoss = 0;
     563    }
    542564
    543565    psLogMsg ("psphot.growth", 4, "GrowthCurve : apLoss : %f\n", psf->growth->apLoss);
     
    549571    psFree (modelRef);
    550572
    551     return true;
    552 }
     573    return completeGrowthCurve ? true : false;
     574}
Note: See TracChangeset for help on using the changeset viewer.