IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 29, 2007, 2:59:23 PM (19 years ago)
Author:
gusciora
Message:

Adding several changes to the objects directory. Most of these changes are
mere additions of PS_ASSERTs to the beginning of psModule functions to ensure
that input parameters are correct.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20071023/psModules/src/objects/pmSourcePhotometry.c

    r15107 r15418  
    33 *  @author EAM, IfA; GLG, MHPCC
    44 *
    5  *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
    6  *  @date $Date: 2007-09-29 03:14:55 $
     5 *  @version $Revision: 1.36.2.1 $ $Name: not supported by cvs2svn $
     6 *  @date $Date: 2007-10-30 00:59:23 $
    77 *
    88 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3939bool pmSourceMagnitudesInit (psMetadata *config)
    4040{
    41 
     41    PS_ASSERT_PTR_NON_NULL(config, false);
    4242    bool status;
    4343
     
    6464
    6565// XXX masked region should be (optionally) elliptical
    66 bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode, psMaskType maskVal, psMaskType mark)
    67 {
     66bool pmSourceMagnitudes (pmSource *source, pmPSF *psf, pmSourcePhotometryMode mode,
     67                         psMaskType maskVal, psMaskType mark)
     68{
     69    PS_ASSERT_PTR_NON_NULL(source, false);
     70    PS_ASSERT_PTR_NON_NULL(psf, false);
    6871
    6972    int status = false;
     
    269272bool pmSourcePhotometryModel (float *fitMag, pmModel *model)
    270273{
     274    PS_ASSERT_PTR_NON_NULL(fitMag, false);
     275    if (model == NULL) {
     276        return false;
     277    }
    271278
    272279    float fitSum = 0;
    273280    *fitMag = NAN;
    274 
    275     if (model == NULL) {
    276         return false;
    277     }
    278281
    279282    // measure fitMag
     
    289292
    290293// return source aperture magnitude
    291 bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal)
    292 {
     294bool pmSourcePhotometryAper (float *apMag, pmModel *model, psImage *image, psImage *mask,
     295                             psMaskType maskVal)
     296{
     297    PS_ASSERT_PTR_NON_NULL(apMag, false);
     298    PS_ASSERT_PTR_NON_NULL(image, false);
     299    PS_ASSERT_PTR_NON_NULL(mask, false);
     300    PS_ASSERT_PTR_NON_NULL(model, false);
     301
    293302    float apSum = 0;
    294303    float sky = 0;
    295304    *apMag = NAN;
    296 
    297     if (model == NULL) {
    298         psError(PM_ERR_OBJECTS, true, "Model is NULL");
    299         return false;
    300     }
    301305
    302306    if (DO_SKY) {
     
    327331
    328332// return source aperture magnitude
    329 bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask, psMaskType maskVal)
    330 {
     333bool pmSourcePixelWeight (float *pixWeight, pmModel *model, psImage *image, psImage *mask,
     334                          psMaskType maskVal)
     335{
     336    PS_ASSERT_PTR_NON_NULL(pixWeight, false);
     337    PS_ASSERT_PTR_NON_NULL(image, false);
     338    PS_ASSERT_PTR_NON_NULL(mask, false);
     339    PS_ASSERT_PTR_NON_NULL(model, false);
     340
    331341    float modelSum = 0;
    332342    float validSum = 0;
     
    339349
    340350    *pixWeight = 0.0;
    341 
    342     if (model == NULL)
    343         return false;
    344351
    345352    // we only care about the value of the object model, not the local sky
     
    412419                             const bool unweighted_sum) // should the cross product be weighted?
    413420{
     421    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
     422    PS_ASSERT_PTR_NON_NULL(Mj, NAN);
    414423
    415424    int Xs, Xe, Ys, Ye;
     
    475484                           const bool unweighted_sum) // should the cross product be weighted?
    476485{
     486    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
     487    PS_ASSERT_PTR_NON_NULL(Mj, NAN);
    477488
    478489    int Xs, Xe, Ys, Ye;
     
    538549                      const bool unweighted_sum) // should the cross product be weighted?
    539550{
     551    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
    540552    double flux = 0, wt = 0, factor = 0;
    541553
     
    587599# endif
    588600
    589 bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight, psMaskType maskVal)
    590 {
     601bool pmSourceChisq (pmModel *model, psImage *image, psImage *mask, psImage *weight,
     602                    psMaskType maskVal)
     603{
     604    PS_ASSERT_PTR_NON_NULL(model, false);
     605    PS_ASSERT_PTR_NON_NULL(image, false);
     606    PS_ASSERT_PTR_NON_NULL(mask, false);
     607    PS_ASSERT_PTR_NON_NULL(weight, false);
    591608
    592609    double dC = 0.0;
     
    613630                      const bool unweighted_sum) // should the cross product be weighted?
    614631{
     632    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
    615633    double flux = 0, wt = 0, factor = 0;
    616634
     
    662680                              const bool unweighted_sum) // should the cross product be weighted?
    663681{
     682    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
     683    PS_ASSERT_PTR_NON_NULL(Mj, NAN);
    664684    int Xs, Xe, Ys, Ye;
    665685    int xi, xj, yi, yj;
     
    724744                             const bool unweighted_sum) // should the cross product be weighted?
    725745{
    726 
     746    PS_ASSERT_PTR_NON_NULL(Mi, NAN);
     747    PS_ASSERT_PTR_NON_NULL(Mj, NAN);
    727748    int Xs, Xe, Ys, Ye;
    728749    int xi, xj, yi, yj;
Note: See TracChangeset for help on using the changeset viewer.