Changeset 30621 for trunk/psModules/src/objects/pmFootprintAssignPeaks.c
- Timestamp:
- Feb 13, 2011, 11:59:42 AM (15 years ago)
- Location:
- trunk/psModules/src/objects
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
pmFootprintAssignPeaks.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/objects
- Property svn:mergeinfo deleted
-
trunk/psModules/src/objects/pmFootprintAssignPeaks.c
r29004 r30621 24 24 /* 25 25 * Given a psArray of pmFootprints and another of pmPeaks, assign the peaks to the 26 * footprints in which th atfall; if they _don't_ fall in a footprint, add a suitable26 * footprints in which they fall; if they _don't_ fall in a footprint, add a suitable 27 27 * one to the list. 28 28 */ … … 83 83 84 84 // XXX are we allowed to have peak-less footprints?? 85 if (!fp->peaks->n) continue; 85 if (fp->peaks->n == 0) continue; 86 if (fp->peaks->n == 1) continue; 86 87 87 88 fp->peaks = psArraySort(fp->peaks, pmPeakSortBySN); 88 89 90 // XXX check for an assert on duplicates (I don't think they can happen, but 91 // let's double check for now) 92 93 for (int j = 1; j < fp->peaks->n; j++) { 94 psAssert (fp->peaks->data[j] != fp->peaks->data[j-1], "duplicate peak!"); 95 } 96 continue; 97 98 // XXX WHY am I culling duplicates? how can there be duplicates? 89 99 // XXX EAM : the algorithm below should be much faster than using psArrayRemove if 90 100 // the number of peaks in the footprint is large, or if there are no duplicates. … … 93 103 94 104 // track the number of good peaks in the footprint 95 int nGood = 1;105 int lastGood = 0; 96 106 97 107 // check for duplicates … … 100 110 // (if sorted list has A, B, A, B ...) 101 111 for (int j = 1; j < fp->peaks->n; j++) { 102 if (fp->peaks->data[j] == fp->peaks->data[ nGood]) {112 if (fp->peaks->data[j] == fp->peaks->data[lastGood]) { 103 113 // everything on the array has its own mem reference; free and drop this one 104 114 psFree (fp->peaks->data[j]); 105 115 fp->peaks->data[j] = NULL; 106 116 } else { 107 nGood ++;117 lastGood ++; 108 118 } 109 119 } 120 int nGood = lastGood + 1; 110 121 111 122 // no deleted peaks, go to next footprint
Note:
See TracChangeset
for help on using the changeset viewer.
