Changeset 2720 for trunk/src/STApplyTable.cpp
- Timestamp:
- 01/09/13 19:27:23 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/STApplyTable.cpp
r2703 r2720 15 15 #include <tables/Tables/ScaColDesc.h> 16 16 #include <tables/Tables/TableRecord.h> 17 #include <tables/Tables/Table.h> 18 #include <tables/Tables/ExprNode.h> 17 19 #include <measures/TableMeasures/TableMeasDesc.h> 18 20 #include <measures/TableMeasures/TableMeasRefDesc.h> … … 35 37 td.addColumn(ScalarColumnDesc<uInt>("IFNO")); 36 38 td.addColumn(ScalarColumnDesc<uInt>("POLNO")); 39 td.addColumn(ScalarColumnDesc<uInt>("FREQ_ID")); 37 40 td.addColumn(ScalarColumnDesc<Double>("TIME")); 38 41 TableMeasRefDesc measRef(MEpoch::UTC); // UTC as default … … 53 56 table_.tableInfo().setType("ApplyTable"); 54 57 58 originaltable_ = table_; 59 } 60 61 STApplyTable::STApplyTable(const String &name) 62 { 63 table_ = Table(name, Table::Update); 64 attachBaseColumns(); 55 65 originaltable_ = table_; 56 66 } … … 76 86 timeCol_.attach(table_, "TIME"); 77 87 timeMeasCol_.attach(table_, "TIME"); 88 freqidCol_.attach(table_, "FREQ_ID"); 78 89 } 79 90 80 void STApplyTable::setSelection(STSelector &sel )91 void STApplyTable::setSelection(STSelector &sel, bool sortByTime) 81 92 { 82 93 table_ = sel.apply(originaltable_); 94 if (sortByTime) 95 table_.sort("TIME", Sort::Descending); 83 96 attach(); 84 97 sel_ = sel; … … 94 107 void STApplyTable::setbasedata(uInt irow, uInt scanno, uInt cycleno, 95 108 uInt beamno, uInt ifno, uInt polno, 96 Double time)109 uInt freqid, Double time) 97 110 { 98 111 scanCol_.put(irow, scanno); … … 102 115 polCol_.put(irow, polno); 103 116 timeCol_.put(irow, time); 117 freqidCol_.put(irow, freqid); 104 118 } 105 119 … … 109 123 } 110 124 125 String STApplyTable::caltype() 126 { 127 if (table_.keywordSet().isDefined("ApplyType")) { 128 return table_.keywordSet().asString("ApplyType"); 129 } 130 else 131 return "NONE"; 111 132 } 133 134 STCalEnum::CalType STApplyTable::getCalType(const String &name) 135 { 136 Table t(name, Table::Old); 137 return stringToType(t.keywordSet().asString("ApplyType")); 138 } 139 140 STCalEnum::CalType STApplyTable::getCalType(CountedPtr<STApplyTable> tab) 141 { 142 return stringToType(tab->caltype()); 143 } 144 145 STCalEnum::CalType STApplyTable::getCalType(STApplyTable *tab) 146 { 147 return stringToType(tab->caltype()); 148 } 149 150 STCalEnum::CalType STApplyTable::stringToType(const String &caltype) 151 { 152 if (caltype == "CALSKY_PSALMA") 153 return STCalEnum::CalPSAlma; 154 else if (caltype == "CALTSYS") 155 return STCalEnum::CalTsys; 156 else 157 return STCalEnum::NoType; 158 } 159 160 Block<Double> STApplyTable::getFrequenciesRow(uInt id) 161 { 162 const TableRecord &rec = table_.keywordSet(); 163 rec.print(os_.output()); 164 os_ << LogIO::POST; 165 Table ftab = rec.asTable("FREQUENCIES"); 166 Table t = ftab(ftab.col("ID") == id); 167 ROTableColumn col(t, "REFPIX"); 168 Block<Double> r(3); 169 r[0] = col.asdouble(0); 170 col.attach(t, "REFVAL"); 171 r[1] = col.asdouble(0); 172 col.attach(t, "INCREMENT"); 173 r[2] = col.asdouble(0); 174 return r; 175 } 176 }
Note: See TracChangeset
for help on using the changeset viewer.