Line data Source code
1 : //# GJonesMBuf.h: GJones calibration main table buffer
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 adressed 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 : //#
27 : //# $Id$
28 :
29 : #ifndef CALIBRATION_GJONESMBUF_H
30 : #define CALIBRATION_GJONESMBUF_H
31 :
32 : #include <casacore/measures/Measures/MFrequency.h>
33 : #include <synthesis/CalTables/SolvableVJMBuf.h>
34 : #include <synthesis/CalTables/GJonesMCol.h>
35 : #include <synthesis/CalTables/GJonesTable.h>
36 :
37 : namespace casa { //# NAMESPACE CASA - BEGIN
38 :
39 : // <summary>
40 : // GJonesPolyMBuf: GJonesPoly calibration main table buffer
41 : // </summary>
42 :
43 : // <use visibility=export>
44 :
45 : // <reviewed reviewer="" date="" tests="" demos="">
46 :
47 : // <prerequisite>
48 : //<li><linkto class="CalMainBuffer">CalMainBuffer</linkto> module
49 : //<li><linkto class="SolvableVisJonesMBuf">SolvableVisJonesMBuf</linkto> module
50 : //<li><linkto class="GJonesMBuf">GJonesMBuf</linkto> module
51 : // </prerequisite>
52 : //
53 : // <etymology>
54 : // From "GJonesPoly matrix", "cal main table" and "buffer"
55 : // </etymology>
56 : //
57 : // <synopsis>
58 : // The GJonesPolyMBuf class holds a buffer, optionally connected to a
59 : // GJonesPoly calibration main table iterator (of base type CalIterBase).
60 : // The GJonesPoly matrix contains electronic gains expressed as
61 : // polynomials over time.
62 : // </synopsis>
63 : //
64 : // <example>
65 : // <srcblock>
66 : // </srcblock>
67 : // </example>
68 : //
69 : // <motivation>
70 : // Encapsulate GJonesPoly calibration main table data buffers.
71 : // </motivation>
72 : //
73 : // <todo asof="01/08/01">
74 : // (i) Deal with non-standard columns.
75 : // </todo>
76 :
77 : class GJonesPolyMBuf : public GJonesMBuf
78 : {
79 : public:
80 : // Default constructor. No connection to an underlying
81 : // calibration table iterator in this case.
82 : GJonesPolyMBuf();
83 :
84 : // Construct from a set of calibration buffer indices and
85 : // their specified values. Non-index columns will be set
86 : // to default values, and there is no connection to an
87 : // underlying calibration table iterator in this case.
88 : GJonesPolyMBuf (const casacore::Vector<casacore::Int>& calIndices,
89 : const casacore::Block<casacore::Vector<casacore::Int> >& indexValues);
90 :
91 : // Construct from a calibration table iterator. The calibration
92 : // buffer will remain synchronized with the iterator.
93 : GJonesPolyMBuf (CalIterBase& calIter);
94 :
95 : // Invalidate the current calibration buffer. This signals
96 : // that a re-read is required as the iterator has advanced
97 : virtual void invalidate();
98 :
99 : // Write the current buffer at the end of a specified cal table
100 : virtual casacore::Int append (CalTable& calTable);
101 :
102 : // Maximum number of rows in the calibration buffer
103 : virtual casacore::Int nRow();
104 :
105 : // Update the parametrized solution in each of a set of buffer rows
106 : virtual casacore::Bool fillMatchingRows (const casacore::Vector<casacore::Int>& matchingRows,
107 : const casacore::String& sFreqGrpName,
108 : const casacore::String& sPolyType,
109 : const casacore::String& sPolyMode,
110 : const casacore::Complex& sScaleFactor,
111 : const casacore::Int& sNPolyAmp, const casacore::Int& sNPolyPhase,
112 : const casacore::Vector<casacore::Double>& sPolyCoeffAmp,
113 : const casacore::Vector<casacore::Double>& sPolyCoeffPhase,
114 : const casacore::String& sPhaseUnits,
115 : const casacore::MFrequency& sRefFreq,
116 : const casacore::Int& sRefAnt);
117 :
118 : // casacore::Data field accessors
119 : virtual casacore::Vector<casacore::String>& polyType();
120 : virtual casacore::Vector<casacore::String>& polyMode();
121 : virtual casacore::Vector<casacore::Complex>& scaleFactor();
122 : virtual casacore::Vector<casacore::Int>& nPolyAmp();
123 : virtual casacore::Vector<casacore::Int>& nPolyPhase();
124 : virtual casacore::Array<casacore::Double>& polyCoeffAmp();
125 : virtual casacore::Array<casacore::Double>& polyCoeffPhase();
126 : virtual casacore::Vector<casacore::String>& phaseUnits();
127 :
128 : protected:
129 : // Factory method to create a columns accessor object of the
130 : // appropriate type
131 0 : virtual GJonesPolyMCol* newCalMainCol (CalTable& calTable) {
132 0 : return new GJonesPolyMCol(dynamic_cast<GJonesPolyTable&>(calTable));};
133 :
134 : // Access to the columns accessor object
135 0 : virtual GJonesPolyMCol* calMainCol()
136 0 : {return dynamic_cast<GJonesPolyMCol*>(CalMainBuffer::calMainCol());};
137 :
138 : // <group>
139 : // Fill the GJonesPoly cal buffer attribute columns in an empty
140 : // cal buffer, to extend the inherited method fillAttributes. The
141 : // cal indices, specified as enums from class MSCalEnums, are excluded
142 : // as non-attribute columns.
143 : //
144 : // Use a visibility buffer to define the attribute values (NYI)
145 0 : virtual void fillAttributes(const casacore::Vector<casacore::Int>& /*calIndices*/,
146 0 : const VisBuffer& /*vb*/) {};
147 : //
148 : // Set default attribute values
149 : virtual void fillAttributes(const casacore::Vector<casacore::Int>& calIndices);
150 : // </group>
151 :
152 : private:
153 : // Buffer fields
154 : casacore::Vector<casacore::String> polyType_p;
155 : casacore::Vector<casacore::String> polyMode_p;
156 : casacore::Vector<casacore::Complex> scaleFactor_p;
157 : casacore::Vector<casacore::Int> nPolyAmp_p;
158 : casacore::Vector<casacore::Int> nPolyPhase_p;
159 : casacore::Array<casacore::Double> polyCoeffAmp_p;
160 : casacore::Array<casacore::Double> polyCoeffPhase_p;
161 : casacore::Vector<casacore::String> phaseUnits_p;
162 :
163 : // Buffer field status flags
164 : casacore::Bool polyTypeOK_p;
165 : casacore::Bool polyModeOK_p;
166 : casacore::Bool scaleFactorOK_p;
167 : casacore::Bool nPolyAmpOK_p;
168 : casacore::Bool nPolyPhaseOK_p;
169 : casacore::Bool polyCoeffAmpOK_p;
170 : casacore::Bool polyCoeffPhaseOK_p;
171 : casacore::Bool phaseUnitsOK_p;
172 : };
173 :
174 : // <summary>
175 : // GJonesSplineMBuf: GJonesSpline calibration main table buffer
176 : // </summary>
177 :
178 : // <use visibility=export>
179 :
180 : // <reviewed reviewer="" date="" tests="" demos="">
181 :
182 : // <prerequisite>
183 : //<li><linkto class="CalMainBuffer">CalMainBuffer</linkto> module
184 : //<li><linkto class="SolvableVisJonesMBuf">SolvableVisJonesMBuf</linkto> module
185 : //<li><linkto class="GJonesMBuf">GJonesMBuf</linkto> module
186 : //<li><linkto class="GJonesPolyMBuf">GJonesPolyMBuf</linkto> module
187 : // </prerequisite>
188 : //
189 : // <etymology>
190 : // From "GJonesSpline matrix", "cal main table" and "buffer"
191 : // </etymology>
192 : //
193 : // <synopsis>
194 : // The GJonesSplineMBuf class holds a buffer, optionally connected to a
195 : // GJonesSpline calibration main table iterator (of base type CalIterBase).
196 : // The GJonesSpline matrix contains electronic gain terms expressed as
197 : // as spline polynomials over time.
198 : // </synopsis>
199 : //
200 : // <example>
201 : // <srcblock>
202 : // </srcblock>
203 : // </example>
204 : //
205 : // <motivation>
206 : // Encapsulate GJonesSpline calibration main table data buffers.
207 : // </motivation>
208 : //
209 : // <todo asof="01/08/01">
210 : // (i) Deal with non-standard columns.
211 : // </todo>
212 :
213 : class GJonesSplineMBuf : public GJonesPolyMBuf
214 : {
215 : public:
216 : // Default constructor. No connection to an underlying
217 : // calibration table iterator in this case.
218 : GJonesSplineMBuf();
219 :
220 : // Construct from a set of calibration buffer indices and
221 : // their specified values. Non-index columns will be set
222 : // to default values, and there is no connection to an
223 : // underlying calibration table iterator in this case.
224 : GJonesSplineMBuf (const casacore::Vector<casacore::Int>& calIndices,
225 : const casacore::Block<casacore::Vector<casacore::Int> >& indexValues);
226 :
227 : // Construct from a calibration table iterator. The calibration
228 : // buffer will remain synchronized with the iterator.
229 : GJonesSplineMBuf (CalIterBase& calIter);
230 :
231 : // Invalidate the current calibration buffer. This signals
232 : // that a re-read is required as the iterator has advanced
233 : virtual void invalidate();
234 :
235 : // Write the current buffer at the end of a specified cal table
236 : virtual casacore::Int append (CalTable& calTable);
237 :
238 : // Maximum number of rows in the calibration buffer
239 : virtual casacore::Int nRow();
240 :
241 : // Update the parametrized solution in each of a set of buffer rows
242 : virtual casacore::Bool fillMatchingRows (const casacore::Vector<casacore::Int>& matchingRows,
243 : const casacore::String& sFreqGrpName,
244 : const casacore::String& sPolyType,
245 : const casacore::String& sPolyMode,
246 : const casacore::Complex& sScaleFactor,
247 : const casacore::Int& sNPolyAmp, const casacore::Int& sNPolyPhase,
248 : const casacore::Vector<casacore::Double>& sPolyCoeffAmp,
249 : const casacore::Vector<casacore::Double>& sPolyCoeffPhase,
250 : const casacore::String& sPhaseUnits,
251 : const casacore::Int& sNKnotsAmp,
252 : const casacore::Int& sNKnotsPhase,
253 : const casacore::Vector<casacore::Double>& sSplineKnotsAmp,
254 : const casacore::Vector<casacore::Double>& sSplineKnotsPhase,
255 : const casacore::MFrequency& sRefFreq,
256 : const casacore::Int& sRefAnt);
257 :
258 : // casacore::Data field accessors
259 : virtual casacore::Vector<casacore::Int>& nKnotsAmp();
260 : virtual casacore::Vector<casacore::Int>& nKnotsPhase();
261 : virtual casacore::Array<casacore::Double>& splineKnotsAmp();
262 : virtual casacore::Array<casacore::Double>& splineKnotsPhase();
263 :
264 : protected:
265 : // Factory method to create a columns accessor object of the
266 : // appropriate type
267 0 : virtual GJonesSplineMCol* newCalMainCol (CalTable& calTable) {
268 0 : return new GJonesSplineMCol(dynamic_cast<GJonesSplineTable&>(calTable));};
269 :
270 : // Access to the columns accessor object
271 0 : virtual GJonesSplineMCol* calMainCol()
272 0 : {return dynamic_cast<GJonesSplineMCol*>(CalMainBuffer::calMainCol());};
273 :
274 : // <group>
275 : // Fill the GJonesSpline cal buffer attribute columns in an empty
276 : // cal buffer, to extend the inherited method fillAttributes. The
277 : // cal indices, specified as enums from class MSCalEnums, are excluded
278 : // as non-attribute columns.
279 : //
280 : // Use a visibility buffer to define the attribute values (NYI)
281 0 : virtual void fillAttributes(const casacore::Vector<casacore::Int>& /*calIndices*/,
282 0 : const VisBuffer& /*vb*/) {};
283 : //
284 : // Set default attribute values
285 : virtual void fillAttributes(const casacore::Vector<casacore::Int>& calIndices);
286 : // </group>
287 :
288 : private:
289 : // Buffer fields
290 : casacore::Vector<casacore::Int> nKnotsAmp_p;
291 : casacore::Vector<casacore::Int> nKnotsPhase_p;
292 : casacore::Array<casacore::Double> splineKnotsAmp_p;
293 : casacore::Array<casacore::Double> splineKnotsPhase_p;
294 :
295 : // Buffer field status flags
296 : casacore::Bool nKnotsAmpOK_p;
297 : casacore::Bool nKnotsPhaseOK_p;
298 : casacore::Bool splineKnotsAmpOK_p;
299 : casacore::Bool splineKnotsPhaseOK_p;
300 : };
301 :
302 :
303 : } //# NAMESPACE CASA - END
304 :
305 : #endif
306 :
307 :
308 :
309 :
310 :
|