casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CTIter.h
Go to the documentation of this file.
1 //# CTIter.h: Iterating interfaces for modern CalTables
2 //# Copyright (C) 2011
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: aips2-request@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 
28 #ifndef CALIBRATION_CALTABITER_H
29 #define CALIBRATION_CALTABITER_H
30 
31 #include <casa/aips.h>
36 
37 namespace casa { //# NAMESPACE CASA - BEGIN
38 
39 // <summary>
40 // ROCTIter: Read-only iterating interface to New Calibration tables
41 // </summary>
42 
43 // <reviewed reviewer="" date="" tests="" demos="">
44 
45 // <prerequisite>
46 // <li> <linkto class="CalTableDesc">NewCalTable</linkto> module
47 // </prerequisite>
48 //
49 // <etymology>
50 // From "calibration", "table", and "iteration".
51 // </etymology>
52 //
53 // <synopsis>
54 // The ROCTIter class provide basic iterated access to the contents
55 // of a NewCalTable. The iteration is initialized according to sort
56 // columns specified in the constructor, and access to the contents
57 // of each iteration is provided via a NewCalTable object (referencing
58 // the iterated subset of the original NewCalTable) or methods that return
59 // Vectors or Arrays of the contents of specific columns. For the latter,
60 // the Vectors/Arrays are generated only on-demand.
61 // </synopsis>
62 //
63 // <example>
64 // <srcblock>
65 // </srcblock>
66 // </example>
67 //
68 // <motivation>
69 // This class is used by calibration table clients to access calibration tables
70 // in a piecemeal fashion, e.g., for plotting, interpolation, etc.
71 // </motivation>
72 //
73 // <todo asof="11/06/10">
74 // </todo>
75 
76 class ROCTIter
77 {
78 public:
79  // Constructor/Destructor
81  virtual ~ROCTIter();
82 
83  // Iteration operators
84  inline void reset() { ti_->reset(); this->attach(); };
85  inline casacore::Bool pastEnd() { return ti_->pastEnd(); };
86  void next();
87  void next0();
88 
89  // Return the current table iteration
90  NewCalTable table() const { return NewCalTable(ti_->table()); };
91 
92  casacore::Int nrow() const { return ti_->table().nrow(); };
93 
94  // Column accessors
95  // Those methods that return scalars for data coordinates
96  // (e.g., thisTime(), thisField(), etc.) return the first element
97  // of the corresponding vector of values in the current
98  // iteration. This makes the most sense when the corresponding
99  // column is a sort column in the iteration, such that the contents
100  // of the vector is in fact a unique value. (TBD: return -1 from
101  // scalar methods when column is not unique?)
102 
103  casacore::Double thisTime() const;
106 
107  casacore::Int thisField() const;
109  void field(casacore::Vector<casacore::Int>& v) const;
110 
111  casacore::Int thisSpw() const;
113  void spw(casacore::Vector<casacore::Int>& v) const;
114 
115  casacore::Int thisScan() const;
117  void scan(casacore::Vector<casacore::Int>& v) const;
118 
119  casacore::Int thisObs() const;
121  void obs(casacore::Vector<casacore::Int>& v) const;
122 
123  casacore::Int thisAntenna1() const;
126  casacore::Int thisAntenna2() const;
129 
133 
136 
139 
142 
143 
146 
149 
151  void wt(casacore::Cube<casacore::Float>& c) const;
152 
155 
156  casacore::Int nchan() const;
158  void chan(casacore::Vector<casacore::Int>& v) const;
161 
162  protected:
163 
164  // Attach accessors
165  virtual void attach();
166 
167  private:
168 
169  // Prohibit public use of copy, assignment
170  ROCTIter (const ROCTIter& other);
171  ROCTIter& operator= (const ROCTIter& other);
172 
173  // casacore::Data:
174 
175  // Remember the sort columns...
177 
178  // If true, spw is unique per iteration, and it is
179  // safe to access channel axis info
181 
182  // The parent NewCalTable (casacore::Table) object
183  // (stays in scope for the life of the CTIter)
185 
186  // Access to subtables (e.g., for frequencies)
188 
189  // The underlying TableIterator
191 
192  // Per-iteration table
194 
195  // Per-iteration columns
197 
198 
199 };
200 
201 // Writable version (limited to certain 'columns')
202 class CTIter : public ROCTIter
203 {
204 public:
205  // Constructor/Destructor
207  virtual ~CTIter();
208 
209  // Set fieldid
210  void setfield(casacore::Int fieldid);
211 
212  // Set scan number
213  void setscan(casacore::Int scan);
214 
215  // Set obsid
216  void setobs(casacore::Int obs);
217 
218  // Set antenna2 (e.g., used for setting refant)
220 
221  // Set the flags
223 
224  // Set the parameters
227 
228 protected:
229 
230  // Attach writable column access
231  virtual void attach();
232 
233 private:
234 
235  // Prohibit public use of copy, assignment
236  CTIter (const CTIter& other);
237  CTIter& operator= (const CTIter& other);
238 
239  // Per-iteration table
241 
242  // Writable column access
244 
245 };
246 
247 
248 } //# NAMESPACE CASA - END
249 
250 #endif
casacore::Int nchan() const
casacore::Bool singleSpw_
If true, spw is unique per iteration, and it is safe to access channel axis info. ...
Definition: CTIter.h:180
casacore::Vector< casacore::Double > interval() const
casacore::Int nrow() const
Definition: CTIter.h:92
casacore::Cube< casacore::Complex > cparam() const
casacore::Vector< casacore::Int > obs() const
casacore::Vector< casacore::Int > scan() const
int Int
Definition: aipstype.h:50
casacore::Int thisField() const
void setcparam(const casacore::Cube< casacore::Complex > &c)
casacore::Vector< casacore::Double > time() const
CTMainColumns * iRWCTMainCols_
Writable column access.
Definition: CTIter.h:243
CTIter & operator=(const CTIter &other)
NewCalTable * irwnct_
Per-iteration table.
Definition: CTIter.h:240
casacore::Int thisAntenna1() const
ROCTColumns calCol_
Access to subtables (e.g., for frequencies)
Definition: CTIter.h:187
void setfparam(const casacore::Cube< casacore::Float > &f)
Set the parameters.
casacore::Cube< casacore::Float > casfparam(casacore::String what="") const
casacore::Bool pastEnd()
Definition: CTIter.h:85
void reset()
Iteration operators.
Definition: CTIter.h:84
Iterate through a Table.
Definition: TableIter.h:117
Bool pastEnd() const
Test if at the end.
Definition: TableIter.h:224
void setfield(casacore::Int fieldid)
Set fieldid.
casacore::Cube< casacore::Float > paramErr() const
casacore::Int thisAntenna2() const
casacore::Int thisScan() const
ROCTIter: Read-only iterating interface to New Calibration tables.
Definition: CTIter.h:76
casacore::Vector< casacore::Int > field() const
casacore::Cube< casacore::Float > snr() const
NewCalTable * inct_
Per-iteration table.
Definition: CTIter.h:193
void setflag(const casacore::Cube< casacore::Bool > &flag)
Set the flags.
casacore::Vector< casacore::Int > chan() const
virtual ~ROCTIter()
casacore::Int thisObs() const
casacore::Cube< casacore::Bool > flag() const
double Double
Definition: aipstype.h:55
casacore::Vector< casacore::Double > freq() const
casacore::Vector< casacore::Int > antenna1() const
void setantenna2(const casacore::Vector< casacore::Int > &a2)
Set antenna2 (e.g., used for setting refant)
casacore::Double thisInterval() const
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Writable version (limited to certain &#39;columns&#39;)
Definition: CTIter.h:202
casacore::TableIterator * ti_
The underlying TableIterator.
Definition: CTIter.h:190
void setscan(casacore::Int scan)
Set scan number.
uInt nrow() const
Get the number of rows.
Definition: Table.h:1201
ROCTIter & operator=(const ROCTIter &other)
virtual void attach()
Attach accessors.
CTIter(NewCalTable tab, const casacore::Block< casacore::String > &sortcol)
Constructor/Destructor.
Table table() const
Get the current group.
Definition: TableIter.h:227
casacore::Double thisTime() const
Column accessors Those methods that return scalars for data coordinates (e.g., thisTime(), thisField(), etc.) return the first element of the corresponding vector of values in the current iteration.
casacore::Vector< casacore::Int > antenna2() const
const Double c
Fundamental physical constants (SI units):
casacore::Cube< casacore::Float > fparam() const
NewCalTable parentNCT_
The parent NewCalTable (casacore::Table) object (stays in scope for the life of the CTIter) ...
Definition: CTIter.h:184
String: the storage and methods of handling collections of characters.
Definition: String.h:223
A class to provide easy read-only access to new CalTable columns.
Definition: CTColumns.h:92
virtual ~CTIter()
casacore::Int thisSpw() const
ROCTIter(NewCalTable tab, const casacore::Block< casacore::String > &sortcol)
Constructor/Destructor.
casacore::Vector< casacore::Int > spw() const
casacore::Cube< casacore::Float > wt() const
void setobs(casacore::Int obs)
Set obsid.
casacore::Vector< casacore::String > sortCols_
casacore::Data:
Definition: CTIter.h:176
virtual void attach()
Attach writable column access.
NewCalTable table() const
Return the current table iteration.
Definition: CTIter.h:90
void reset()
Reset the iterator (i.e.
ROCTMainColumns * iROCTMainCols_
Per-iteration columns.
Definition: CTIter.h:196