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