Changeset 32633 for trunk/psphot/src/psphotSourceMatch.c
- Timestamp:
- Nov 8, 2011, 2:56:56 PM (15 years ago)
- Location:
- trunk/psphot
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
src/psphotSourceMatch.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psphot
- Property svn:mergeinfo changed
/branches/eam_branches/ipp-20110906/psphot (added) merged: 32605-32606,32612-32613,32616,32619,32628,32630
- Property svn:mergeinfo changed
-
trunk/psphot/src/psphotSourceMatch.c
r32348 r32633 67 67 objects = psArraySort (objects, pmPhotObjSortByX); 68 68 69 psVector *found = psVectorAlloc(sources->n, PS_TYPE_U8); 70 psVectorInit (found, 0); 69 psVector *foundSrc = psVectorAlloc(sources->n, PS_TYPE_U8); 70 psVectorInit (foundSrc, 0); 71 72 psVector *foundObj = psVectorAlloc(sources->n, PS_TYPE_U8); 73 psVectorInit (foundObj, 0); 71 74 72 75 // match sources to existing objects … … 93 96 if (dx > +1.02*RADIUS) NEXT2; 94 97 98 /* this block will match a given detection to the closest object within range of that detection. 99 XXX note that this matches ALL detections within range of the single object to that same object 100 this is bad, but I cannot just go in linear order (ie, mark off each object as they are 101 used). I should make a list of all Nobj * Ndet pairs in range and choose the matches 102 based on their separations. UGH 103 */ 104 95 105 // we are within match range, look for matches: 96 106 int Jmin = -1; … … 98 108 for (int J = j; (dx > -1.02*RADIUS) && (J < objects->n); J++) { 99 109 110 // skip objects that are already assigned: 111 if (foundObj->data.U8[J]) continue; 100 112 obj = objects->data[J]; 101 113 … … 117 129 } 118 130 obj = objects->data[Jmin]; 131 foundObj->data.U8[Jmin] = 1; 119 132 120 133 // add to object 121 134 pmPhotObjAddSource (obj, src); 122 found ->data.U8[i] = 1;135 foundSrc->data.U8[i] = 1; 123 136 i++; 124 137 } … … 128 141 for (i = 0; i < sources->n; i++) { 129 142 130 if (found ->data.U8[i]) continue;143 if (foundSrc->data.U8[i]) continue; 131 144 132 145 pmSource *src = sources->data[i]; … … 139 152 psLogMsg ("psphot", PS_LOG_DETAIL, "matched sources (%ld vs %ld)", sources->n, objects->n); 140 153 141 psFree (found); 154 psFree (foundSrc); 155 psFree (foundObj); 142 156 return true; 143 157 } … … 234 248 235 249 // assign to a footprint on this readout->image 236 peak->footprint = pmFootprintCopyData(footprint, readout->image); 237 238 // the peak does not claim ownership of the footprint (it does not free it). save a copy of this 239 // footprint on detections->footprints so we can free it later 240 psArrayAdd(detections->footprints, 100, peak->footprint); 241 psFree (peak->footprint); 250 if (footprint) { 251 peak->footprint = pmFootprintCopyData(footprint, readout->image); 252 253 // the peak does not claim ownership of the footprint (it does not free it). save a copy of this 254 // footprint on detections->footprints so we can free it later 255 psArrayAdd(detections->footprints, 100, peak->footprint); 256 psFree (peak->footprint); 257 } 242 258 243 259 // create a new source … … 268 284 pmPhotObj *obj = objects->data[i]; 269 285 nSources += obj->sources->n; 286 psAssert (obj->sources->n == nImages, "failed to match sources?"); 270 287 } 271 288 psLogMsg ("psphot", PS_LOG_DETAIL, "total of %d sources for %d images", nSources, nImages);
Note:
See TracChangeset
for help on using the changeset viewer.
