IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 9, 2007, 3:09:20 PM (19 years ago)
Author:
eugene
Message:

updating all changes from from eam_branch_20071023

File:
1 edited

Legend:

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

    r15232 r15562  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2007-10-06 02:29:47 $
     8 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2007-11-10 01:09:20 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7777}
    7878
     79bool psMemCheckSource(psPtr ptr)
     80{
     81    PS_ASSERT_PTR(ptr, false);
     82    return ( psMemGetDeallocator(ptr) == (psFreeFunc) sourceFree);
     83}
     84
    7985/******************************************************************************
    8086pmSourceAlloc(): Allocate the pmSource structure and initialize its members
    8187to NULL.
    8288*****************************************************************************/
     89
    8390pmSource *pmSourceAlloc()
    8491{
     
    132139pmSource *pmSourceCopy(pmSource *in)
    133140{
     141    if (in == NULL) {
     142        return(NULL);
     143    }
    134144    // this copy is used to allow multiple fit attempts on the
    135145    // same object.  the pixels, weight, and mask arrays all point to
     
    139149
    140150    // this is actually the same peak as the original, is this the correct way to handle this?
    141     source->peak = pmPeakAlloc (in->peak->x, in->peak->y, in->peak->value, in->peak->type);
    142     source->peak->xf = in->peak->xf;
    143     source->peak->yf = in->peak->yf;
    144     source->peak->flux = in->peak->flux;
    145     source->peak->SN = in->peak->SN;
     151    if (in->peak != NULL) {
     152        source->peak = pmPeakAlloc (in->peak->x, in->peak->y, in->peak->value, in->peak->type);
     153        source->peak->xf = in->peak->xf;
     154        source->peak->yf = in->peak->yf;
     155        source->peak->flux = in->peak->flux;
     156        source->peak->SN = in->peak->SN;
     157    }
    146158
    147159    // copy the values in the moments structure
    148     source->moments  =  pmMomentsAlloc();
    149     *source->moments = *in->moments;
     160    if (in->moments != NULL) {
     161        source->moments  =  pmMomentsAlloc();
     162        *source->moments = *in->moments;
     163    }
    150164
    151165    // These images are all views to the parent.
    152166    // We want a new view, but pointing at the same pixels.
    153     source->pixels   = psImageCopyView (NULL, in->pixels);
    154     source->weight   = psImageCopyView (NULL, in->weight);
    155     source->maskView = psImageCopyView (NULL, in->maskView);
     167    source->pixels   = psImageCopyView(NULL, in->pixels);
     168    source->weight   = psImageCopyView(NULL, in->weight);
     169    source->maskView = psImageCopyView(NULL, in->maskView);
    156170
    157171    // the maskObj is a unique mask array; create a new mask image
     
    173187                          psF32 Radius)
    174188{
     189    PS_ASSERT_PTR_NON_NULL(mySource, false);
     190    PS_ASSERT_PTR_NON_NULL(readout, false);
     191    PS_ASSERT_PTR_NON_NULL(readout->image, false);
     192    PS_ASSERT_INT_POSITIVE(Radius, false);
     193
    175194    psRegion srcRegion;
    176195
     
    200219                            psF32 Radius)
    201220{
     221    PS_ASSERT_PTR_NON_NULL(mySource, false);
     222    PS_ASSERT_PTR_NON_NULL(readout, false);
     223    PS_ASSERT_PTR_NON_NULL(readout->image, false);
     224    PS_ASSERT_INT_POSITIVE(Radius, false);
     225
    202226    bool extend;
    203227    psRegion newRegion;
    204 
    205     if (Radius == 0)
    206         return false;
    207228
    208229    // check to see if new region is completely contained within old region
     
    814835
    815836// should we call pmSourceCacheModel if it does not exist?
    816 bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add, psMaskType maskVal, int dx, int dy) {
    817 
     837bool pmSourceOp (pmSource *source, pmModelOpMode mode, bool add,
     838                 psMaskType maskVal, int dx, int dy)
     839{
     840    PS_ASSERT_PTR_NON_NULL(source, false);
    818841    bool status;
    819842
     
    904927pmModel *pmSourceGetModel (bool *isPSF, const pmSource *source)
    905928{
     929    PS_ASSERT_PTR_NON_NULL(source, NULL);
    906930
    907931    pmModel *model;
Note: See TracChangeset for help on using the changeset viewer.