casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MsRows.h
Go to the documentation of this file.
1 /*
2  * MsRows.h
3  *
4  * Created on: Feb 20, 2013
5  * Author: jjacobs
6  */
7 
8 #if ! defined (MsVis_MsRows_H)
9 #define MsVis_MsRows_H
10 
11 #include <msvis/MSVis/VisBuffer2.h>
12 #include <vector>
13 
14 namespace casa {
15 
16 namespace vi{
17 
18  class VisBuffer2;
19 }
20 
21 namespace ms {
22 
23 //class MsRowAttributes {
24 //
25 //public:
26 //
27 // MsRowAttributes (casacore::Int row, VisBuffer2 * vb)
28 // : row_p (row), vb_p (vb)
29 // {}
30 //
31 // casacore::Int antenna1 () const;
32 // casacore::Int antenna2 () const;
33 // casacore::Int array () const;
34 // casacore::Int dataDescriptionId () const;
35 // casacore::Int feed1 () const;
36 // casacore::Int feed2 () const;
37 // casacore::Int field () const;
38 // casacore::Int observation () const;
39 // casacore::Int processorId () const;
40 // casacore::Int scan () const;
41 // casacore::Int state () const;
42 //
43 //private:
44 //};
45 //
46 //class MsRowCoordinates {
47 //
48 //public:
49 //
50 // MsRowCoordinates (casacore::Int row, VisBuffer2 * vb)
51 // : row_p (row), vb_p (vb)
52 // {}
53 //
54 // casacore::Double exposure () const;
55 // casacore::Int fieldId () const;
56 // casacore::Double interval () const;
57 // casacore::Double time () const {
58 // return vb_p->time() (row_p);
59 // }
60 // casacore::Double timeCentroid () const;
61 // const casacore::Vector<casacore::Double> & uvw () const;
62 //
63 //private:
64 //
65 // casacore::Int row_p;
66 // vi::VisBuffer2 * vb_p;
67 //
68 //};
69 //
70 //class MsRowData {
71 //
72 //public:
73 //
74 // MsRowData (casacore::Int row, VisBuffer2 * vb)
75 // : row_p (row), vb_p (vb)
76 // {}
77 //
78 // const casacore::Complex & corrected (casacore::Int correlation, casacore::Int channel) const;
79 // const casacore::Complex & model (casacore::Int correlation, casacore::Int channel) const;
80 // const casacore::Complex & observed (casacore::Int correlation, casacore::Int channel) const
81 // {
82 // return vb_p->visCube () (correlation, channel, row_p);
83 // }
84 // const casacore::Float sigma () const;
85 // const casacore::Float weight () const;
86 // const casacore::Float weightSpectrum (casacore::Int correlation, casacore::Int channel) const;
87 //
88 //private:
89 //
90 // casacore::Int row_p;
91 // const vi::VisBuffer2 * vb_p;
92 //
93 //};
94 //
95 //class MsRowFlagging {
96 //
97 //public:
98 //
99 // MsRowFlagging (casacore::Int row, VisBuffer2 * vb)
100 // : row_p (row), vb_p (vb)
101 // {}
102 //
103 // casacore::Bool isFlagged () const;
104 // casacore::Bool isFlagged (casacore::Int correlation, casacore::Int channel) const;
105 //
106 // void setFlag (casacore::Bool isFlagged);
107 // void setFlag (casacore::Bool isFlagged, casacore::Int correlation, casacore::Int channel);
108 //
109 //private:
110 //
111 // casacore::Int row_p;
112 // vi::VisBuffer2 * vb_p;
113 //};
114 //
115 //class MsRow {
116 //
117 //public:
118 //
119 // const MsRowAttributes & attributes () const;
120 // const MsRowCoordinates & coordinates () const;
121 // const MsRowData & data () const;
122 // const MsRowFlagging & flagging () const;
123 //
124 //protected:
125 //
126 //private:
127 //
128 // int row_p;
129 //};
130 
131 class MsRow {
132 
133 public:
134 
135  // Constructors
136 
137  // Constructor for read-only access.
138  // Attempt to write will throw exception.
139 
141 
142  // Constructor for read/write access
143 
144  MsRow (casacore::Int row, vi::VisBuffer2 * vb);
145 
146  virtual ~MsRow () {}
147 
148  virtual void changeRow (casacore::Int row) { row_p = row;}
149 
150  virtual casacore::Int antenna1 () const = 0;
151  virtual casacore::Int antenna2 () const = 0;
152  virtual casacore::Int arrayId () const = 0;
153  virtual casacore::Int correlationType () const = 0;
154  virtual casacore::Int dataDescriptionId () const = 0;
155  virtual casacore::Int feed1 () const = 0;
156  virtual casacore::Int feed2 () const = 0;
157  virtual casacore::Int fieldId () const = 0;
158  virtual casacore::Int observationId () const = 0;
159  virtual casacore::Int processorId () const = 0;
160  virtual casacore::Int scanNumber () const = 0;
161  virtual casacore::Int stateId () const = 0;
162  virtual casacore::Double exposure () const = 0;
163  virtual casacore::Double interval () const = 0;
164  virtual casacore::Int rowId () const = 0;
165  virtual casacore::Int spectralWindow () const = 0;
166  virtual casacore::Double time () const = 0;
167  virtual casacore::Double timeCentroid () const = 0;
168 
169  virtual void setAntenna1 (casacore::Int) = 0;
170  virtual void setAntenna2 (casacore::Int) = 0;
171  virtual void setArrayId (casacore::Int) = 0;
172  virtual void setCorrelationType (casacore::Int) = 0;
173  virtual void setDataDescriptionId (casacore::Int) = 0;
174  virtual void setFeed1 (casacore::Int) = 0;
175  virtual void setFeed2 (casacore::Int) = 0;
176  virtual void setFieldId (casacore::Int) = 0;
177  virtual void setObservationId (casacore::Int) = 0;
178  virtual void setProcessorId (casacore::Int) = 0;
179  virtual void setScanNumber (casacore::Int) = 0;
180  virtual void setStateId (casacore::Int) = 0;
181  virtual void setExposure (casacore::Double) = 0;
182  virtual void setInterval (casacore::Double) = 0;
183  virtual void setRowId (casacore::Int) = 0;
184  virtual void setSigma (casacore::Int correlation, casacore::Float value) = 0;
185  virtual void setSigma (const casacore::Vector<casacore::Float> & value) = 0;
186  virtual void setTime (casacore::Double) = 0;
187  virtual void setTimeCentroid (casacore::Double) = 0;
188  virtual void setWeight (casacore::Int correlation, casacore::Float value) = 0;
189  virtual void setWeight (const casacore::Vector<casacore::Float> & value) = 0;
190 
191  virtual const casacore::Vector<casacore::Double> uvw () const = 0;
192  virtual void setUvw (const casacore::Vector<casacore::Double> &) = 0;
193 
194  virtual const casacore::Complex & corrected (casacore::Int correlation, casacore::Int channel) const = 0;
195  virtual const casacore::Matrix<casacore::Complex> & corrected () const = 0;
196  virtual void setCorrected (casacore::Int correlation, casacore::Int channel, const casacore::Complex & value) = 0;
197  virtual void setCorrected (const casacore::Matrix<casacore::Complex> & value) = 0;
198 
199  virtual const casacore::Complex & model (casacore::Int correlation, casacore::Int channel) const = 0;
200  virtual const casacore::Matrix<casacore::Complex> & model () const = 0;
201  virtual void setModel(casacore::Int correlation, casacore::Int channel, const casacore::Complex & value) = 0;
202  virtual void setModel (const casacore::Matrix<casacore::Complex> & value) = 0;
203 
204  virtual const casacore::Complex & observed (casacore::Int correlation, casacore::Int channel) const = 0;
205  virtual const casacore::Matrix<casacore::Complex> & observed () const = 0;
206  virtual void setObserved (casacore::Int correlation, casacore::Int channel, const casacore::Complex & value) = 0;
207  virtual void setObserved (const casacore::Matrix<casacore::Complex> & value) = 0;
208 
209  virtual const casacore::Float & singleDishData (casacore::Int correlation, casacore::Int channel) const = 0;
210  virtual const casacore::Matrix<casacore::Float> singleDishData () const = 0;
211  virtual void setSingleDishData (casacore::Int correlation, casacore::Int channel, const casacore::Float & value) = 0;
212  virtual void setSingleDishData (const casacore::Matrix<casacore::Float> & value) = 0;
213 
214  virtual casacore::Float sigma (casacore::Int correlation) const = 0;
215  virtual const casacore::Vector<casacore::Float> & sigma () const = 0;
216  virtual casacore::Float weight (casacore::Int correlation) const = 0;
217  virtual const casacore::Vector<casacore::Float> & weight () const = 0;
218  virtual casacore::Float weightSpectrum (casacore::Int correlation, casacore::Int channel) const = 0;
219  virtual const casacore::Matrix<casacore::Float> & weightSpectrum () const = 0;
220  virtual casacore::Float sigmaSpectrum (casacore::Int correlation, casacore::Int channel) const = 0;
221  virtual const casacore::Matrix<casacore::Float> & sigmaSpectrum () const = 0;
222 
223  virtual casacore::Bool isRowFlagged () const = 0;
224  virtual const casacore::Matrix<casacore::Bool> & flags () const = 0;
225  virtual void setFlags (const casacore::Matrix<casacore::Bool> &) = 0;
226  virtual casacore::Bool isFlagged (casacore::Int correlation, casacore::Int channel) const = 0;
227 
228  virtual void setRowFlag (casacore::Bool isFlagged) = 0;
229  virtual void setFlags (casacore::Bool isFlagged, casacore::Int correlation, casacore::Int channel) = 0;
230 
231 protected:
232 
233  casacore::Bool isWritable () const;
234  casacore::uInt row () const;
235  vi::VisBuffer2 * vb () const;
236 
237 private:
238 
239  MsRow (const MsRow & other); // no copying
240 
243  vi::VisBuffer2 * vb_p; // [use]
244 };
245 
246 class MsRows {
247 
248 public:
249 
250  typedef std::vector<MsRow *> Rows;
252  typedef Rows::iterator iterator;
253 
254  MsRows (vi::VisBuffer2 * vb);
255 
257  const MsRow & operator() (casacore::Int i) const;
258 
259  const_iterator begin () const;
260  iterator begin ();
261  const_iterator end () const;
262  iterator end ();
264  const MsRow & row (casacore::Int row) const;
265  size_t size () const;
266 
267 protected:
268 
269 private:
270 
273 };
274 
275 // MsRows rows;
276 // casacore::Double t = rows(i).time();
277 // casacore::Double t = vb.time()(i)
278 
279 } // end namespace ms
280 
281 } // end namespace casa
282 
283 #endif // ! defined (MsVis_MsRows_H)
size_t size() const
virtual void setSigma(casacore::Int correlation, casacore::Float value)=0
virtual void setWeight(casacore::Int correlation, casacore::Float value)=0
int Int
Definition: aipstype.h:50
Elements::const_iterator const_iterator
virtual void setAntenna2(casacore::Int)=0
virtual casacore::Double exposure() const =0
MsRows(vi::VisBuffer2 *vb)
Rows::iterator iterator
Definition: MsRows.h:252
casacore::uInt row() const
const casacore::Bool isWritable_p
Definition: MsRows.h:241
virtual casacore::Int scanNumber() const =0
MsRow & operator()(casacore::Int i)
class MsRowAttributes {
Definition: MsRows.h:131
virtual casacore::Int processorId() const =0
virtual casacore::Int correlationType() const =0
virtual void setRowId(casacore::Int)=0
virtual void setObserved(casacore::Int correlation, casacore::Int channel, const casacore::Complex &value)=0
virtual const casacore::Vector< casacore::Float > & sigma() const =0
virtual void setFeed2(casacore::Int)=0
virtual void setCorrelationType(casacore::Int)=0
virtual void setProcessorId(casacore::Int)=0
virtual casacore::Double interval() const =0
vi::VisBuffer2 * visBuffer_p
Definition: MsRows.h:272
virtual void setExposure(casacore::Double)=0
virtual const casacore::Vector< casacore::Float > & weight() const =0
virtual casacore::Int antenna2() const =0
MsRow(casacore::Int row, const vi::VisBuffer2 *vb)
Constructors.
virtual void setFieldId(casacore::Int)=0
virtual casacore::Double timeCentroid() const =0
virtual casacore::Int observationId() const =0
vi::VisBuffer2 * vb_p
Definition: MsRows.h:243
std::vector< MsRow * > Rows
Definition: MsRows.h:250
virtual void setModel(casacore::Int correlation, casacore::Int channel, const casacore::Complex &value)=0
virtual casacore::Int fieldId() const =0
casacore::Bool isWritable() const
virtual void setUvw(const casacore::Vector< casacore::Double > &)=0
virtual void setFlags(const casacore::Matrix< casacore::Bool > &)=0
virtual casacore::Int feed1() const =0
double Double
Definition: aipstype.h:55
virtual casacore::Double time() const =0
virtual casacore::Int antenna1() const =0
virtual void setArrayId(casacore::Int)=0
virtual void setScanNumber(casacore::Int)=0
virtual casacore::Bool isFlagged(casacore::Int correlation, casacore::Int channel) const =0
virtual void setTimeCentroid(casacore::Double)=0
virtual casacore::Int dataDescriptionId() const =0
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void setRowFlag(casacore::Bool isFlagged)=0
const_iterator begin() const
virtual casacore::Bool isRowFlagged() const =0
virtual void setInterval(casacore::Double)=0
float Float
Definition: aipstype.h:54
virtual void setSingleDishData(casacore::Int correlation, casacore::Int channel, const casacore::Float &value)=0
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
virtual void setStateId(casacore::Int)=0
const_iterator end() const
virtual void setFeed1(casacore::Int)=0
virtual void setAntenna1(casacore::Int)=0
virtual ~MsRow()
Definition: MsRows.h:146
virtual void setCorrected(casacore::Int correlation, casacore::Int channel, const casacore::Complex &value)=0
virtual const casacore::Matrix< casacore::Complex > & observed() const =0
virtual const casacore::Matrix< casacore::Complex > & corrected() const =0
Rows::const_iterator const_iterator
Definition: MsRows.h:251
virtual casacore::Int rowId() const =0
vi::VisBuffer2 * vb() const
virtual const casacore::Matrix< casacore::Float > singleDishData() const =0
virtual const casacore::Matrix< casacore::Float > & weightSpectrum() const =0
casacore::Int row_p
Definition: MsRows.h:242
virtual const casacore::Matrix< casacore::Bool > & flags() const =0
virtual casacore::Int spectralWindow() const =0
virtual casacore::Int feed2() const =0
MsRow & row(casacore::Int row)
virtual void setTime(casacore::Double)=0
virtual const casacore::Matrix< casacore::Complex > & model() const =0
virtual const casacore::Vector< casacore::Double > uvw() const =0
virtual casacore::Int arrayId() const =0
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
virtual casacore::Int stateId() const =0
unsigned int uInt
Definition: aipstype.h:51
virtual const casacore::Matrix< casacore::Float > & sigmaSpectrum() const =0
virtual void changeRow(casacore::Int row)
Definition: MsRows.h:148
virtual void setDataDescriptionId(casacore::Int)=0
virtual void setObservationId(casacore::Int)=0