source: trunk/src/STApplyTable.cpp@ 2702

Last change on this file since 2702 was 2696, checked in by Takeshi Nakazato, 12 years ago

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: Yes/No

Module(s): Module Names change impacts.

Description: Describe your changes here...

First version of single dish apply table.

STApplyTable: base class
STCalTsys: apply table for Tsys calibration
STCalSky: apply table for sky calibration


File size: 2.7 KB
RevLine 
[2696]1//
2// C++ Implementation: STApplyTable
3//
4// Description:
5//
6//
7// Author: Takeshi Nakazato
8//
9// Copyright: See COPYING file that comes with this distribution
10//
11//
12#include <casa/Exceptions/Error.h>
13#include <tables/Tables/TableDesc.h>
14#include <tables/Tables/SetupNewTab.h>
15#include <tables/Tables/ScaColDesc.h>
16#include <tables/Tables/TableRecord.h>
17#include <measures/TableMeasures/TableMeasDesc.h>
18#include <measures/TableMeasures/TableMeasRefDesc.h>
19#include <measures/TableMeasures/TableMeasValueDesc.h>
20
21#include "Scantable.h"
22#include "STApplyTable.h"
23
24
25using namespace casa;
26
27namespace asap {
28
29STApplyTable::STApplyTable( const Scantable& parent, const casa::String& name )
30{
31 TableDesc td("", "1", TableDesc::Scratch);
32 td.addColumn(ScalarColumnDesc<uInt>("SCANNO"));
33 td.addColumn(ScalarColumnDesc<uInt>("CYCLENO"));
34 td.addColumn(ScalarColumnDesc<uInt>("BEAMNO"));
35 td.addColumn(ScalarColumnDesc<uInt>("IFNO"));
36 td.addColumn(ScalarColumnDesc<uInt>("POLNO"));
37 td.addColumn(ScalarColumnDesc<Double>("TIME"));
38 TableMeasRefDesc measRef(MEpoch::UTC); // UTC as default
39 TableMeasValueDesc measVal(td, "TIME");
40 TableMeasDesc<MEpoch> mepochCol(measVal, measRef);
41 mepochCol.write(td);
42 String tabname = parent.table().tableName()+"/"+name;
43 SetupNewTable aNewTab(tabname, td, Table::Scratch);
44 //table_ = Table(aNewTab, parent.table().tableType());
45 table_ = Table(aNewTab, Table::Memory);
46 attachBaseColumns();
47
48 table_.rwKeywordSet().define("VERSION", 1);
49 table_.rwKeywordSet().define("ScantableName", parent.table().tableName());
50 table_.rwKeywordSet().define("ApplyType", "NONE");
51 table_.rwKeywordSet().defineTable("FREQUENCIES", parent.frequencies().table());
52
53 table_.tableInfo().setType("ApplyTable");
54
55 originaltable_ = table_;
56}
57
58
59STApplyTable::~STApplyTable()
60{
61}
62
63void STApplyTable::attach()
64{
65 attachBaseColumns();
66 attachOptionalColumns();
67}
68
69void STApplyTable::attachBaseColumns()
70{
71 scanCol_.attach(table_, "SCANNO");
72 cycleCol_.attach(table_, "CYCLENO");
73 beamCol_.attach(table_, "BEAMNO");
74 ifCol_.attach(table_, "IFNO");
75 polCol_.attach(table_, "POLNO");
76 timeCol_.attach(table_, "TIME");
77 timeMeasCol_.attach(table_, "TIME");
78}
79
80void STApplyTable::setSelection(STSelector &sel)
81{
82 table_ = sel.apply(originaltable_);
83 attach();
84 sel_ = sel;
85}
86
87void STApplyTable::unsetSelection()
88{
89 table_ = originaltable_;
90 attach();
91 sel_.reset();
92}
93
94void STApplyTable::setbasedata(uInt irow, uInt scanno, uInt cycleno,
95 uInt beamno, uInt ifno, uInt polno,
96 Double time)
97{
98 scanCol_.put(irow, scanno);
99 cycleCol_.put(irow, cycleno);
100 beamCol_.put(irow, beamno);
101 ifCol_.put(irow, ifno);
102 polCol_.put(irow, polno);
103 timeCol_.put(irow, time);
104}
105
106}
Note: See TracBrowser for help on using the repository browser.