Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/Scantable.cpp

    r1947 r1819  
    101101  fitTable_ = STFit(*this);
    102102  table_.rwKeywordSet().defineTable("FIT", fitTable_.table());
    103   table_.tableInfo().setType( "Scantable" ) ;
    104103  originalTable_ = table_;
    105104  attach();
     
    121120    table_ = tab;
    122121  }
    123   table_.tableInfo().setType( "Scantable" ) ;
    124122
    125123  attachSubtables();
     
    167165      table_.markForDelete();
    168166  }
    169   table_.tableInfo().setType( "Scantable" ) ;
    170167  /// @todo reindex SCANNO, recompute nbeam, nif, npol
    171168  if ( clear ) copySubtables(other);
     
    684681std::string Scantable::formatTime(const MEpoch& me, bool showdate) const
    685682{
    686   return formatTime(me, showdate, 0);
    687 }
    688 
    689 std::string Scantable::formatTime(const MEpoch& me, bool showdate, uInt prec) const
    690 {
    691683  MVTime mvt(me.getValue());
    692684  if (showdate)
    693     //mvt.setFormat(MVTime::YMD);
    694     mvt.setFormat(MVTime::YMD, prec);
     685    mvt.setFormat(MVTime::YMD);
    695686  else
    696     //mvt.setFormat(MVTime::TIME);
    697     mvt.setFormat(MVTime::TIME, prec);
     687    mvt.setFormat(MVTime::TIME);
    698688  ostringstream oss;
    699689  oss << mvt;
     
    10421032}
    10431033
    1044 // std::string Scantable::getTime(int whichrow, bool showdate) const
    1045 // {
    1046 //   MEpoch::ROScalarColumn timeCol(table_, "TIME");
    1047 //   MEpoch me;
    1048 //   if (whichrow > -1) {
    1049 //     me = timeCol(uInt(whichrow));
    1050 //   } else {
    1051 //     Double tm;
    1052 //     table_.keywordSet().get("UTC",tm);
    1053 //     me = MEpoch(MVEpoch(tm));
    1054 //   }
    1055 //   return formatTime(me, showdate);
    1056 // }
    1057 
    1058 std::string Scantable::getTime(int whichrow, bool showdate, uInt prec) const
    1059 {
     1034std::string Scantable::getTime(int whichrow, bool showdate) const
     1035{
     1036  MEpoch::ROScalarColumn timeCol(table_, "TIME");
    10601037  MEpoch me;
    1061   me = getEpoch(whichrow);
    1062   return formatTime(me, showdate, prec);
     1038  if (whichrow > -1) {
     1039    me = timeCol(uInt(whichrow));
     1040  } else {
     1041    Double tm;
     1042    table_.keywordSet().get("UTC",tm);
     1043    me = MEpoch(MVEpoch(tm));
     1044  }
     1045  return formatTime(me, showdate);
    10631046}
    10641047
     
    17261709}
    17271710
    1728 bool Scantable::getFlagtraFast(int whichrow)
    1729 {
    1730   uChar flag;
    1731   Vector<uChar> flags;
    1732   flagsCol_.get(uInt(whichrow), flags);
    1733   for (int i = 0; i < flags.size(); i++) {
    1734     if (i==0) {
    1735       flag = flags[i];
    1736     }
    1737     else {
    1738       flag &= flags[i];
    1739     }
    1740     return ((flag >> 7) == 1);
    1741    }
    1742 }
    1743 
    1744 void Scantable::doPolyBaseline(const std::vector<bool>& mask, int order, int rowno, Fitter& fitter)
    1745 {
    1746   fitter.setExpression("poly", order);
    1747 
    1748   std::vector<double> abcsd = getAbcissa(rowno);
    1749   std::vector<float> abcs;
    1750   for (int i = 0; i < abcsd.size(); i++) {
    1751     abcs.push_back((float)abcsd[i]);
    1752   }
    1753   std::vector<float> spec = getSpectrum(rowno);
    1754   std::vector<bool> fmask = getMask(rowno);
    1755   if (fmask.size() != mask.size()) {
    1756     throw(AipsError("different mask sizes"));
    1757   }
    1758   for (int i = 0; i < fmask.size(); i++) {
    1759     fmask[i] = fmask[i] && mask[i];
    1760   }
    1761   fitter.setData(abcs, spec, fmask);
    1762 
    1763   fitter.lfit();
    1764 }
    1765 
    1766 void Scantable::polyBaselineBatch(const std::vector<bool>& mask, int order)
    1767 {
    1768   Fitter fitter = Fitter();
    1769   for (uInt rowno=0; rowno < nrow(); ++rowno) {
    1770     doPolyBaseline(mask, order, rowno, fitter);
    1771     setSpectrum(fitter.getResidual(), rowno);
    1772   }
    1773 }
    1774 
    1775 STFitEntry Scantable::polyBaseline(const std::vector<bool>& mask, int order, int rowno)
    1776 {
    1777   Fitter fitter = Fitter();
    1778   doPolyBaseline(mask, order, rowno, fitter);
    1779   setSpectrum(fitter.getResidual(), rowno);
    1780   return fitter.getFitEntry();
    1781 }
    1782 
    17831711}
    17841712//namespace asap
Note: See TracChangeset for help on using the changeset viewer.