Changes in trunk/src/Scantable.cpp [1947:1819]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/Scantable.cpp
r1947 r1819 101 101 fitTable_ = STFit(*this); 102 102 table_.rwKeywordSet().defineTable("FIT", fitTable_.table()); 103 table_.tableInfo().setType( "Scantable" ) ;104 103 originalTable_ = table_; 105 104 attach(); … … 121 120 table_ = tab; 122 121 } 123 table_.tableInfo().setType( "Scantable" ) ;124 122 125 123 attachSubtables(); … … 167 165 table_.markForDelete(); 168 166 } 169 table_.tableInfo().setType( "Scantable" ) ;170 167 /// @todo reindex SCANNO, recompute nbeam, nif, npol 171 168 if ( clear ) copySubtables(other); … … 684 681 std::string Scantable::formatTime(const MEpoch& me, bool showdate) const 685 682 { 686 return formatTime(me, showdate, 0);687 }688 689 std::string Scantable::formatTime(const MEpoch& me, bool showdate, uInt prec) const690 {691 683 MVTime mvt(me.getValue()); 692 684 if (showdate) 693 //mvt.setFormat(MVTime::YMD); 694 mvt.setFormat(MVTime::YMD, prec); 685 mvt.setFormat(MVTime::YMD); 695 686 else 696 //mvt.setFormat(MVTime::TIME); 697 mvt.setFormat(MVTime::TIME, prec); 687 mvt.setFormat(MVTime::TIME); 698 688 ostringstream oss; 699 689 oss << mvt; … … 1042 1032 } 1043 1033 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 { 1034 std::string Scantable::getTime(int whichrow, bool showdate) const 1035 { 1036 MEpoch::ROScalarColumn timeCol(table_, "TIME"); 1060 1037 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); 1063 1046 } 1064 1047 … … 1726 1709 } 1727 1710 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 1783 1711 } 1784 1712 //namespace asap
Note:
See TracChangeset
for help on using the changeset viewer.