- Timestamp:
- Nov 8, 2011, 2:41:42 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110906/psphot/src/psphotSourceMatch.c
r32619 r32628 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 } … … 270 284 pmPhotObj *obj = objects->data[i]; 271 285 nSources += obj->sources->n; 286 psAssert (obj->sources->n == nImages, "failed to match sources?"); 272 287 } 273 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.
