// // C++ Implementation: STApplyTable // // Description: // // // Author: Takeshi Nakazato (C) 2012 // // Copyright: See COPYING file that comes with this distribution // // #include #include #include #include #include #include #include #include #include "Scantable.h" #include "STApplyTable.h" using namespace casa; namespace asap { STApplyTable::STApplyTable( const Scantable& parent, const casa::String& name ) { TableDesc td("", "1", TableDesc::Scratch); td.addColumn(ScalarColumnDesc("SCANNO")); td.addColumn(ScalarColumnDesc("CYCLENO")); td.addColumn(ScalarColumnDesc("BEAMNO")); td.addColumn(ScalarColumnDesc("IFNO")); td.addColumn(ScalarColumnDesc("POLNO")); td.addColumn(ScalarColumnDesc("TIME")); TableMeasRefDesc measRef(MEpoch::UTC); // UTC as default TableMeasValueDesc measVal(td, "TIME"); TableMeasDesc mepochCol(measVal, measRef); mepochCol.write(td); String tabname = parent.table().tableName()+"/"+name; SetupNewTable aNewTab(tabname, td, Table::Scratch); //table_ = Table(aNewTab, parent.table().tableType()); table_ = Table(aNewTab, Table::Memory); attachBaseColumns(); table_.rwKeywordSet().define("VERSION", 1); table_.rwKeywordSet().define("ScantableName", parent.table().tableName()); table_.rwKeywordSet().define("ApplyType", "NONE"); table_.rwKeywordSet().defineTable("FREQUENCIES", parent.frequencies().table()); table_.tableInfo().setType("ApplyTable"); originaltable_ = table_; } STApplyTable::~STApplyTable() { } void STApplyTable::attach() { attachBaseColumns(); attachOptionalColumns(); } void STApplyTable::attachBaseColumns() { scanCol_.attach(table_, "SCANNO"); cycleCol_.attach(table_, "CYCLENO"); beamCol_.attach(table_, "BEAMNO"); ifCol_.attach(table_, "IFNO"); polCol_.attach(table_, "POLNO"); timeCol_.attach(table_, "TIME"); timeMeasCol_.attach(table_, "TIME"); } void STApplyTable::setSelection(STSelector &sel) { table_ = sel.apply(originaltable_); attach(); sel_ = sel; } void STApplyTable::unsetSelection() { table_ = originaltable_; attach(); sel_.reset(); } void STApplyTable::setbasedata(uInt irow, uInt scanno, uInt cycleno, uInt beamno, uInt ifno, uInt polno, Double time) { scanCol_.put(irow, scanno); cycleCol_.put(irow, cycleno); beamCol_.put(irow, beamno); ifCol_.put(irow, ifno); polCol_.put(irow, polno); timeCol_.put(irow, time); } void STApplyTable::save(const String &name) { table_.deepCopy(name, Table::New); } }