Changeset 1111


Ignore:
Timestamp:
08/04/06 12:06:38 (18 years ago)
Author:
mar637
Message:

add getNumbers utility function, which is now called by all function which retrieve numbers from the Scantable

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.cpp

    r1068 r1111  
    134134      table_.markForDelete();
    135135  }
    136 
     136  /// @todo reindex SCANNO, recompute nbeam, nif, npol
    137137  if ( clear ) copySubtables(other);
    138138  attachSubtables();
     
    338338
    339339
    340 int Scantable::nscan() const {
    341   Vector<uInt> scannos(scanCol_.getColumn());
    342   uInt nout = GenSort<uInt>::sort( scannos, Sort::Ascending,
    343                        Sort::QuickSort|Sort::NoDuplicates );
    344   return int(nout);
    345 }
    346340
    347341std::string Scantable::formatSec(Double x) const
     
    418412  String inname(filename);
    419413  Path path(inname);
     414  /// @todo reindex SCANNO, recompute nbeam, nif, npol
    420415  inname = path.expandedName();
    421416  table_.deepCopy(inname, Table::New);
     
    532527}
    533528
     529int Scantable::nscan() const {
     530  Vector<uInt> scannos(scanCol_.getColumn());
     531  uInt nout = GenSort<uInt>::sort( scannos, Sort::Ascending,
     532                       Sort::QuickSort|Sort::NoDuplicates );
     533  return int(nout);
     534}
     535
    534536int Scantable::getChannels(int whichrow) const
    535537{
     
    540542{
    541543  return beamCol_(whichrow);
     544}
     545
     546std::vector<uint> Scantable::getNumbers(ScalarColumn<uInt>& col)
     547{
     548  Vector<uInt> nos(col.getColumn());
     549  GenSort<uInt>::sort( nos, Sort::Ascending,
     550                       Sort::QuickSort|Sort::NoDuplicates );
     551  std::vector<uint> stlout;
     552  nos.tovector(stlout);
     553  return stlout;
    542554}
    543555
     
    981993}
    982994
    983 void asap::Scantable::addFit( const STFitEntry & fit, int row )
     995void Scantable::addFit( const STFitEntry & fit, int row )
    984996{
    985997  cout << mfitidCol_(uInt(row)) << endl;
  • trunk/src/Scantable.h

    r1104 r1111  
    250250  std::string getPolType() const;
    251251
     252
     253  /**
     254   * Get the number of integartion cycles
     255   * @param scanno the scan number to get the number of rows for.
     256   * If scanno<0 the number is retrieved from the header.
     257   * @return the number of rows (for the specified scanno)
     258   */
     259  int nrow(int scanno=-1) const;
     260
     261  int getBeam(int whichrow) const;
     262  std::vector<uint> getBeamNos() { return getNumbers(beamCol_); }
     263
     264  int getIF(int whichrow) const;
     265  std::vector<uint> getIFNos() { return getNumbers(ifCol_); }
     266
     267  int getPol(int whichrow) const;
     268  std::vector<uint> getPolNos() { return getNumbers(polCol_); }
     269
     270  std::vector<uint> getScanNos() { return getNumbers(scanCol_); }
     271  int getScan(int whichrow) const { return scanCol_(whichrow); }
     272
    252273  /**
    253274   * Get the number of channels in the data or a specific IF. This currently
     
    258279   */
    259280  int nchan(int ifno=-1) const;
    260 
    261   /**
    262    * Get the number of integartion cycles
    263    * @param scanno the scan number to get the number of rows for.
    264    * If scanno<0 the number is retrieved from the header.
    265    * @return the number of rows (for the specified scanno)
    266    */
    267   int nrow(int scanno=-1) const;
     281  int getChannels(int whichrow) const;
    268282
    269283  int ncycle(int scanno=-1) const;
    270 
    271   int getBeam(int whichrow) const;
    272   int getIF(int whichrow) const;
    273   int getPol(int whichrow) const;
    274284  int getCycle(int whichrow) const { return cycleCol_(whichrow); }
    275   int getScan(int whichrow) const { return scanCol_(whichrow); }
    276   int getChannels(int whichrow) const;
    277285
    278286  double getInterval(int whichrow) const
     
    402410   */
    403411  int rowToScanIndex(int therow);
     412
     413  std::vector<uint> getNumbers(casa::ScalarColumn<casa::uInt>& col);
    404414
    405415  static const casa::uInt version_ = 2;
  • trunk/src/ScantableWrapper.h

    r1077 r1111  
    116116    { table_->setSpectrum(spectrum, whichrow); }
    117117
     118  std::vector<uint> getIFNos() { return table_->getIFNos(); }
    118119  int getIF(int whichrow) const {return table_->getIF(whichrow);}
     120  std::vector<uint> getBeamNos() { return table_->getBeamNos(); }
    119121  int getBeam(int whichrow) const {return table_->getBeam(whichrow);}
     122  std::vector<uint> getPolNos() { return table_->getPolNos(); }
    120123  int getPol(int whichrow) const {return table_->getPol(whichrow);}
    121124  int getCycle(int whichrow) const {return table_->getCycle(whichrow);}
     125  std::vector<uint> getScanNos() { return table_->getScanNos(); }
    122126  int getScan(int whichrow) const {return table_->getScan(whichrow);}
    123127
  • trunk/src/python_Scantable.cpp

    r1077 r1111  
    5050    .def("_assign", &ScantableWrapper::assign)
    5151    .def("getif", &ScantableWrapper::getIF)
     52    .def("getifnos", &ScantableWrapper::getIFNos)
    5253    .def("getbeam", &ScantableWrapper::getBeam)
     54    .def("getbeamnos", &ScantableWrapper::getBeamNos)
    5355    .def("getpol", &ScantableWrapper::getPol)
     56    .def("getpolnos", &ScantableWrapper::getPolNos)
    5457    .def("getscan", &ScantableWrapper::getScan)
     58    .def("getscannos", &ScantableWrapper::getScanNos)
    5559    .def("getcycle", &ScantableWrapper::getCycle)
    5660    .def("nif", &ScantableWrapper::nif,
Note: See TracChangeset for help on using the changeset viewer.