- Timestamp:
- Mar 5, 2012, 5:19:48 PM (14 years ago)
- Location:
- branches/meh_branches/ppstack_test
- Files:
-
- 4 edited
-
. (modified) (1 prop)
-
psphot (modified) (1 prop)
-
psphot/src (modified) (2 props)
-
psphot/src/psphotSourceMatch.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/meh_branches/ppstack_test
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psphot
- Property svn:mergeinfo changed
-
branches/meh_branches/ppstack_test/psphot/src
- Property svn:ignore
-
old new 22 22 psphotMakePSF 23 23 psphotStack 24 psphotModelTest
-
- Property svn:mergeinfo set to
- Property svn:ignore
-
branches/meh_branches/ppstack_test/psphot/src/psphotSourceMatch.c
r31154 r33415 48 48 pmDetections *detections = psMetadataLookupPtr (&status, readout->analysis, "PSPHOT.DETECTIONS"); 49 49 psAssert (detections, "missing detections?"); 50 psAssert (detections->newSources, "new sources not defined?"); 51 psAssert (!detections->allSources, "all sources already defined?"); 52 53 // XXX TEST: 54 if (detections->newSources) { 55 psphotMatchSourcesToObjects(objects, detections->newSources, RADIUS); 56 } 50 psAssert (detections->allSources, "all sources not defined?"); 51 52 psphotMatchSourcesToObjects(objects, detections->allSources, RADIUS); 57 53 58 54 return true; … … 71 67 objects = psArraySort (objects, pmPhotObjSortByX); 72 68 73 psVector *found = psVectorAlloc(sources->n, PS_TYPE_U8); 74 psVectorInit (found, 0); 69 psVector *foundSrc = psVectorAlloc(sources->n, PS_TYPE_U8); 70 psVectorInit (foundSrc, 0); 71 72 psVector *foundObj = psVectorAlloc(objects->n, PS_TYPE_U8); 73 psVectorInit (foundObj, 0); 75 74 76 75 // match sources to existing objects … … 97 96 if (dx > +1.02*RADIUS) NEXT2; 98 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 99 105 // we are within match range, look for matches: 100 106 int Jmin = -1; … … 102 108 for (int J = j; (dx > -1.02*RADIUS) && (J < objects->n); J++) { 103 109 110 // skip objects that are already assigned: 111 if (foundObj->data.U8[J]) continue; 104 112 obj = objects->data[J]; 105 113 … … 121 129 } 122 130 obj = objects->data[Jmin]; 131 foundObj->data.U8[Jmin] = 1; 123 132 124 133 // add to object 125 134 pmPhotObjAddSource (obj, src); 126 found ->data.U8[i] = 1;135 foundSrc->data.U8[i] = 1; 127 136 i++; 128 137 } … … 132 141 for (i = 0; i < sources->n; i++) { 133 142 134 if (found ->data.U8[i]) continue;143 if (foundSrc->data.U8[i]) continue; 135 144 136 145 pmSource *src = sources->data[i]; … … 143 152 psLogMsg ("psphot", PS_LOG_DETAIL, "matched sources (%ld vs %ld)", sources->n, objects->n); 144 153 145 psFree (found); 154 psFree (foundSrc); 155 psFree (foundObj); 146 156 return true; 147 157 } … … 238 248 239 249 // assign to a footprint on this readout->image 240 peak->footprint = pmFootprintCopyData(footprint, readout->image); 241 242 // the peak does not claim ownership of the footprint (it does not free it). save a copy of this 243 // footprint on detections->footprints so we can free it later 244 psArrayAdd(detections->footprints, 100, peak->footprint); 245 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 } 246 258 247 259 // create a new source … … 249 261 source->imageID = index; 250 262 source->mode2 |= PM_SOURCE_MODE2_MATCHED; // source is generated based on another image 263 source->type = PM_SOURCE_TYPE_STAR; // until we know more, assume a PSF fit 251 264 252 265 // add the peak … … 261 274 peak->assigned = true; 262 275 pmPhotObjAddSource(obj, source); 263 psArrayAdd (detections-> newSources, 100, source);276 psArrayAdd (detections->allSources, 100, source); 264 277 psFree (source); 265 278 } … … 272 285 pmPhotObj *obj = objects->data[i]; 273 286 nSources += obj->sources->n; 287 psAssert (obj->sources->n == nImages, "failed to match sources?"); 274 288 } 275 289 psLogMsg ("psphot", PS_LOG_DETAIL, "total of %d sources for %d images", nSources, nImages);
Note:
See TracChangeset
for help on using the changeset viewer.
