IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 6, 2006, 11:06:21 PM (20 years ago)
Author:
magnier
Message:

added pmSourceCopy, change special magnitudes (32, 99) to NAN

File:
1 edited

Legend:

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

    r9769 r9880  
    66 *  @author EAM, IfA: significant modifications.
    77 *
    8  *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2006-10-28 20:15:48 $
     8 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2006-11-07 09:06:21 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6767    psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
    6868    static int id = 1;
    69     pmSource *tmp = (pmSource *) psAlloc(sizeof(pmSource));
    70     *(int *)&tmp->id = id++;
    71     tmp->peak = NULL;
    72     tmp->pixels = NULL;
    73     tmp->weight = NULL;
    74     tmp->mask = NULL;
    75     tmp->moments = NULL;
    76     tmp->blends = NULL;
    77     tmp->modelPSF = NULL;
    78     tmp->modelEXT = NULL;
    79     tmp->type = PM_SOURCE_TYPE_UNKNOWN;
    80     tmp->mode = PM_SOURCE_MODE_DEFAULT;
    81     psMemSetDeallocator(tmp, (psFreeFunc) sourceFree);
    82 
    83     tmp->psfMag = 32.0;
    84     tmp->extMag = 32.0;
    85     tmp->errMag = 32.0;
    86     tmp->apMag  = 32.0;
    87     tmp->pixWeight = 0.0;
    88     tmp->sky = tmp->skyErr = NAN;
     69    pmSource *source = (pmSource *) psAlloc(sizeof(pmSource));
     70    *(int *)&source->id = id++;
     71    source->peak = NULL;
     72    source->pixels = NULL;
     73    source->weight = NULL;
     74    source->mask = NULL;
     75    source->moments = NULL;
     76    source->blends = NULL;
     77    source->modelPSF = NULL;
     78    source->modelEXT = NULL;
     79    source->type = PM_SOURCE_TYPE_UNKNOWN;
     80    source->mode = PM_SOURCE_MODE_DEFAULT;
     81    psMemSetDeallocator(source, (psFreeFunc) sourceFree);
     82
     83    // default values are NAN
     84    source->psfMag = NAN;
     85    source->extMag = NAN;
     86    source->errMag = NAN;
     87    source->apMag  = NAN;
     88    source->sky    = NAN;
     89    source->skyErr = NAN;
     90    source->pixWeight = NAN;
    8991
    9092    psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
    91     return(tmp);
     93    return(source);
    9294}
    9395
     
    9597{
    9698    return (psMemGetDeallocator(ptr) == (psFreeFunc)sourceFree);
     99}
     100
     101/******************************************************************************
     102pmSourceCopy(): copy the pmSource structure and contents
     103XXX : are we OK with incrementing the ID?
     104*****************************************************************************/
     105pmSource *pmSourceCopy(pmSource *in)
     106{
     107    // this copy is used to allow multiple fit attempts on the
     108    // same object.  the pixels, weight, and mask arrays all point to
     109    // the same original subarrays.  the peak and moments point at
     110    // the original values.
     111    pmSource *source = pmSourceAlloc ();
     112    source->peak = psMemIncrRefCounter (in->peak);
     113    source->pixels = psMemIncrRefCounter (in->pixels);
     114    source->weight = psMemIncrRefCounter (in->weight);
     115    source->mask = psMemIncrRefCounter (in->mask);
     116    source->moments = psMemIncrRefCounter (in->moments);
     117    source->blends = NULL;
     118    source->modelPSF = NULL;
     119    source->modelEXT = NULL;
     120    source->type = in->type;
     121    source->mode = in->mode;
     122    psMemSetDeallocator(source, (psFreeFunc) sourceFree);
     123
     124    // default values are NAN
     125    source->psfMag = NAN;
     126    source->extMag = NAN;
     127    source->errMag = NAN;
     128    source->apMag  = NAN;
     129    source->sky    = NAN;
     130    source->skyErr = NAN;
     131    source->pixWeight = NAN;
     132
     133    return(source);
    97134}
    98135
Note: See TracChangeset for help on using the changeset viewer.