IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30221


Ignore:
Timestamp:
Jan 7, 2011, 2:12:33 PM (15 years ago)
Author:
eugene
Message:

the old code was doing something very silly in an attempt to remove duplicate peaks in a given footprint; I do not understand why it was even trying this: all peaks are only assigned once, so there could not be duplicate peaks in any case

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20101205/psModules/src/objects/pmFootprintAssignPeaks.c

    r29004 r30221  
    2424/*
    2525 * Given a psArray of pmFootprints and another of pmPeaks, assign the peaks to the
    26  * footprints in which that fall; if they _don't_ fall in a footprint, add a suitable
     26 * footprints in which they fall; if they _don't_ fall in a footprint, add a suitable
    2727 * one to the list.
    2828 */
     
    8383
    8484        // 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;
    8687
    8788        fp->peaks = psArraySort(fp->peaks, pmPeakSortBySN);
     89
     90        // XXX WHY am I culling duplicates?  how can there be duplicates?
     91        continue;
    8892
    8993        // XXX EAM : the algorithm below should be much faster than using psArrayRemove if
     
    9397
    9498        // track the number of good peaks in the footprint
    95         int nGood = 1;
     99        int lastGood = 0;
    96100
    97101        // check for duplicates
     
    100104        // (if sorted list has A, B, A, B ...)
    101105        for (int j = 1; j < fp->peaks->n; j++) {
    102             if (fp->peaks->data[j] == fp->peaks->data[nGood]) {
     106            if (fp->peaks->data[j] == fp->peaks->data[lastGood]) {
    103107                // everything on the array has its own mem reference; free and drop this one
    104108                psFree (fp->peaks->data[j]);
    105109                fp->peaks->data[j] = NULL;
    106110            } else {
    107                 nGood ++;
     111                lastGood ++;
    108112            }
    109113        }
     114        int nGood = lastGood + 1;
    110115
    111116        // no deleted peaks, go to next footprint
Note: See TracChangeset for help on using the changeset viewer.