Changeset 1000 for trunk/src


Ignore:
Timestamp:
04/07/06 09:41:02 (19 years ago)
Author:
mar637
Message:

fixed bug due to incorrect use of Table::rowNumbers (RTFM!).
added flagging

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/STFit.cpp

    r972 r1000  
    9090    Table t = table_(table_.col("ID") == id );
    9191    if (t.nrow() > 0) {
    92       rno = t.rowNumbers()[0];
     92      rno = t.rowNumbers(table_)[0];
    9393      resultid = id;
    9494      foundentry = true;
     
    102102  // add new row if new id
    103103  if ( !foundentry ) table_.addRow();
    104   cout << rno << "   " << resultid << endl;
    105104  funcCol_.put(rno, mathutil::toVectorString(fit.getFunctions()));
    106105  compCol_.put(rno, Vector<Int>(fit.getComponents()));
  • trunk/src/STMath.cpp

    r996 r1000  
    10041004  setInsitu(insitu);
    10051005  Table& tout = out->table();
    1006   // clear ouput frequency table
    1007   //Table ftable = out->frequencies().table();
    1008   //ftable.removeRow(ftable.rowNumbers());
    10091006  // Get reference Epoch to time of first row or given String
    10101007  Unit DAY(String("d"));
     
    11351132  if ( in->getPolType() == newtype )
    11361133    throw(AipsError("No need to convert."));
     1134  if ( ! in->selector_.empty() )
     1135    throw(AipsError("Can only convert whole scantable. Unset the selection."));
    11371136  bool insitu = insitu_;
    11381137  setInsitu(false);
  • trunk/src/STSelector.cpp

    r995 r1000  
    123123  TableExprNode query;
    124124  intidmap::const_iterator it;
    125   for (it= intselections_.begin(); it != intselections_.end(); ++it) {
     125  for (it = intselections_.begin(); it != intselections_.end(); ++it) {
    126126    TableExprNode theset(Vector<Int>( (*it).second ));
    127127    if ( query.isNull() ) {
     
    154154      return sort(tab);
    155155    } else {
     156      cout << "query rows"<< tab(query).nrow() << endl;
    156157      return sort(tab(query));
    157158    }
  • trunk/src/Scantable.cpp

    r999 r1000  
    578578}
    579579
    580 void Scantable::flag()
     580void Scantable::flag(const std::vector<bool>& msk)
    581581{
    582582  if ( selector_.empty() )
    583     throw(AipsError("Trying to flag whole scantable. Aborted."));
    584   TableVector<uChar> tvec(table_, "FLAGTRA");
    585   uChar userflag = 1 << 7;
    586   tvec = userflag;
     583    throw(AipsError("Trying to flag whole scantable."));
     584  if ( msk.size() == 0 ) {
     585    uChar userflag = 1 << 7;
     586    for ( uInt i=0; i<table_.nrow(); ++i) {
     587      Vector<uChar> flgs = flagsCol_(i);
     588      flgs = userflag;
     589      flagsCol_.put(i, flgs);
     590    }
     591    return;
     592  }
     593  if ( int(msk.size()) != nchan() ) {
     594    throw(AipsError("Mask has incorrect number of channels."));
     595  }
     596  for ( uInt i=0; i<table_.nrow(); ++i) {
     597    Vector<uChar> flgs = flagsCol_(i);
     598    if ( flgs.nelements() != msk.size() ) {
     599      throw(AipsError("Mask has incorrect number of channels."
     600                      " Probably varying with IF. Please flag per IF"));
     601    }
     602    std::vector<bool>::const_iterator it;
     603    uInt j = 0;
     604    uChar userflag = 1 << 7;
     605    for (it = msk.begin(); it != msk.end(); ++it) {
     606      if ( *it ) {
     607        flgs(j) = userflag;
     608      }
     609      ++j;
     610    }
     611    flagsCol_.put(i, flgs);
     612  }
    587613}
    588614
     
    762788      ROTableRow brow(bsubt);
    763789      const TableRecord& brec = brow.get(0);
    764       uInt row0 = bsubt.rowNumbers()[0];
     790      uInt row0 = bsubt.rowNumbers(table_)[0];
    765791      oss << setw(5) << "" <<  setw(4) << std::right << brec.asuInt("BEAMNO")<< std::left;
    766792      oss  << setw(4) << ""  << formatDirection(getDirection(row0)) << endl;
  • trunk/src/Scantable.h

    r987 r1000  
    183183   * "hard" flag the data, this flags everything selected in setSelection()
    184184   */
    185   void flag();
     185  void flag( const std::vector<bool>& msk = std::vector<bool>());
    186186
    187187  /**
  • trunk/src/ScantableWrapper.h

    r987 r1000  
    9494    { return table_->getMask(whichrow); }
    9595
    96   void flag() { table_->flag(); }
     96  void flag(const std::vector<bool>& msk=std::vector<bool>())
     97    { table_->flag(msk); }
    9798
    9899  std::string getSourceName(int whichrow=0) const
  • trunk/src/python_Scantable.cpp

    r987 r1000  
    2727//#                        AUSTRALIA
    2828//#
    29 //# $Id:
     29//# $Id:$
    3030//#---------------------------------------------------------------------------
    3131#include <vector>
Note: See TracChangeset for help on using the changeset viewer.