Changeset 169


Ignore:
Timestamp:
01/06/05 13:09:19 (19 years ago)
Author:
kil064
Message:

moev functionality from SDMath to SDMathWrapper (adding SDMathWrapper.cc in
the process). This removes an unnecessary layer from SDMath

Location:
trunk/src
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMath.cc

    r167 r169  
    369369}
    370370
    371 void SDMath::multiplyInSitu(SDMemTable* pIn, Float factor, Bool doAll)
    372 {
    373   const uInt what = 0;
    374   SDMemTable* pOut = localOperate (*pIn, factor, doAll, what);
    375   *pIn = *pOut;
    376    delete pOut;
    377 
    378 
    379 
    380 CountedPtr<SDMemTable>
    381 SDMath::multiply(const CountedPtr<SDMemTable>& in, Float factor, Bool doAll)
    382 {
    383   const uInt what = 0;
    384   return CountedPtr<SDMemTable>(localOperate (*in, factor, doAll, what));
    385 }
    386 
    387 
    388 void SDMath::addInSitu (SDMemTable* pIn, Float offset, Bool doAll)
    389 {
    390   const uInt what = 1;
    391   SDMemTable* pOut = localOperate (*pIn, offset, doAll, what);
    392   *pIn = *pOut;
    393    delete pOut;
    394 
    395 
    396 
    397 CountedPtr<SDMemTable>
    398 SDMath::add(const CountedPtr<SDMemTable>& in, Float offset, Bool doAll)
    399 {
    400   const uInt what = 1;
    401   return CountedPtr<SDMemTable>(localOperate(*in, offset, doAll, what));
    402 }
    403371
    404372
     
    448416}
    449417
    450 void SDMath::averagePolInSitu (SDMemTable* pIn, const Vector<Bool>& mask)
    451 {
    452   SDMemTable* pOut = localAveragePol (*pIn, mask);
    453   *pIn = *pOut;
    454    delete pOut;
    455 
    456 
    457 
    458 CountedPtr<SDMemTable> SDMath::averagePol (const CountedPtr<SDMemTable>& in,
    459                                            const Vector<Bool>& mask)
    460 {
    461   return CountedPtr<SDMemTable>(localAveragePol(*in, mask));
    462 }
    463 
    464 
    465 void SDMath::binInSitu (SDMemTable* pIn, int width)
    466 {
    467   const uInt what = 1;
    468   SDMemTable* pOut = localBin (*pIn, Int(width));
    469   *pIn = *pOut;
    470    delete pOut;
    471 
    472 
    473 
    474 CountedPtr<SDMemTable> SDMath::bin (const CountedPtr<SDMemTable>& in, int width)
    475 {
    476   const uInt what = 1;
    477   return CountedPtr<SDMemTable>(localBin(*in, Int(width)));
    478 }
    479 
    480418
    481419
     
    530468  return result;
    531469}
     470
     471
     472SDMemTable* SDMath::bin (const SDMemTable& in, Int width)
     473{
     474  SDHeader sh = in.getSDHeader();
     475  SDMemTable* pTabOut = new SDMemTable(in, True);
     476
     477// Bin up SpectralCoordinates
     478
     479  IPosition factors(1);
     480  factors(0) = width;
     481  for (uInt j=0; j<in.nCoordinates(); ++j) {
     482    CoordinateSystem cSys;
     483    cSys.addCoordinate(in.getCoordinate(j));
     484    CoordinateSystem cSysBin =
     485      CoordinateUtil::makeBinnedCoordinateSystem (factors, cSys, False);
     486//
     487    SpectralCoordinate sCBin = cSysBin.spectralCoordinate(0);
     488    pTabOut->setCoordinate(sCBin, j);
     489  }
     490
     491// Use RebinLattice to find shape
     492
     493  IPosition shapeIn(1,sh.nchan);
     494  IPosition shapeOut = RebinLattice<Float>::rebinShape (shapeIn, factors);
     495  sh.nchan = shapeOut(0);
     496  pTabOut->putSDHeader(sh);
     497
     498
     499// Loop over rows and bin along channel axis
     500 
     501  const uInt axis = 3;
     502  for (uInt i=0; i < in.nRow(); ++i) {
     503    SDContainer sc = in.getSDContainer(i);
     504//
     505    Array<Float> tSys(sc.getTsys());                           // Get it out before sc changes shape
     506
     507// Bin up spectrum
     508
     509    MaskedArray<Float> marr(in.rowAsMaskedArray(i));
     510    MaskedArray<Float> marrout;
     511    LatticeUtilities::bin(marrout, marr, axis, width);
     512
     513// Put back the binned data and flags
     514
     515    IPosition ip2 = marrout.shape();
     516    sc.resize(ip2);
     517//
     518    putDataInSDC (sc, marrout.getArray(), marrout.getMask());
     519
     520// Bin up Tsys. 
     521
     522    Array<Bool> allGood(tSys.shape(),True);
     523    MaskedArray<Float> tSysIn(tSys, allGood, True);
     524//
     525    MaskedArray<Float> tSysOut;   
     526    LatticeUtilities::bin(tSysOut, tSysIn, axis, width);
     527    sc.putTsys(tSysOut.getArray());
     528//
     529    pTabOut->putSDContainer(sc);
     530  }
     531  return pTabOut;
     532}
     533
     534SDMemTable* SDMath::simpleOperate (const SDMemTable& in, Float val, Bool doAll,
     535                                   uInt what)
     536//
     537// what = 0   Multiply
     538//        1   Add
     539{
     540   SDMemTable* pOut = new SDMemTable(in,False);
     541   const Table& tOut = pOut->table();
     542   ArrayColumn<Float> spec(tOut,"SPECTRA"); 
     543//
     544   if (doAll) {
     545      for (uInt i=0; i < tOut.nrow(); i++) {
     546
     547// Get
     548
     549         MaskedArray<Float> marr(pOut->rowAsMaskedArray(i));
     550
     551// Operate
     552
     553         if (what==0) {
     554            marr *= val;
     555         } else if (what==1) {
     556            marr += val;
     557         }
     558
     559// Put
     560
     561         spec.put(i, marr.getArray());
     562      }
     563   } else {
     564
     565// Get cursor location
     566
     567      IPosition start, end;
     568      getCursorLocation (start, end, in);
     569//
     570      for (uInt i=0; i < tOut.nrow(); i++) {
     571
     572// Get
     573
     574         MaskedArray<Float> dataIn(pOut->rowAsMaskedArray(i));
     575
     576// Modify. More work than we would like to deal with the mask
     577
     578         Array<Float>& values = dataIn.getRWArray();
     579         Array<Bool> mask(dataIn.getMask());
     580//
     581         Array<Float> values2 = values(start,end);
     582         Array<Bool> mask2 = mask(start,end);
     583         MaskedArray<Float> t(values2,mask2);
     584         if (what==0) {
     585            t *= val;
     586         } else if (what==1) {
     587            t += val;
     588         }
     589         values(start, end) = t.getArray();     // Write back into 'dataIn'
     590
     591// Put
     592         spec.put(i, dataIn.getArray());
     593      }
     594   }
     595//
     596   return pOut;
     597}
     598
     599
     600
     601SDMemTable* SDMath::averagePol (const SDMemTable& in, const Vector<Bool>& mask)
     602//
     603// Average all polarizations together, weighted by variance
     604//
     605{
     606//   WeightType wtType = NONE;
     607//   convertWeightString (wtType, weight);
     608
     609   const uInt nRows = in.nRow();
     610   const uInt polAxis = 2;                     // Polarization axis
     611   const uInt chanAxis = 3;                    // Spectrum axis
     612
     613// Create output Table and reshape number of polarizations
     614
     615  Bool clear=True;
     616  SDMemTable* pTabOut = new SDMemTable(in, clear);
     617  SDHeader header = pTabOut->getSDHeader();
     618  header.npol = 1;
     619  pTabOut->putSDHeader(header);
     620
     621// Shape of input and output data
     622
     623  const IPosition& shapeIn = in.rowAsMaskedArray(0u, False).shape();
     624  IPosition shapeOut(shapeIn);
     625  shapeOut(polAxis) = 1;                          // Average all polarizations
     626//
     627  const uInt nChan = shapeIn(chanAxis);
     628  const IPosition vecShapeOut(4,1,1,1,nChan);     // A multi-dim form of a Vector shape
     629  IPosition start(4), end(4);
     630
     631// Output arrays
     632
     633  Array<Float> outData(shapeOut, 0.0);
     634  Array<Bool> outMask(shapeOut, True);
     635  const IPosition axes(2, 2, 3);              // pol-channel plane
     636//
     637  const Bool useMask = (mask.nelements() == shapeIn(chanAxis));
     638
     639// Loop over rows
     640
     641   for (uInt iRow=0; iRow<nRows; iRow++) {
     642
     643// Get data for this row
     644
     645      MaskedArray<Float> marr(in.rowAsMaskedArray(iRow));
     646      Array<Float>& arr = marr.getRWArray();
     647      const Array<Bool>& barr = marr.getMask();
     648
     649// Make iterators to iterate by pol-channel planes
     650
     651      ReadOnlyArrayIterator<Float> itDataPlane(arr, axes);
     652      ReadOnlyArrayIterator<Bool> itMaskPlane(barr, axes);
     653
     654// Accumulations
     655
     656      Float fac = 1.0;
     657      Vector<Float> vecSum(nChan,0.0);
     658
     659// Iterate through data by pol-channel planes
     660
     661      while (!itDataPlane.pastEnd()) {
     662
     663// Iterate through plane by polarization  and accumulate Vectors
     664
     665        Vector<Float> t1(nChan); t1 = 0.0;
     666        Vector<Bool> t2(nChan); t2 = True;
     667        MaskedArray<Float> vecSum(t1,t2);
     668        Float varSum = 0.0;
     669        {
     670           ReadOnlyVectorIterator<Float> itDataVec(itDataPlane.array(), 1);
     671           ReadOnlyVectorIterator<Bool> itMaskVec(itMaskPlane.array(), 1);
     672           while (!itDataVec.pastEnd()) {     
     673
     674// Create MA of data & mask (optionally including OTF mask) and  get variance
     675
     676              if (useMask) {
     677                 const MaskedArray<Float> spec(itDataVec.vector(),mask&&itMaskVec.vector());
     678                 fac = 1.0 / variance(spec);
     679              } else {
     680                 const MaskedArray<Float> spec(itDataVec.vector(),itMaskVec.vector());
     681                 fac = 1.0 / variance(spec);
     682              }
     683
     684// Normalize spectrum (without OTF mask) and accumulate
     685
     686              const MaskedArray<Float> spec(fac*itDataVec.vector(), itMaskVec.vector());
     687              vecSum += spec;
     688              varSum += fac;
     689
     690// Next
     691
     692              itDataVec.next();
     693              itMaskVec.next();
     694           }
     695        }
     696
     697// Normalize summed spectrum
     698
     699        vecSum /= varSum;
     700
     701// FInd position in input data array.  We are iterating by pol-channel
     702// plane so all that will change is beam and IF and that's what we want.
     703
     704        IPosition pos = itDataPlane.pos();
     705
     706// Write out data. This is a bit messy. We have to reform the Vector
     707// accumulator into an Array of shape (1,1,1,nChan)
     708
     709        start = pos;
     710        end = pos;
     711        end(chanAxis) = nChan-1;
     712        outData(start,end) = vecSum.getArray().reform(vecShapeOut);
     713        outMask(start,end) = vecSum.getMask().reform(vecShapeOut);
     714
     715// Step to next beam/IF combination
     716
     717        itDataPlane.next();
     718        itMaskPlane.next();
     719      }
     720
     721// Generate output container and write it to output table
     722
     723      SDContainer sc = in.getSDContainer();
     724      sc.resize(shapeOut);
     725//
     726      putDataInSDC (sc, outData, outMask);
     727      pTabOut->putSDContainer(sc);
     728   }
     729//
     730  return pTabOut;
     731}
     732
    532733
    533734
     
    666867}
    667868
    668 SDMemTable* SDMath::localOperate (const SDMemTable& in, Float val, Bool doAll,
    669                                   uInt what)
    670 //
    671 // what = 0   Multiply
    672 //        1   Add
    673 {
    674    SDMemTable* pOut = new SDMemTable(in,False);
    675    const Table& tOut = pOut->table();
    676    ArrayColumn<Float> spec(tOut,"SPECTRA"); 
    677 //
    678    if (doAll) {
    679       for (uInt i=0; i < tOut.nrow(); i++) {
    680 
    681 // Get
    682 
    683          MaskedArray<Float> marr(pOut->rowAsMaskedArray(i));
    684 
    685 // Operate
    686 
    687          if (what==0) {
    688             marr *= val;
    689          } else if (what==1) {
    690             marr += val;
    691          }
    692 
    693 // Put
    694 
    695          spec.put(i, marr.getArray());
    696       }
    697    } else {
    698 
    699 // Get cursor location
    700 
    701       IPosition start, end;
    702       getCursorLocation (start, end, in);
    703 //
    704       for (uInt i=0; i < tOut.nrow(); i++) {
    705 
    706 // Get
    707 
    708          MaskedArray<Float> dataIn(pOut->rowAsMaskedArray(i));
    709 
    710 // Modify. More work than we would like to deal with the mask
    711 
    712          Array<Float>& values = dataIn.getRWArray();
    713          Array<Bool> mask(dataIn.getMask());
    714 //
    715          Array<Float> values2 = values(start,end);
    716          Array<Bool> mask2 = mask(start,end);
    717          MaskedArray<Float> t(values2,mask2);
    718          if (what==0) {
    719             t *= val;
    720          } else if (what==1) {
    721             t += val;
    722          }
    723          values(start, end) = t.getArray();     // Write back into 'dataIn'
    724 
    725 // Put
    726          spec.put(i, dataIn.getArray());
    727       }
    728    }
    729 //
    730    return pOut;
    731 }
    732869
    733870
     
    783920
    784921
    785 SDMemTable* SDMath::localAveragePol(const SDMemTable& in, const Vector<Bool>& mask)
    786 //
    787 // Average all polarizations together, weighted by variance
    788 //
    789 {
    790 //   WeightType wtType = NONE;
    791 //   convertWeightString (wtType, weight);
    792 
    793    const uInt nRows = in.nRow();
    794    const uInt polAxis = 2;                     // Polarization axis
    795    const uInt chanAxis = 3;                    // Spectrum axis
    796 
    797 // Create output Table and reshape number of polarizations
    798 
    799   Bool clear=True;
    800   SDMemTable* pTabOut = new SDMemTable(in, clear);
    801   SDHeader header = pTabOut->getSDHeader();
    802   header.npol = 1;
    803   pTabOut->putSDHeader(header);
    804 
    805 // Shape of input and output data
    806 
    807   const IPosition& shapeIn = in.rowAsMaskedArray(0u, False).shape();
    808   IPosition shapeOut(shapeIn);
    809   shapeOut(polAxis) = 1;                          // Average all polarizations
    810 //
    811   const uInt nChan = shapeIn(chanAxis);
    812   const IPosition vecShapeOut(4,1,1,1,nChan);     // A multi-dim form of a Vector shape
    813   IPosition start(4), end(4);
    814 
    815 // Output arrays
    816 
    817   Array<Float> outData(shapeOut, 0.0);
    818   Array<Bool> outMask(shapeOut, True);
    819   const IPosition axes(2, 2, 3);              // pol-channel plane
    820 //
    821   const Bool useMask = (mask.nelements() == shapeIn(chanAxis));
    822 
    823 // Loop over rows
    824 
    825    for (uInt iRow=0; iRow<nRows; iRow++) {
    826 
    827 // Get data for this row
    828 
    829       MaskedArray<Float> marr(in.rowAsMaskedArray(iRow));
    830       Array<Float>& arr = marr.getRWArray();
    831       const Array<Bool>& barr = marr.getMask();
    832 
    833 // Make iterators to iterate by pol-channel planes
    834 
    835       ReadOnlyArrayIterator<Float> itDataPlane(arr, axes);
    836       ReadOnlyArrayIterator<Bool> itMaskPlane(barr, axes);
    837 
    838 // Accumulations
    839 
    840       Float fac = 1.0;
    841       Vector<Float> vecSum(nChan,0.0);
    842 
    843 // Iterate through data by pol-channel planes
    844 
    845       while (!itDataPlane.pastEnd()) {
    846 
    847 // Iterate through plane by polarization  and accumulate Vectors
    848 
    849         Vector<Float> t1(nChan); t1 = 0.0;
    850         Vector<Bool> t2(nChan); t2 = True;
    851         MaskedArray<Float> vecSum(t1,t2);
    852         Float varSum = 0.0;
    853         {
    854            ReadOnlyVectorIterator<Float> itDataVec(itDataPlane.array(), 1);
    855            ReadOnlyVectorIterator<Bool> itMaskVec(itMaskPlane.array(), 1);
    856            while (!itDataVec.pastEnd()) {     
    857 
    858 // Create MA of data & mask (optionally including OTF mask) and  get variance
    859 
    860               if (useMask) {
    861                  const MaskedArray<Float> spec(itDataVec.vector(),mask&&itMaskVec.vector());
    862                  fac = 1.0 / variance(spec);
    863               } else {
    864                  const MaskedArray<Float> spec(itDataVec.vector(),itMaskVec.vector());
    865                  fac = 1.0 / variance(spec);
    866               }
    867 
    868 // Normalize spectrum (without OTF mask) and accumulate
    869 
    870               const MaskedArray<Float> spec(fac*itDataVec.vector(), itMaskVec.vector());
    871               vecSum += spec;
    872               varSum += fac;
    873 
    874 // Next
    875 
    876               itDataVec.next();
    877               itMaskVec.next();
    878            }
    879         }
    880 
    881 // Normalize summed spectrum
    882 
    883         vecSum /= varSum;
    884 
    885 // FInd position in input data array.  We are iterating by pol-channel
    886 // plane so all that will change is beam and IF and that's what we want.
    887 
    888         IPosition pos = itDataPlane.pos();
    889 
    890 // Write out data. This is a bit messy. We have to reform the Vector
    891 // accumulator into an Array of shape (1,1,1,nChan)
    892 
    893         start = pos;
    894         end = pos;
    895         end(chanAxis) = nChan-1;
    896         outData(start,end) = vecSum.getArray().reform(vecShapeOut);
    897         outMask(start,end) = vecSum.getMask().reform(vecShapeOut);
    898 
    899 // Step to next beam/IF combination
    900 
    901         itDataPlane.next();
    902         itMaskPlane.next();
    903       }
    904 
    905 // Generate output container and write it to output table
    906 
    907       SDContainer sc = in.getSDContainer();
    908       sc.resize(shapeOut);
    909 //
    910       putDataInSDC (sc, outData, outMask);
    911       pTabOut->putSDContainer(sc);
    912    }
    913 //
    914   return pTabOut;
    915 }
    916 
    917 SDMemTable* SDMath::localBin (const SDMemTable& in, Int width)
    918 {
    919   SDHeader sh = in.getSDHeader();
    920   SDMemTable* pTabOut = new SDMemTable(in, True);
    921 
    922 // Bin up SpectralCoordinates
    923 
    924   IPosition factors(1);
    925   factors(0) = width;
    926   for (uInt j=0; j<in.nCoordinates(); ++j) {
    927     CoordinateSystem cSys;
    928     cSys.addCoordinate(in.getCoordinate(j));
    929     CoordinateSystem cSysBin =
    930       CoordinateUtil::makeBinnedCoordinateSystem (factors, cSys, False);
    931 //
    932     SpectralCoordinate sCBin = cSysBin.spectralCoordinate(0);
    933     pTabOut->setCoordinate(sCBin, j);
    934   }
    935 
    936 // Use RebinLattice to find shape
    937 
    938   IPosition shapeIn(1,sh.nchan);
    939   IPosition shapeOut = RebinLattice<Float>::rebinShape (shapeIn, factors);
    940   sh.nchan = shapeOut(0);
    941   pTabOut->putSDHeader(sh);
    942 
    943 
    944 // Loop over rows and bin along channel axis
    945  
    946   const uInt axis = 3;
    947   for (uInt i=0; i < in.nRow(); ++i) {
    948     SDContainer sc = in.getSDContainer(i);
    949 //
    950     Array<Float> tSys(sc.getTsys());                           // Get it out before sc changes shape
    951 
    952 // Bin up spectrum
    953 
    954     MaskedArray<Float> marr(in.rowAsMaskedArray(i));
    955     MaskedArray<Float> marrout;
    956     LatticeUtilities::bin(marrout, marr, axis, width);
    957 
    958 // Put back the binned data and flags
    959 
    960     IPosition ip2 = marrout.shape();
    961     sc.resize(ip2);
    962 //
    963     putDataInSDC (sc, marrout.getArray(), marrout.getMask());
    964 
    965 // Bin up Tsys. 
    966 
    967     Array<Bool> allGood(tSys.shape(),True);
    968     MaskedArray<Float> tSysIn(tSys, allGood, True);
    969 //
    970     MaskedArray<Float> tSysOut;   
    971     LatticeUtilities::bin(tSysOut, tSysIn, axis, width);
    972     sc.putTsys(tSysOut.getArray());
    973 //
    974     pTabOut->putSDContainer(sc);
    975   }
    976   return pTabOut;
    977 }
    978 
    979 
  • trunk/src/SDMath.h

    r167 r169  
    4848                                         const casa::CountedPtr<SDMemTable>& off);
    4949
    50 // Multiply
    51 
    52   void multiplyInSitu(SDMemTable* in, casa::Float factor, casa::Bool all);
    53   casa::CountedPtr<SDMemTable> multiply(const casa::CountedPtr<SDMemTable>& in,
    54                                         casa::Float factor, casa::Bool all);
    55 
    56 // Addition
    57 
    58   void addInSitu (SDMemTable* in, casa::Float offset, casa::Bool all);
    59   casa::CountedPtr<SDMemTable> add(const casa::CountedPtr<SDMemTable>& in,
    60                                    casa::Float offset, casa::Bool all);
    61 
    6250//  Hanning
    6351
    6452  casa::CountedPtr<SDMemTable> hanning(const casa::CountedPtr<SDMemTable>& in);
    65 
    66 // Bin up
    67 
    68   void binInSitu (SDMemTable* in, casa::Int width);
    69   casa::CountedPtr<SDMemTable> bin(const casa::CountedPtr<SDMemTable>& in, casa::Int width);
    7053
    7154// Average in time
     
    7558                                         bool scanAverage, const std::string& weightStr);
    7659
    77 // Average polarizations
    78 
    79   void averagePolInSitu (SDMemTable* in, const casa::Vector<casa::Bool>& mask);
    80   casa::CountedPtr<SDMemTable> averagePol(const casa::CountedPtr<SDMemTable>& in,
    81                                           const casa::Vector<casa::Bool>& mask);
    82 
    8360// Statistics
    8461
    8562  std::vector<float> statistic(const casa::CountedPtr<SDMemTable>& in,
    8663                                const std::vector<bool>& mask, const std::string& which);
     64
     65
     66// Simple mathematical operations.  what=0 (mul) or 1 (add)
     67
     68  SDMemTable* simpleOperate (const SDMemTable& in, casa::Float offset,
     69                            casa::Bool doAll, casa::uInt what);
     70
     71// Average polarizations
     72
     73  SDMemTable* averagePol (const SDMemTable& in, const casa::Vector<casa::Bool>& mask);
     74
     75// Bin up spectra
     76
     77  SDMemTable* bin (const SDMemTable& in, casa::Int width);
     78
     79
    8780
    8881// private like functions (this is not a class so can't make them private)
     
    123116                  WeightType wtType, casa::Int axis, casa::Int nAxes);
    124117
    125 // Functions for simple mathematical operations.  what=0 (mul) or 1 (add)
    126 
    127   SDMemTable* localOperate (const SDMemTable& in, casa::Float offset,
    128                             casa::Bool doAll, casa::uInt what);
    129 
    130118// Function to get the current cursor location
    131119   void getCursorLocation (casa::IPosition& start, casa::IPosition& end,
     
    136124   void convertWeightString (WeightType& wt, const std::string& weightStr);
    137125
    138 // Function for simple mathematical operations.  what=0 (mul) or 1 (add)
    139 
    140   SDMemTable* localOperate (const SDMemTable& in, casa::Float offset,
    141                             casa::Bool doAll, casa::uInt what);
    142 
    143 // Function to average polarizations
    144 
    145   SDMemTable* localAveragePol(const SDMemTable& in, const casa::Vector<casa::Bool>& mask);
    146 
    147 // Function to bin up spectra
    148 
    149   SDMemTable* localBin (const SDMemTable& in, casa::Int width);
    150126};
    151127
  • trunk/src/SDMathWrapper.h

    r167 r169  
    4545
    4646// Quotient
    47 
    4847  SDMemTableWrapper quotient(const SDMemTableWrapper& on,
    49                              const SDMemTableWrapper& off) {
    50     return SDMemTableWrapper(SDMath::quotient(on.getCP(),
    51                                              off.getCP()));
    52   }
     48                            const SDMemTableWrapper& off);
    5349
    5450// Multiply
    5551
    56   void scaleInSitu(SDMemTableWrapper& in, casa::Float factor, casa::Bool all)
    57   {
    58     SDMath::multiplyInSitu(in.getPtr(),factor, all);
    59   }
     52  void scaleInSitu(SDMemTableWrapper& in, casa::Float factor, casa::Bool all);
    6053  SDMemTableWrapper scale(const SDMemTableWrapper& in,
    61                           casa::Float factor, casa::Bool all)
    62   {
    63     return SDMemTableWrapper(SDMath::multiply(in.getCP(), factor, all));
    64   }
     54                          casa::Float factor, casa::Bool all);
    6555
    6656// Add
    6757
    68   void addInSitu(SDMemTableWrapper& in, casa::Float offset, casa::Bool all)
    69   {
    70     SDMath::addInSitu(in.getPtr(), offset, all);
    71   }
    72   SDMemTableWrapper add(const SDMemTableWrapper& in, casa::Float offset, casa::Bool all)
    73   {
    74     return SDMemTableWrapper(SDMath::add(in.getCP(), offset, all));
    75   }
     58  void addInSitu(SDMemTableWrapper& in, casa::Float offset, casa::Bool all);
     59  SDMemTableWrapper add(const SDMemTableWrapper& in, casa::Float offset, casa::Bool all);
    7660
    7761// Hanning
    7862
    79   SDMemTableWrapper hanning(const SDMemTableWrapper& in) {
    80     return SDMemTableWrapper(SDMath::hanning(in.getCP()));
    81   }
     63  SDMemTableWrapper hanning(const SDMemTableWrapper& in);
    8264
    8365// Bin up
    8466
    85   void binInSitu (SDMemTableWrapper& in, int width)
    86   {
    87     SDMath::binInSitu (in.getPtr(), width);
    88   }
    89   SDMemTableWrapper bin(const SDMemTableWrapper& in, int width)
    90   {
    91     return SDMemTableWrapper(SDMath::bin(in.getCP(), width));
    92   }
     67  void binInSitu (SDMemTableWrapper& in, int width);
     68  SDMemTableWrapper bin(const SDMemTableWrapper& in, int width);
    9369
    9470// Average in time
     
    10076// Average polarizations
    10177
    102   void averagePolInSitu (SDMemTableWrapper& in,  const std::vector<bool>& mask)
    103   {
    104     SDMemTable* sdmt = in.getPtr();
    105     SDMath::averagePolInSitu(in.getPtr(), mask);
    106   }
    107   SDMemTableWrapper averagePol (const SDMemTableWrapper& in, const std::vector<bool>& mask)
    108   {
    109     return SDMemTableWrapper(SDMath::averagePol(in.getCP(), mask));
    110   }
     78  void averagePolInSitu (SDMemTableWrapper& in,  const std::vector<bool>& mask);
     79  SDMemTableWrapper averagePol (const SDMemTableWrapper& in, const std::vector<bool>& mask);
    11180
    11281// Statistics
    11382
    11483  std::vector<float> statistic(const SDMemTableWrapper& in,
    115             const std::vector<bool>& mask, const std::string& which) {
    116     return SDMath::statistic(in.getCP(), mask, which);
    117   }
    118 
     84                               const std::vector<bool>& mask,
     85                               const std::string& which);
    11986};
    12087
Note: See TracChangeset for help on using the changeset viewer.