Changeset 382


Ignore:
Timestamp:
02/08/05 12:37:22 (19 years ago)
Author:
kil064
Message:

add function scanBoundaries

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/MathUtils.cc

    r364 r382  
    7676   }
    7777}
     78
     79
     80void mathutil::scanBoundaries (Vector<uInt>& startInt,
     81                               Vector<uInt>& endInt,
     82                               const Vector<Int>& scanIDs)
     83//
     84// FInd integrations start and end for each Scan
     85//
     86{
     87   uInt nInt = scanIDs.nelements();
     88   startInt.resize(nInt);
     89   endInt.resize(nInt);
     90//
     91   startInt(0) = 0;
     92   uInt j = 0;
     93   Int currScanID = scanIDs(0);
     94   for (uInt i=0; i<nInt; i++) {
     95      if (scanIDs(i) != currScanID) { 
     96         endInt(j) = i-1;
     97         currScanID = scanIDs(i);
     98//
     99         j += 1;
     100         startInt(j) = i;
     101         if (i==nInt-1) {
     102            endInt(j) = i;
     103         }   
     104      } else {
     105         if (i==nInt-1) endInt(j) = i;
     106      }
     107   }
     108   startInt.resize(j+1,True);
     109   endInt.resize(j+1,True);
     110}
  • trunk/src/MathUtils.h

    r364 r382  
    4141casa::uInt addEntry (casa::Vector<T>& list, T val);
    4242
     43// FInd the scan boundaries from a list of ScanIDs
     44void scanBoundaries (casa::Vector<casa::uInt>& startInt, 
     45                     casa::Vector<casa::uInt>& endInt,
     46                     const casa::Vector<casa::Int>& scanIDs);
    4347
    4448// Hanning smoothing
Note: See TracChangeset for help on using the changeset viewer.