Changeset 9880 for trunk/psModules/src/objects/pmSource.c
- Timestamp:
- Nov 6, 2006, 11:06:21 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/objects/pmSource.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects/pmSource.c
r9769 r9880 6 6 * @author EAM, IfA: significant modifications. 7 7 * 8 * @version $Revision: 1.1 6$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-1 0-28 20:15:48$8 * @version $Revision: 1.17 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-11-07 09:06:21 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 67 67 psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__); 68 68 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; 89 91 90 92 psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__); 91 return( tmp);93 return(source); 92 94 } 93 95 … … 95 97 { 96 98 return (psMemGetDeallocator(ptr) == (psFreeFunc)sourceFree); 99 } 100 101 /****************************************************************************** 102 pmSourceCopy(): copy the pmSource structure and contents 103 XXX : are we OK with incrementing the ID? 104 *****************************************************************************/ 105 pmSource *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); 97 134 } 98 135
Note:
See TracChangeset
for help on using the changeset viewer.
