Changeset 1140 for trunk/src


Ignore:
Timestamp:
08/16/06 09:12:28 (18 years ago)
Author:
mar637
Message:

add mxExtract the first step to do MX quotients

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STMath.cpp

    r1078 r1140  
    1515#include <casa/Containers/Block.h>
    1616#include <casa/BasicSL/String.h>
    17 #include <tables/Tables/TableIter.h>
    18 #include <tables/Tables/TableCopy.h>
    1917#include <casa/Arrays/MaskArrLogi.h>
    2018#include <casa/Arrays/MaskArrMath.h>
     
    2927#include <tables/Tables/ExprNode.h>
    3028#include <tables/Tables/TableRecord.h>
     29#include <tables/Tables/TableParse.h>
    3130#include <tables/Tables/ReadAsciiTable.h>
     31#include <tables/Tables/TableIter.h>
     32#include <tables/Tables/TableCopy.h>
    3233
    3334#include <lattices/Lattices/LatticeUtilities.h>
     
    203204  ArrayColumn<uChar> flagColOut(tout,"FLAGTRA");
    204205  ArrayColumn<Float> tsysColOut(tout,"TSYS");
    205 
     206  ScalarColumn<uInt> scanColOut(tout,"SCANNO");
     207  Table tmp = in->table().sort("BEAMNO");
    206208  Block<String> cols(3);
    207209  cols[0] = String("BEAMNO");
     
    214216  uInt outrowCount = 0;
    215217  uChar userflag = 1 << 7;
    216   TableIterator iter(in->table(), cols);
     218  TableIterator iter(tmp, cols);
    217219  while (!iter.pastEnd()) {
    218220    Table subt = iter.table();
     
    224226    tout.addRow();
    225227    TableCopy::copyRows(tout, subt, outrowCount, 0, 1);
     228    if ( avmode != "SCAN") {
     229      scanColOut.put(outrowCount, uInt(0));
     230    }
    226231    Vector<Float> tmp;
    227232    specCol.get(0, tmp);
     
    13231328}
    13241329
     1330CountedPtr< Scantable >
     1331  asap::STMath::mxExtract( const CountedPtr< Scantable > & in,
     1332                           const std::string & scantype )
     1333{
     1334  bool insitu = insitu_;
     1335  setInsitu(false);
     1336  CountedPtr< Scantable > out = getScantable(in, true);
     1337  setInsitu(insitu);
     1338  Table& tout = out->table();
     1339  std::string taql = "SELECT FROM $1 WHERE BEAMNO != REFBEAMNO";
     1340  if (scantype == "on") {
     1341    taql = "SELECT FROM $1 WHERE BEAMNO == REFBEAMNO";
     1342  }
     1343  Table tab = tableCommand(taql, in->table());
     1344  TableCopy::copyRows(tout, tab);
     1345  if (scantype == "on") {
     1346    TableVector<uInt> vec(tout, "SCANNO");
     1347    vec = 0;
     1348  }
     1349  return out;
     1350}
  • trunk/src/STMath.h

    r1106 r1140  
    6262
    6363
    64         /**
    65           * average a vector of Scantables
    66           * @param in the vector of Scantables to average
    67           * @param an optional mask to apply on specific weights
    68           * @param weight weighting scheme
    69           * @param avmode the mode ov averaging. Per "SCAN" or "ALL".
    70           * @return a casa::CountedPtr<Scantable> which either holds a new Scantable
    71           * or returns the imput pointer.
    72           */
     64  /**
     65    * average a vector of Scantables
     66    * @param in the vector of Scantables to average
     67    * @param an optional mask to apply on specific weights
     68    * @param weight weighting scheme
     69    * @param avmode the mode ov averaging. Per "SCAN" or "ALL".
     70    * @return a casa::CountedPtr<Scantable> which either holds a new Scantable
     71    * or returns the imput pointer.
     72    */
    7373  casa::CountedPtr<Scantable>
    7474    average( const std::vector<casa::CountedPtr<Scantable> >& in,
     
    7777             const std::string& avmode = "SCAN");
    7878
    79         /**
    80           * median average a vector of Scantables. See also STMath::average
    81           * @param in the Scantable to average
    82           * @param mode the averaging mode. Currently only "MEDIAN"
    83           * @param avmode the mode ov averaging. Per "SCAN" or "ALL".
    84           * @return a casa::CountedPtr<Scantable> which either holds a new Scantable
    85           * or returns the imput pointer.
    86           */
     79  /**
     80    * median average a vector of Scantables. See also STMath::average
     81    * @param in the Scantable to average
     82    * @param mode the averaging mode. Currently only "MEDIAN"
     83    * @param avmode the mode ov averaging. Per "SCAN" or "ALL".
     84    * @return a casa::CountedPtr<Scantable> which either holds a new Scantable
     85    * or returns the imput pointer.
     86    */
    8787  casa::CountedPtr<Scantable>
    8888    averageChannel( const casa::CountedPtr<Scantable> & in,
     
    9090                    const std::string& avmode = "SCAN");
    9191
     92  /**
     93    * average polarisations together. really only useful if only linears are
     94    *  available.
     95    * @param in the input Scantable
     96    * @param mask an optional mask if weight allows one
     97    * @param weight weighting scheme
     98    * @return
     99    */
    92100  casa::CountedPtr< Scantable >
    93101    averagePolarisations( const casa::CountedPtr< Scantable > & in,
    94                                 const std::vector<bool>& mask,
    95                                 const std::string& weight );
     102                          const std::vector<bool>& mask,
     103                          const std::string& weight );
    96104
    97105  casa::CountedPtr<Scantable>
     
    159167    convertPolarisation( const casa::CountedPtr<Scantable>& in,
    160168                         const std::string& newtype);
     169 
     170  casa::CountedPtr<Scantable>
     171      mxExtract( const casa::CountedPtr<Scantable>& in,
     172                 const std::string& scantype = "on" );
    161173
    162174private:
  • trunk/src/STMathWrapper.h

    r1078 r1140  
    144144                                        const std::string& newtype )
    145145  { return ScantableWrapper(STMath::convertPolarisation(in.getCP(),newtype)); }
     146 
     147  ScantableWrapper mxExtract( const ScantableWrapper& in,
     148                              const std::string& scantype="on" )
     149  { return ScantableWrapper(STMath::mxExtract(in.getCP(),scantype)); }
    146150
    147151};
  • trunk/src/python_STMath.cpp

    r1069 r1140  
    6565        .def("_swap_linears", &STMathWrapper::swapPolarisations)
    6666        .def("_freq_align", &STMathWrapper::frequencyAlign)
    67       ;
     67        .def("_mx_extract", &STMathWrapper::mxExtract)
     68          ;
    6869    };
    6970
Note: See TracChangeset for help on using the changeset viewer.