Line data Source code
1 : //# CalDescColumns.cc: Implementation of CalDescColumns.h
2 : //# Copyright (C) 1996,1997,1998,2001,2002,2003
3 : //# Associated Universities, Inc. Washington DC, USA.
4 : //#
5 : //# This library is free software; you can redistribute it and/or modify it
6 : //# under the terms of the GNU Library General Public License as published by
7 : //# the Free Software Foundation; either version 2 of the License, or (at your
8 : //# option) any later version.
9 : //#
10 : //# This library is distributed in the hope that it will be useful, but WITHOUT
11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 : //# License for more details.
14 : //#
15 : //# You should have received a copy of the GNU Library General Public License
16 : //# along with this library; if not, write to the Free Software Foundation,
17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 : //#
19 : //# Correspondence concerning AIPS++ should be addressed as follows:
20 : //# Internet email: casa-feedback@nrao.edu.
21 : //# Postal address: AIPS++ Project Office
22 : //# National Radio Astronomy Observatory
23 : //# 520 Edgemont Road
24 : //# Charlottesville, VA 22903-2475 USA
25 : //#
26 : //# $Id$
27 : //----------------------------------------------------------------------------
28 :
29 : #include <synthesis/CalTables/CalDescColumns.h>
30 :
31 : using namespace casacore;
32 : namespace casa { //# NAMESPACE CASA - BEGIN
33 :
34 : //----------------------------------------------------------------------------
35 :
36 0 : ROCalDescColumns::ROCalDescColumns (const CalTable& calTable)
37 : {
38 : // Construct from a calibration table
39 : // Input:
40 : // calTable const CalTable& Calibration table
41 : // Output to private data:
42 : // numSpw_p ScalarColumn<Int> No. spw
43 : // numChan_p ArrayColumn<Int> No. chan
44 : // numReceptors_p ScalarColumn<Int> No. receptors
45 : // nJones_p ScalarColumn<Int> Jones matrix size
46 : // spwId_p ArrayColumn<Int> Spw. id.'s
47 : // chanFreq_p ArrayColumn<Double> Chan. freq.
48 : // chanFreqMeas_p ROArrayMeasColumn<MFrequency> Chan. freq. as Measure
49 : // measFreqRef_p ScalarColumn<Int> Freq. measures ref.
50 : // chanWidth_p ArrayColumn<Double> Chan. width
51 : // chanWidthQuant_p ROArrayQuantColumn<Double> Chan. width as Quanta
52 : // chanRange_p ArrayColumn<Int> Chan. range
53 : // polznType_p ArrayColumn<String> Polzn. type
54 : // jonesType_p ScalarColumn<String> Jones matrix type
55 : // msName_p ScalarColumn<String> MeasurementSet name
56 : //
57 : // Attach all the column accessors (including required and
58 : // optional columns)
59 0 : attach (calTable, numSpw_p, MSC::NUM_SPW);
60 0 : attach (calTable, numChan_p, MSC::NUM_CHAN);
61 0 : attach (calTable, numReceptors_p, MSC::NUM_RECEPTORS);
62 0 : attach (calTable, nJones_p, MSC::N_JONES);
63 0 : attach (calTable, spwId_p, MSC::SPECTRAL_WINDOW_ID);
64 0 : attach (calTable, chanFreq_p, MSC::CHAN_FREQ);
65 0 : attach (calTable, chanFreqMeas_p, MSC::CHAN_FREQ);
66 0 : attach (calTable, measFreqRef_p, MSC::MEAS_FREQ_REF);
67 0 : attach (calTable, chanWidth_p, MSC::CHAN_WIDTH);
68 0 : attach (calTable, chanWidthQuant_p, MSC::CHAN_WIDTH);
69 0 : attach (calTable, chanRange_p, MSC::CHAN_RANGE);
70 0 : attach (calTable, polznType_p, MSC::POLARIZATION_TYPE);
71 0 : attach (calTable, msName_p, MSC::MS_NAME);
72 :
73 0 : };
74 :
75 : //----------------------------------------------------------------------------
76 :
77 0 : void ROCalDescColumns::attach (const CalTable& calTable,
78 : TableColumn& tabCol,
79 : MSCalEnums::colDef colEnum,
80 : const Bool& optional)
81 : {
82 : // Attach a column accessor to the calibration table
83 : // Input:
84 : // calTable const CalTable& Calibration table
85 : // tabCol TableColumn& Table column accessor
86 : // colEnum MSCalEnums::colDef Column enum
87 : // optional const Bool& true if optional column
88 : // Output to private data:
89 : //
90 : // Convert to column name
91 0 : String colName = MSC::fieldName (colEnum);
92 :
93 : // Check if an optional column
94 0 : if (optional) {
95 0 : if (calDescAsTable(calTable).tableDesc().isColumn(colName)) {
96 0 : tabCol.attach (calDescAsTable(calTable), colName);
97 : };
98 : } else {
99 0 : tabCol.attach (calDescAsTable(calTable), colName);
100 : };
101 0 : };
102 :
103 : //----------------------------------------------------------------------------
104 :
105 0 : void ROCalDescColumns::attach (const CalTable& calTable,
106 : ROTableMeasColumn& tabCol,
107 : MSCalEnums::colDef colEnum,
108 : const Bool& optional)
109 : {
110 : // Attach a column accessor to the calibration table
111 : // Input:
112 : // calTable const CalTable& Calibration table
113 : // tabCol ROTableMeasColumn& Table measures column accessor
114 : // colEnum MSCalEnums::colDef Column enum
115 : // optional const Bool& true if optional column
116 : // Output to private data:
117 : //
118 : // Convert to column name
119 0 : String colName = MSC::fieldName (colEnum);
120 :
121 : // Check if an optional column
122 0 : if (optional) {
123 0 : if (calDescAsTable(calTable).tableDesc().isColumn(colName)) {
124 0 : tabCol.attach (calDescAsTable(calTable), colName);
125 : };
126 : } else {
127 0 : tabCol.attach (calDescAsTable(calTable), colName);
128 : };
129 0 : };
130 :
131 : //----------------------------------------------------------------------------
132 :
133 0 : void ROCalDescColumns::attach (const CalTable& calTable,
134 : ROArrayQuantColumn<Double>& tabCol,
135 : MSCalEnums::colDef colEnum,
136 : const Bool& optional)
137 : {
138 : // Attach a column accessor to the calibration table
139 : // Input:
140 : // calTable const CalTable& Calibration table
141 : // tabCol ROArrayQuantColumn<Double>& Table quanta column
142 : // accessor
143 : // colEnum MSCalEnums::colDef Column enum
144 : // optional const Bool& true if optional column
145 : // Output to private data:
146 : //
147 : // Convert to column name
148 0 : String colName = MSC::fieldName (colEnum);
149 :
150 : // Check if an optional column
151 0 : if (optional) {
152 0 : if (calDescAsTable(calTable).tableDesc().isColumn(colName)) {
153 0 : tabCol.attach (calDescAsTable(calTable), colName);
154 : };
155 : } else {
156 0 : tabCol.attach (calDescAsTable(calTable), colName);
157 : };
158 0 : };
159 :
160 : //----------------------------------------------------------------------------
161 :
162 0 : CalDescColumns::CalDescColumns (CalTable& calTable)
163 : {
164 : // Construct from a calibration table
165 : // Input:
166 : // Input:
167 : // calTable CalTable& Calibration table
168 : // Output to private data:
169 : // numSpw_p ScalarColumn<Int> No. spw
170 : // numChan_p ArrayColumn<Int> No. chan
171 : // numReceptors_p ScalarColumn<Int> No. receptors
172 : // nJones_p ScalarColumn<Int> Jones matrix size
173 : // spwId_p ArrayColumn<Int> Spw. id.'s
174 : // chanFreq_p ArrayColumn<Double> Chan. freq.
175 : // chanFreqMeas_p ArrayMeasColumn<MFrequency> Chan. freq. as Measure
176 : // measFreqRef_p ScalarColumn<Int> Freq. measures ref.
177 : // chanWidth_p ArrayColumn<Double> Chan. width
178 : // chanWidthQuant_p ArrayQuantColumn<Double> Chan. width as Quanta
179 : // chanRange_p ArrayColumn<Int> Chan. range
180 : // polznType_p ArrayColumn<String> Polzn. type
181 : // jonesType_p ScalarColumn<String> Jones matrix type
182 : // msName_p ScalarColumn<String> MeasurementSet name
183 : //
184 : // Attach all the column accessors (including required and
185 : // optional columns)
186 0 : attach (calTable, numSpw_p, MSC::NUM_SPW);
187 0 : attach (calTable, numChan_p, MSC::NUM_CHAN);
188 0 : attach (calTable, numReceptors_p, MSC::NUM_RECEPTORS);
189 0 : attach (calTable, nJones_p, MSC::N_JONES);
190 0 : attach (calTable, spwId_p, MSC::SPECTRAL_WINDOW_ID);
191 0 : attach (calTable, chanFreq_p, MSC::CHAN_FREQ);
192 0 : attach (calTable, chanFreqMeas_p, MSC::CHAN_FREQ);
193 0 : attach (calTable, measFreqRef_p, MSC::MEAS_FREQ_REF);
194 0 : attach (calTable, chanWidth_p, MSC::CHAN_WIDTH);
195 0 : attach (calTable, chanWidthQuant_p, MSC::CHAN_WIDTH);
196 0 : attach (calTable, chanRange_p, MSC::CHAN_RANGE);
197 0 : attach (calTable, polznType_p, MSC::POLARIZATION_TYPE);
198 0 : attach (calTable, msName_p, MSC::MS_NAME);
199 0 : };
200 :
201 : //----------------------------------------------------------------------------
202 :
203 0 : void CalDescColumns::attach (CalTable& calTable,
204 : TableColumn& tabCol,
205 : MSCalEnums::colDef colEnum,
206 : const Bool& optional)
207 : {
208 : // Attach a column accessor to the calibration table
209 : // Input:
210 : // calTable CalTable& Calibration table
211 : // tabCol TableColumn& Table column accessor
212 : // colEnum MSCalEnums::colDef Column enum
213 : // optional const Bool& true if optional column
214 : // Output to private data:
215 : //
216 : // Convert to column name
217 0 : String colName = MSC::fieldName (colEnum);
218 :
219 : // Check if an optional column
220 0 : if (optional) {
221 0 : if (calDescAsTable(calTable).tableDesc().isColumn(colName)) {
222 0 : tabCol.attach (calDescAsTable(calTable), colName);
223 : };
224 : } else {
225 0 : tabCol.attach (calDescAsTable(calTable), colName);
226 : };
227 0 : };
228 :
229 : //----------------------------------------------------------------------------
230 :
231 0 : void CalDescColumns::attach (CalTable& calTable,
232 : ROTableMeasColumn& tabCol,
233 : MSCalEnums::colDef colEnum,
234 : const Bool& optional)
235 : {
236 : // Attach a column accessor to the calibration table
237 : // Input:
238 : // calTable CalTable& Calibration table
239 : // tabCol ROTableMeasColumn& Table measures column accessor
240 : // colEnum MSCalEnums::colDef Column enum
241 : // optional const Bool& true if optional column
242 : // Output to private data:
243 : //
244 : // Convert to column name
245 0 : String colName = MSC::fieldName (colEnum);
246 :
247 : // Check if an optional column
248 0 : if (optional) {
249 0 : if (calDescAsTable(calTable).tableDesc().isColumn(colName)) {
250 0 : tabCol.attach (calDescAsTable(calTable), colName);
251 : };
252 : } else {
253 0 : tabCol.attach (calDescAsTable(calTable), colName);
254 : };
255 0 : };
256 :
257 : //----------------------------------------------------------------------------
258 :
259 0 : void CalDescColumns::attach (CalTable& calTable,
260 : ROArrayQuantColumn<Double>& tabCol,
261 : MSCalEnums::colDef colEnum,
262 : const Bool& optional)
263 : {
264 : // Attach a column accessor to the calibration table
265 : // Input:
266 : // calTable CalTable& Calibration table
267 : // tabCol ROArrayQuantColumn<Double>& Table quanta
268 : // column accessor
269 : // colEnum MSCalEnums::colDef Column enum
270 : // optional const Bool& true if optional column
271 : // Output to private data:
272 : //
273 : // Convert to column name
274 0 : String colName = MSC::fieldName (colEnum);
275 :
276 : // Check if an optional column
277 0 : if (optional) {
278 0 : if (calDescAsTable(calTable).tableDesc().isColumn(colName)) {
279 0 : tabCol.attach (calDescAsTable(calTable), colName);
280 : };
281 : } else {
282 0 : tabCol.attach (calDescAsTable(calTable), colName);
283 : };
284 0 : };
285 :
286 : //----------------------------------------------------------------------------
287 :
288 :
289 :
290 : } //# NAMESPACE CASA - END
291 :
|