Changeset 185


Ignore:
Timestamp:
01/10/05 17:00:45 (20 years ago)
Author:
mar637
Message:

cosmetics

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMath.cc

    r184 r185  
    7171{;}
    7272
    73 SDMath::SDMath (const SDMath& other)
     73SDMath::SDMath(const SDMath& other)
    7474{
    7575
     
    9090
    9191
    92 CountedPtr<SDMemTable> SDMath::average (const Block<CountedPtr<SDMemTable> >& in,
    93                                         const Vector<Bool>& mask, Bool scanAv,
    94                                         const std::string& weightStr)
     92CountedPtr<SDMemTable> SDMath::average(const Block<CountedPtr<SDMemTable> >& in,
     93                                       const Vector<Bool>& mask, Bool scanAv,
     94                                       const std::string& weightStr)
    9595//
    9696// Weighted averaging of spectra from one or more Tables.
     
    101101 
    102102  WeightType wtType = NONE;
    103   convertWeightString (wtType, weightStr);
     103  convertWeightString(wtType, weightStr);
    104104
    105105// Create output Table by cloning from the first table
     
    251251// Normalize data in 'sum' accumulation array according to weighting scheme
    252252
    253            normalize (sum, sumSq, nPts, wtType, axis, nAxesSub);
     253           normalize(sum, sumSq, nPts, wtType, axis, nAxesSub);
    254254
    255255// Fill scan container. The source and freqID come from the
     
    258258
    259259           Float nR(nAccum);
    260            fillSDC (sc, sum.getMask(), sum.getArray(), tSysSum/nR, outScanID,
     260           fillSDC(sc, sum.getMask(), sum.getArray(), tSysSum/nR, outScanID,
    261261                    timeSum/nR, intSum, sourceNameStart, freqIDStart);
    262262
     
    290290// Accumulate
    291291
    292         accumulate (timeSum, intSum, nAccum, sum, sumSq, nPts, tSysSum,
     292        accumulate(timeSum, intSum, nAccum, sum, sumSq, nPts, tSysSum,
    293293                    tSys, nInc, mask, time, interval, in, iTab, iRow, axis,
    294294                    nAxesSub, useMask, wtType);
     
    305305//
    306306// Normalize data in 'sum' accumulation array according to weighting scheme
    307   normalize (sum, sumSq, nPts, wtType, axis, nAxesSub);
     307  normalize(sum, sumSq, nPts, wtType, axis, nAxesSub);
    308308
    309309// Create and fill container.  The container we clone will be from
     
    313313  Float nR(nAccum);
    314314  SDContainer sc = in[tableStart]->getSDContainer(rowStart);
    315   fillSDC (sc, sum.getMask(), sum.getArray(), tSysSum/nR, outScanID,
     315  fillSDC(sc, sum.getMask(), sum.getArray(), tSysSum/nR, outScanID,
    316316           timeSum/nR, intSum, sourceNameStart, freqIDStart);
    317317//
     
    335335CountedPtr<SDMemTable>
    336336SDMath::quotient(const CountedPtr<SDMemTable>& on,
    337                  const CountedPtr<SDMemTable>& off)
     337                 const CountedPtr<SDMemTable>& off)
     338{
    338339//
    339340// Compute quotient spectrum
    340341//
    341 {
    342342  const uInt nRows = on->nRow();
    343343  if (off->nRow() != nRows) {
     
    385385     SDContainer sc = on->getSDContainer(i);
    386386//
    387      putDataInSDC (sc, out, outflagsb);
     387     putDataInSDC(sc, out, outflagsb);
    388388     sc.putTsys(tsarr);
    389389     sc.scanid = i;
     
    399399
    400400
    401 std::vector<float> SDMath::statistic (const CountedPtr<SDMemTable>& in,
    402                                       const std::vector<bool>& mask,
    403                                       const String& which)
     401std::vector<float> SDMath::statistic(const CountedPtr<SDMemTable>& in,
     402                                     const std::vector<bool>& mask,
     403                                     const String& which)
    404404//
    405405// Perhaps iteration over pol/beam/if should be in here
     
    414414
    415415  IPosition start, end;
    416   getCursorLocation (start, end, *in);
     416  getCursorLocation(start, end, *in);
    417417
    418418// Loop over rows
     
    450450
    451451
    452 SDMemTable* SDMath::bin (const SDMemTable& in, Int width)
     452SDMemTable* SDMath::bin(const SDMemTable& in, Int width)
    453453{
    454454  SDHeader sh = in.getSDHeader();
     
    463463    cSys.addCoordinate(in.getCoordinate(j));
    464464    CoordinateSystem cSysBin =
    465       CoordinateUtil::makeBinnedCoordinateSystem (factors, cSys, False);
     465      CoordinateUtil::makeBinnedCoordinateSystem(factors, cSys, False);
    466466//
    467467    SpectralCoordinate sCBin = cSysBin.spectralCoordinate(0);
     
    472472
    473473  IPosition shapeIn(1,sh.nchan);
    474   IPosition shapeOut = RebinLattice<Float>::rebinShape (shapeIn, factors);
     474  IPosition shapeOut = RebinLattice<Float>::rebinShape(shapeIn, factors);
    475475  sh.nchan = shapeOut(0);
    476476  pTabOut->putSDHeader(sh);
     
    496496    sc.resize(ip2);
    497497//
    498     putDataInSDC (sc, marrout.getArray(), marrout.getMask());
     498    putDataInSDC(sc, marrout.getArray(), marrout.getMask());
    499499
    500500// Bin up Tsys. 
     
    512512}
    513513
    514 SDMemTable* SDMath::simpleOperate (const SDMemTable& in, Float val, Bool doAll,
    515                                    uInt what)
     514SDMemTable* SDMath::simpleOperate(const SDMemTable& in, Float val, Bool doAll,
     515                                  uInt what)
    516516//
    517517// what = 0   Multiply
     
    546546
    547547      IPosition start, end;
    548       getCursorLocation (start, end, in);
     548      getCursorLocation(start, end, in);
    549549//
    550550      for (uInt i=0; i < tOut.nrow(); i++) {
     
    579579
    580580
    581 SDMemTable* SDMath::averagePol (const SDMemTable& in, const Vector<Bool>& mask)
     581SDMemTable* SDMath::averagePol(const SDMemTable& in, const Vector<Bool>& mask)
    582582//
    583583// Average all polarizations together, weighted by variance
     
    585585{
    586586//   WeightType wtType = NONE;
    587 //   convertWeightString (wtType, weight);
     587//   convertWeightString(wtType, weight);
    588588
    589589   const uInt nRows = in.nRow();
     
    704704      sc.resize(shapeOut);
    705705//
    706       putDataInSDC (sc, outData, outMask);
     706      putDataInSDC(sc, outData, outMask);
    707707      pTabOut->putSDContainer(sc);
    708708   }
     
    712712
    713713
    714 SDMemTable* SDMath::smooth (const SDMemTable& in, const casa::String& kernelType,
    715                             casa::Float width, Bool doAll)
     714SDMemTable* SDMath::smooth(const SDMemTable& in,
     715                           const casa::String& kernelType,
     716                           casa::Float width, Bool doAll)
    716717{
    717718
     
    724725// Generate Kernel
    725726
    726    VectorKernel::KernelTypes type = VectorKernel::toKernelType (kernelType);
     727   VectorKernel::KernelTypes type = VectorKernel::toKernelType(kernelType);
    727728   Vector<Float> kernel = VectorKernel::make(type, width, nChan, True, False);
    728729
     
    739740         
    740741  IPosition start, end;
    741   getCursorLocation (start, end, in);
     742  getCursorLocation(start, end, in);
    742743//
    743744  IPosition shapeOut(4,1);
     
    810811
    811812    SDContainer sc = in.getSDContainer(ri);
    812     putDataInSDC (sc, valuesIn, maskIn);
     813    putDataInSDC(sc, valuesIn, maskIn);
    813814//
    814815    pTabOut->putSDContainer(sc);
     
    824825// 'private' functions
    825826
    826 void SDMath::fillSDC (SDContainer& sc,
    827                       const Array<Bool>& mask,
    828                       const Array<Float>& data,
    829                       const Array<Float>& tSys,
    830                       Int scanID, Double timeStamp,
    831                       Double interval, const String& sourceName,
    832                       const Vector<uInt>& freqID)
     827void SDMath::fillSDC(SDContainer& sc,
     828                     const Array<Bool>& mask,
     829                     const Array<Float>& data,
     830                     const Array<Float>& tSys,
     831                     Int scanID, Double timeStamp,
     832                     Double interval, const String& sourceName,
     833                     const Vector<uInt>& freqID)
    833834{
    834835// Data and mask
    835836
    836   putDataInSDC (sc, data, mask);
     837  putDataInSDC(sc, data, mask);
    837838
    838839// TSys
     
    850851}
    851852
    852 void SDMath::normalize (MaskedArray<Float>& sum,
     853void SDMath::normalize(MaskedArray<Float>& sum,
    853854                        const Array<Float>& sumSq,
    854855                        const Array<Float>& nPts,
     
    883884
    884885
    885 void SDMath::accumulate (Double& timeSum, Double& intSum, Int& nAccum,
    886                          MaskedArray<Float>& sum, Array<Float>& sumSq,
    887                          Array<Float>& nPts, Array<Float>& tSysSum,
    888                          const Array<Float>& tSys, const Array<Float>& nInc,
    889                          const Vector<Bool>& mask, Double time, Double interval,
    890                          const Block<CountedPtr<SDMemTable> >& in,
    891                          uInt iTab, uInt iRow, uInt axis,
    892                          uInt nAxesSub, Bool useMask,
    893                          WeightType wtType)
     886void SDMath::accumulate(Double& timeSum, Double& intSum, Int& nAccum,
     887                        MaskedArray<Float>& sum, Array<Float>& sumSq,
     888                        Array<Float>& nPts, Array<Float>& tSysSum,
     889                        const Array<Float>& tSys, const Array<Float>& nInc,
     890                        const Vector<Bool>& mask, Double time, Double interval,
     891                        const Block<CountedPtr<SDMemTable> >& in,
     892                        uInt iTab, uInt iRow, uInt axis,
     893                        uInt nAxesSub, Bool useMask,
     894                        WeightType wtType)
    894895{
    895896
     
    958959
    959960
    960 void SDMath::getCursorLocation (IPosition& start, IPosition& end,
    961                                 const SDMemTable& in)
     961void SDMath::getCursorLocation(IPosition& start, IPosition& end,
     962                               const SDMemTable& in)
    962963{
    963964  const uInt nDim = 4;
     
    981982
    982983
    983 void SDMath::convertWeightString (WeightType& wtType, const std::string& weightStr)
     984void SDMath::convertWeightString(WeightType& wtType, const std::string& weightStr)
    984985{
    985986  String tStr(weightStr);
     
    991992  } else if (tStr.contains(String("TSYS"))) {
    992993     wtType = TSYS;
    993      throw (AipsError("T_sys weighting not yet implemented"));
     994     throw(AipsError("T_sys weighting not yet implemented"));
    994995  } else {
    995     throw (AipsError("Unrecognized weighting type"));
     996    throw(AipsError("Unrecognized weighting type"));
    996997  }
    997998}
    998999
    999 void SDMath::putDataInSDC (SDContainer& sc, const Array<Float>& data,
    1000                            const Array<Bool>& mask)
     1000void SDMath::putDataInSDC(SDContainer& sc, const Array<Float>& data,
     1001                          const Array<Bool>& mask)
    10011002{
    10021003    sc.putSpectrum(data);
Note: See TracChangeset for help on using the changeset viewer.