IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 13, 2011, 11:59:42 AM (15 years ago)
Author:
eugene
Message:

do not cull peaks with only one entry; skip the section that culls duplicate peaks -- this was dropping many valid peaks and seems unneeded; save radial apertures in their own extension; fixed logic on culling of faint peaks

Location:
trunk/psModules/src/objects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/objects

    • Property svn:mergeinfo deleted
  • trunk/psModules/src/objects/pmFootprintAssignPeaks.c

    r29004 r30621  
    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);
    8889
     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?
    8999        // XXX EAM : the algorithm below should be much faster than using psArrayRemove if
    90100        // the number of peaks in the footprint is large, or if there are no duplicates.
     
    93103
    94104        // track the number of good peaks in the footprint
    95         int nGood = 1;
     105        int lastGood = 0;
    96106
    97107        // check for duplicates
     
    100110        // (if sorted list has A, B, A, B ...)
    101111        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]) {
    103113                // everything on the array has its own mem reference; free and drop this one
    104114                psFree (fp->peaks->data[j]);
    105115                fp->peaks->data[j] = NULL;
    106116            } else {
    107                 nGood ++;
     117                lastGood ++;
    108118            }
    109119        }
     120        int nGood = lastGood + 1;
    110121
    111122        // no deleted peaks, go to next footprint
Note: See TracChangeset for help on using the changeset viewer.