casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VisBuffer2.h
Go to the documentation of this file.
1 //# VisBuffer.h: buffer for iterating through casacore::MS in large blocks
2 //# Copyright (C) 1996,1997,1998,1999,2000,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: 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 #ifndef MSVIS_VISBUFFER2_H
28 #define MSVIS_VISBUFFER2_H
29 
30 #include <casa/aips.h>
31 
32 //#include <casa/Arrays/Cube.h>
33 //#include <casa/Arrays/Vector.h>
34 //#include <casa/Arrays/Matrix.h>
35 //#include <casa/BasicSL/Complex.h>
38 //#include <msvis/MSVis/VisibilityIterator2.h>
40 
43 
44 namespace casacore{
45 
46 template <typename T> class Array;
47 template <typename T> class CountedPtr;
48 template <typename T> class Cube;
49 class IPosition;
50 template <typename T> class Matrix;
51 class MDirection;
52 template <typename T, Int N> class SquareMatrix;
53 template <typename T> class Vector;
54 class MeasurementSet;
55 }
56 
57 namespace casa { //# NAMESPACE CASA - BEGIN
58 
59 //#forward
60 
61 class CStokesVector;
62 
63 namespace ms {
64 
65  class MsRow;
66 }
67 
68 namespace vi {
69 
70 class Subchunk;
71 class ViImplementation2;
72 class VisibilityIterator2;
73 class WeightScaling;
74 class SubtableColumns;
75 
76 // These are options to be applied to a VisBuffer, usually when it's created.
77 // The intent is that these form a bit mask so that they can be used as
78 // VbWritable | VbRekeyable, etc. So add the next one in as 2 * theLastOne.
79 
81 
82 //<summary>VisBuffer2s encapsulate one chunk of visibility data for processing.</summary>
83 //
84 // <use visibility=export>
85 //
86 // <reviewed reviewer="" date="" tests="" demos="">
87 
88 // <prerequisite>
89 // <li> <linkto class="VisibilityIterator">VisibilityIterator</linkto>
90 // <li> <linkto class="VbDirtyComponents">VbDirtyComponents</linkto>
91 // </prerequisite>
92 //
93 // <etymology>
94 // VisBuffer2 is a buffer for visibility data
95 // </etymology>
96 //
97 //<synopsis>
98 // The VisBuffer is designed to contain a small amount of visibility-related
99 // data. The VisBuffer can be used in two somewhat distinct ways. The first
100 // is as an integral (or attached) part of the VisibilityIterator and the second
101 // is as a free or unattached object.
102 //
103 // Attached VisBuffer -- Each VisibilityIterator has a exactly one VisBuffer
104 // attached to it. This VisBuffer is created and destroyed by the
105 // VisibilityIterator. The role of an attached VB is to contain the data
106 // currently "pointed to" by the VI. Because of this tight coupling between
107 // an attached VI and its VB the operations that can be applied to a VisBuffer
108 // are somewhat restricted in order to maintain the relationship between the
109 // casacore::MeasurementSet's data and the data i the VisBuffer (failure to do so allows
110 // obscure bugs to be created). As such the functions for averaging in either
111 // the time or frequency axes is not permitted on an attached VB.
112 //
113 // Free VisBuffer -- A free VisBuffer is used to contain data that might not
114 // correspond to the data in the MeasurementSet. The meaning of the data in
115 // a free VisBuffer will depend on the user. Some obvious examples might be:
116 // a VisBuffer used to resample or average frequencies together; creation of
117 // "virtual" spectral windows which might reconnect frequencies that were
118 // split into separate spectral windows becasue of hardware limitation; and
119 // performing a time average of visibility data. Because the free VB is not
120 // tightly coupled to a VI, it is the responsibility of the user to assign
121 // meaningful values to some of the fields in the VB. For example, the user
122 // averaging across time will need to decide what values ought to be reported
123 // for the VisBuffer's timestamp, pointing angle, etc.
124 //
125 // Another possible attribute of a VisBuffer is "rekeyable". This is for when
126 // the VisBuffer is being filled by client code rather than from an input MS.
127 // Because of this, the enforcement of VisBuffer invariants is relaxed. Users
128 // will be able to change row key fields (e.g., antenna1, data description id,
129 // etc.) as well as change the shape of the data. The method validateShapes is
130 // provided which will check that all modified shapes are consistent. This method
131 // is automatically called by writeChangesBack and should also be called whenever
132 // the construction process is complete and the VisBuffer is about to be released
133 // for use; it's better to catch the error rather than letting an inconsistent
134 // VisBuffer escape into consuming code.
135 //
136 //</synopsis>
137 //
138 //<todo>
139 //</todo>
140 
141 class VisBuffer2 {
142 
143  friend class ViImplementation2;
145  friend class FinalTvi2;
146  friend class TransformingVi2;
147  friend class SimpleSimVi2;
148 
149 public:
150 
151  // make noncopyable...
152  VisBuffer2( const VisBuffer2& ) = delete;
153  VisBuffer2& operator=( const VisBuffer2& ) = delete;
154 
155  enum {FrameNotSpecified = -2};
156 
157  VisBuffer2 () : associatedVi_p (nullptr) {}
158 
159  static VisBuffer2 * factory (VisBufferOptions vbOptions = VbNoOptions);
160 
161  // Used by framework
162 
163  // Destructor (detaches from VisIter)
164 
165  virtual ~VisBuffer2() {}
166 
167  virtual ms::MsRow * getRow (casacore::Int row) const;
168  virtual ms::MsRow * getRowMutable (casacore::Int row);
169 
170  //---------------------------------------------------------------------
171  //
172  // Copying methods
173  //
174  // These methods allow copying portions of the data between two
175  // VisBuffers. Because of the complicated semantics of a VisBuffer the
176  // assignment and copy-construction methods are not used as they are likely
177  // to confuse VisBuffer users.
178 
179 
180  // Copies all of the components from the specified VisBuffer into this one.
181  // Uncached values will be cleared in this VB.
182 
183  virtual void copy (const VisBuffer2 & other, casacore::Bool fetchIfNeeded) = 0;
184 
185  // Copies the specified components (or just the ones in the cache if
186  // fetchIfNeeded is false) from the specified VisBuffer into this one.
187  // If this VB is not empty it will must have the same shape as the other
188  // VB unless allowShapeChange is true; in that case this VB will change
189  // changes to match the other VB flushing the cached data.
190 
191  virtual void copyComponents (const VisBuffer2 & other,
192  const VisBufferComponents2 & components,
193  casacore::Bool allowShapeChange = false,
194  casacore::Bool fetchIfNeeded = true) = 0;
195 
196  // Copies the coordinate components (or just the ones in the cache if
197  // fetchIfNeeded is false) from the specified VisBuffer into this one.
198  // If this VB is not empty it will must have the same shape as the other
199  // VB unless allowShapeChange is true; in that case this VB will change
200  // changes to match the other VB flushing the cached data.
201  // The basic coordinate components are:
202  // Antenna1, Antenna2, ArrayId, DataDescriptionIds, FieldId, SpectralWindows,
203  // casacore::Time, NRows, Feed1, Feed2
204  // The directional coordinates (copied if includeDirections is true):
205  // Direction1, Direction2, FeedPa1, FeedPa2
206 
207  virtual void copyCoordinateInfo(const VisBuffer2 * other,
208  casacore::Bool includeDirections,
209  casacore::Bool allowShapeChange = false,
210  casacore::Bool fetchIfNeeded = true) = 0;
211 
213  virtual void validateShapes () const = 0;
214 
215  // For attached VBs this returns the VI the VB is attached to. For free VBs
216  // this method returns false. N.B.: Use of this method is deprecated.
217 
218  virtual const VisibilityIterator2 * getVi () const;
219 
220  virtual const casacore::MeasurementSet& ms() const { ThrowCc ("Should be overridden"); } // Kluge
221  virtual const vi::SubtableColumns & subtableColumns () const { ThrowCc ("Should be overridden"); } // Kluge
222  virtual casacore::Bool existsColumn (VisBufferComponent2 id) const = 0;
223 
224  virtual casacore::Bool isAttached () const = 0;
225  virtual casacore::Bool isFillable () const = 0;
226 
227  //---------------------------------------------------------------------
228  //
229  // Dirty component methods
230  //
231  // The dirtyComponent methods support the data-flow approach to using
232  // VisBuffers (the Visibility Processing Framework). In this approach
233  // a VisBuffer is passed to successive processing nodes (e.g., applycal,
234  // flagging, etc.) which operate on it and pass it on to the next node
235  // in the algorithm. The dirtyComponents mechanism allows a processing
236  // node to mark portions of the VisBuffer as modified. If the VisBuffer
237  // reaches an write-to-disk node then the modified portions of the
238  // VisBuffer will be written out. The user can also explicitly direct
239  // that the changes be written out using the writeChangesBack method.
240  //
241  // Using a setter on a VisBuffer component will also set the dirty flag for
242  // that component. Normally the user should not need to use these methods;
243  // however, they are available in case unexpected situations should arise
244  // in the future.
245 
246  virtual void writeChangesBack () = 0;
247  virtual void initWeightSpectrum (const casacore::Cube<casacore::Float>& wtspec) = 0;
248  virtual void initSigmaSpectrum (const casacore::Cube<casacore::Float>& sigspec) = 0;
249 
250  virtual void dirtyComponentsAdd (const VisBufferComponents2 & additionalDirtyComponents) = 0;
251  virtual void dirtyComponentsAdd (VisBufferComponent2 component) = 0;
252  virtual void dirtyComponentsClear () = 0;
253  virtual VisBufferComponents2 dirtyComponentsGet () const = 0;
254  virtual void dirtyComponentsSet (const VisBufferComponents2 & dirtyComponents) = 0;
255  virtual void dirtyComponentsSet (VisBufferComponent2 component) = 0;
256 
257  // This method returns the imagin g
258  // If an imaging weight generator has not been supplied to the associated
259  // VisibilityIterator then this method will throw an exception.
260 
261  virtual const casacore::Matrix<casacore::Float> & imagingWeight() const = 0;
262  virtual void setImagingWeight (const casacore::Matrix<casacore::Float> & newImagingWeights) = 0;
263 
264  //---------------------------------------------------------------------------
265  //
266  // Frequency reporting methods.
267  //
268  // These methods provide information about the frequencies returned in the
269  // visibility cubes. The information can returned as the channel numbers
270  // (numbered as in the underlying casacore::MS data) or in a frame-based frequency.
271  // This information reported need not be in the same frame of reference
272  // used to select the data. If the frame of reference is specified in the
273  // call, then that is the frame that is used to calculate the frequencies.
274  // If it is not specified, then the VisibilityIterator will be queried for
275  // virtual the reportingFrame = 0; if the user has specified a reporting frame to the
276  // virtual VI then that frame will be used = 0; otherwise the frame used to select
277  // the frequencies will be used. If the user provides no frequency selection
278  // to the VI then the selection frame will TOPO.
279  //
280  // Both the channelNumber and frequency reporting methods come in two versions:
281  // one returns a single frequency for the specified frequency index and row
282  // while the other provides all of the frequencies for the specified row.
283  // The frequency index is the zero-based index along the frequency axis of
284  // a visibility cube.
285 
289  virtual casacore::Double getFrequency (casacore::Int rowInBuffer, casacore::Int frequencyIndex,
290  casacore::Int frame = FrameNotSpecified) const = 0;
292  casacore::Int frame = FrameNotSpecified) const = 0;
293  virtual casacore::Int getChannelNumber (casacore::Int rowInBuffer, casacore::Int frequencyIndex) const = 0;
294  virtual const casacore::Vector<casacore::Int> & getChannelNumbers (casacore::Int rowInBuffer) const = 0;
295  virtual casacore::Vector<casacore::Int> getChannelNumbersSelected (casacore::Int outputChannelIndex) const = 0;
296 
297  // casacore::Sort/unsort the correlations, if necessary
298  // (Rudimentary handling of non-canonically sorted correlations--use with care!)
299  //
300  // The sorting functionality is a horrible kluge that puts the VisBuffer into a
301  // somewhat incoherent state (e.g., after sorting the correlation types array
302  // does not correspond to the data) and appears to serve the needs
303  // of a tiny piece of code. As such, this refactor is initially not going to
304  // support this functionality since it is probably better implemented in the one
305  // place that actually needs it. (jjacobs 10/3/12)
306  //
307  //virtual void sortCorr () = 0;
308  //virtual void unSortCorr() = 0;
309 
310  // Normalize the visCube by the modelVisCube.
311 
312  virtual void normalize() = 0;
313 
314  // Rotate visibility phase for given vector (dim = nrow of vb) of phases (metres)
316  // Rotate visibility phase for phase center offsets (arcsecs)
317  virtual void phaseCenterShift(casacore::Double dx, casacore::Double dy) = 0;
318 
319  // Set the weight cube using the sigma cube. Each weight will be
320  // the reciprocal of the square of the corresponding element in the model
321  // VisCube multiplied by the number of channels in the spectral window.
322  // If an element in sigma is zero then the corresponding weight element
323  // will also be set to zero.
324 
325  virtual void resetWeightsUsingSigma () = 0;//void resetWeightMat() = 0;
326 
327  //----------------------------------------------------------------------
328  //
329  // Subhchunk information methods
330  //
331  // These methods provide information related to the current subchunk.
332  // The isNewXXX methods return true if the XXX property of the subchunk
333  // differs from the previous subchunk.
334  //
335  // The methods msId and msName provide information about the MS
336  // related to the current subchunk. The msID is the zero-based index
337  // of the casacore::MS in the sequence of MSs being iterated over.
338  //
339  // The isWritable method is true when the attached iterator is writable
340  // and false otherwise.
341  //
342  // The isRekeyable method is true when the VisBuffer is writable and also
343  // allows the modification of non-data fields (e.g., antenna1, fieldId, etc.)
344  // A rekeyable VB is one that could be used to create data for a brand new
345  // MS.
346 
347  virtual casacore::Bool isNewArrayId () const = 0;
348  virtual casacore::Bool isNewFieldId () const = 0;
349  virtual casacore::Bool isNewMs() const = 0;
350  virtual casacore::Bool isNewSpectralWindow () const = 0;
351  virtual casacore::Bool isWritable () const = 0;
352  virtual casacore::Int msId() const /*__attribute__((deprecated))*/ = 0;
353  virtual casacore::String msName (casacore::Bool stripPath = false) const /*__attribute__((deprecated))*/ = 0;
354  virtual Subchunk getSubchunk () const = 0;
355 
357  //
358  // casacore::Data accessors and setters (where appropriate)
359  //
360  // There are the methods that allows access to the items cached in the
361  // VisBuffer. The straight accessors provide read-only access to the
362  // item. Where the item is allowed to be modified, one or more set
363  // methods are provided.
364  //
365  // The dimensionality of the major object in in accessor/setter is
366  // shown in a trailing comment using the following abbreviations:
367  //
368  // nA :== number of antennas
369  // nF :== number of frequencies (or channels)
370  // nC :== number of correlations
371  // nR :== number of table rows contained in the buffer
372 
373  //--------------------------------------------------------
374  //
375  // Accessors for data contained in the main casacore::MeasurementSet main table
376  // The actual visibility data are at the end.
377  //
378  // *** N.B.: the VB usually caches the information
379  // in the representation requested so that using a setter to modify
380  // one value type (e.g., weight or visibility) will not modify the
381  // cached value in a different representation (e.g., weightMat or
382  // visCube). This should not be a problem in normal usage.
383 
384  virtual const casacore::Vector<casacore::Int> & antenna1 () const = 0; // [nR]
385  virtual void setAntenna1 (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
386  virtual const casacore::Vector<casacore::Int> & antenna2 () const = 0; // [nR]
387  virtual void setAntenna2 (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
388  virtual const casacore::Vector<casacore::Int> & arrayId () const = 0;
389  virtual void setArrayId (const casacore::Vector<casacore::Int> & ) = 0;
390  //virtual casacore::Int dataDescriptionId () const = 0;
391  //virtual void setDataDescriptionId (casacore::Int value) = 0;
392  virtual const casacore::Vector<casacore::Int> & dataDescriptionIds () const = 0; // [nR]
393  virtual void setDataDescriptionIds (const casacore::Vector<casacore::Int> & ) = 0; // [nR]
394  virtual const casacore::Vector<casacore::MDirection> & direction1 () const = 0; // [nR]
395  virtual const casacore::Vector<casacore::MDirection> & direction2 () const = 0; // [nR]
396  virtual const casacore::Vector<casacore::Double> & exposure () const = 0; // [nR]
397  virtual void setExposure (const casacore::Vector<casacore::Double> & value) = 0; // [nR]
398  virtual const casacore::Vector<casacore::Int> & feed1 () const = 0; // [nR]
399  virtual void setFeed1 (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
400  virtual const casacore::Vector<casacore::Int> & feed2 () const = 0; // [nR]
401  virtual void setFeed2 (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
402  virtual const casacore::Vector<casacore::Int> & fieldId () const = 0;
403  virtual void setFieldId (const casacore::Vector<casacore::Int> &) = 0;
404  //virtual const casacore::Matrix<casacore::Bool> & flag () const = 0; // [nF,nR]
405  //virtual void setFlag (const casacore::Matrix<casacore::Bool>& value) = 0; // [nF,nR]
406  virtual const casacore::Array<casacore::Bool> & flagCategory () const = 0; // [nC,nF,nCategories,nR]
407  virtual void setFlagCategory (const casacore::Array<casacore::Bool>& value) = 0; // [nC,nF,nCategories,nR]
408  virtual const casacore::Cube<casacore::Bool> & flagCube () const = 0; // [nC,nF,nR]
409  virtual void setFlagCube (const casacore::Cube<casacore::Bool>& value) = 0; // [nC,nF,nR]
410  virtual const casacore::Vector<casacore::Bool> & flagRow () const = 0; // [nR]
411  virtual void setFlagRow (const casacore::Vector<casacore::Bool>& value) = 0; // [nR]
412  virtual const casacore::Vector<casacore::Int> & observationId () const = 0; // [nR]
413  virtual void setObservationId (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
414  virtual const casacore::Vector<casacore::Int> & processorId () const = 0; // [nR]
415  virtual void setProcessorId (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
416  virtual const casacore::Vector<casacore::Int> & scan () const = 0; // [nR]
417  virtual void setScan (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
418  virtual const casacore::Matrix<casacore::Float> & sigma () const = 0; // [nC, nR]
419  virtual void setSigma (const casacore::Matrix <casacore::Float> & value) = 0; // [nC, nR]
420  //virtual const casacore::Matrix<casacore::Float> & sigmaMat () const = 0; // [nC,nR]
421  virtual const casacore::Vector<casacore::Int> & stateId () const = 0; // [nR]
422  virtual void setStateId (const casacore::Vector<casacore::Int> & value) = 0; // [nR]
423  virtual const casacore::Vector<casacore::Double> & time () const = 0; // [nR]
424  virtual void setTime (const casacore::Vector<casacore::Double> & value) = 0; // [nR]
425  virtual const casacore::Vector<casacore::Double> & timeCentroid () const = 0; // [nR]
426  virtual void setTimeCentroid (const casacore::Vector<casacore::Double> & value) = 0; // [nR]
427  virtual const casacore::Vector<casacore::Double> & timeInterval () const = 0; // [nR]
428  virtual void setTimeInterval (const casacore::Vector<casacore::Double> & value) = 0; // [nR]
429  virtual const casacore::Matrix<casacore::Double> & uvw () const = 0; // [3,nR]
430  virtual void setUvw (const casacore::Matrix<casacore::Double> & value) = 0; // [3,nR]
431  virtual const casacore::Matrix<casacore::Float> & weight () const = 0; // [nC, nR]
432  virtual void setWeight (const casacore::Matrix <casacore::Float>& value) = 0; // [nC, nR]
433  //virtual const casacore::Matrix<casacore::Float> & weightMat () const = 0; // [nC,nR]
434  //virtual void setWeightMat (const casacore::Matrix<casacore::Float>& value) = 0; // [nC,nR]
435 
436  virtual const casacore::Cube<casacore::Float> & weightSpectrum () const = 0; // [nC,nF,nR]
437  virtual void setWeightSpectrum (const casacore::Cube<casacore::Float>& value) = 0; // [nC,nF,nR]
438 
439  virtual const casacore::Cube<casacore::Float> & sigmaSpectrum () const = 0; // [nC,nF,nR]
440  virtual void setSigmaSpectrum (const casacore::Cube<casacore::Float>& value) = 0; // [nC,nF,nR]
441 
442  // --------------------------------------------------------------
443  // Visibility data accessors in order of observed, corrected,
444  // float, & model
445 
446  virtual const casacore::Cube<casacore::Complex> & visCube () const = 0; // [nC,nF,nR]
447  virtual void setVisCube(const casacore::Complex & c) = 0;
448  virtual void setVisCube (const casacore::Cube<casacore::Complex> &) = 0; // [nC,nF,nR]
449 // virtual const casacore::Matrix<CStokesVector> & vis () const = 0; // [nF,nR]
450 // virtual void setVis (casacore::Matrix<CStokesVector> &) = 0; // [nF,nR]
451 
452  virtual const casacore::Cube<casacore::Complex> & visCubeCorrected () const = 0; // [nC,nF,nR]
453  virtual void setVisCubeCorrected (const casacore::Cube<casacore::Complex> &) = 0; // [nC,nF,nR]
454 // virtual const casacore::Matrix<CStokesVector> & visCorrected () const = 0; // [nF,nR]
455 // virtual void setVisCorrected (const casacore::Matrix<CStokesVector> &) = 0; // [nF,nR]
456 
457  virtual const casacore::Cube<casacore::Float> & visCubeFloat () const = 0; // [nC,nF,nR]
458  virtual void setVisCubeFloat (const casacore::Cube<casacore::Float> &) = 0; // [nC,nF,nR]
459 
460  virtual const casacore::Cube<casacore::Complex> & visCubeModel () const = 0; // [nC,nF,nR]
461  virtual void setVisCubeModel(const casacore::Complex & c) = 0;
462  virtual void setVisCubeModel(const casacore::Cube<casacore::Complex>& vis) = 0; // [nC,nF,nR]
463  virtual void setVisCubeModel(const casacore::Vector<casacore::Float>& stokes) = 0; // [1..4]
464 // virtual const casacore::Matrix<CStokesVector> & visModel () const = 0; // [nF,nR]
465 // virtual void setVisModel (casacore::Matrix<CStokesVector> &) = 0; // [nF,nR]
466 
467  virtual casacore::Float getWeightScaled (casacore::Int row) const = 0;
468  virtual casacore::Float getWeightScaled (casacore::Int correlation, casacore::Int row) const = 0;
469  virtual casacore::Float getWeightScaled (casacore::Int correlation, casacore::Int channel, casacore::Int row) const = 0;
470  virtual casacore::Float getSigmaScaled (casacore::Int row) const = 0;
471  virtual casacore::Float getSigmaScaled (casacore::Int correlation, casacore::Int row) const = 0;
472  virtual casacore::Float getSigmaScaled (casacore::Int correlation, casacore::Int channel, casacore::Int row) const = 0;
473 
474  //--------------------------------------------------------
475  //
476  // Accessors for data derived from the casacore::MS main table data
477 
478  // Returns the pointing angle for the array as a whole at the
479  // specified time.
480 
481  virtual casacore::MDirection azel0 (casacore::Double time) const = 0;
482 
483  // Returns the pointing angle for each antenna in the array
484  // at the specified time.
485 
486  virtual const casacore::Vector<casacore::MDirection> & azel(casacore::Double time) const = 0; // [nA]
487 
488  // Returns the Jones C matrix for each antenna.
489 
490  virtual const casacore::Vector<casacore::SquareMatrix<casacore::Complex, 2> > & cjones () const = 0; // [nA]
491 
492  // Returns the correlation type of each correlation in the
493  // VisCube.
494 
495  virtual const casacore::Vector<casacore::Int> & correlationTypes () const = 0; // [nC]
496 
497  // Calculates the parallactic angle for the first receptor of
498  // each antenna at the specified time.
499 
500  virtual const casacore::Vector<casacore::Float> & feedPa(casacore::Double time) const = 0; // [nR]
501 
502  // Calculates the parallactic angle for feed 0 of the
503  // row's Antenna1.
504 
505  virtual const casacore::Vector<casacore::Float> & feedPa1 () const = 0; // [nR]
506 
507  // Calculates the parallactic angle for feed 0 of the
508  // row's Antenna2.
509 
510  virtual const casacore::Vector<casacore::Float> & feedPa2 () const = 0; // [nR]
511 
512  virtual casacore::IPosition getShape () const = 0;
513 
514  // Returns the hour angle of the array at the specified time.
515 
516  virtual casacore::Double hourang(casacore::Double time) const = 0;
517 
518  virtual casacore::Int nAntennas () const = 0;
519 
520  virtual casacore::Int nChannels () const = 0;
521 
522  // Returns the number of correlations along the visCube
523  // correlation axis. This comes from the "channel" selection and thus can
524  // be anything positive integer (e.g., user could select the same
525  // correlation more than once).
526 
527  virtual casacore::Int nCorrelations () const = 0;
528 
529  // Returns the number of rows in this VisBuffer
530 
531  virtual casacore::Int nRows () const = 0;
532 
533  // Calculates the parallactic angle of the array as a whole
534  // at the specified time.
535 
536  virtual casacore::Float parang0(casacore::Double time) const = 0;
537 
538  // Calculates the parallactic angle of each antenna in the
539  // array at the specified time.
540 
541  virtual const casacore::Vector<casacore::Float> & parang(casacore::Double time) const = 0; // [nA]
542 
543  // Returns the phase center of the array for the specified
544  // row.
545 
546  virtual const casacore::MDirection& phaseCenter () const = 0;
547 
548  // Returns the polarization frame for the specified row.
549 
550  virtual casacore::Int polarizationFrame () const = 0;
551 
552  virtual casacore::Int polarizationId () const = 0;
553 
554  // The returned casacore::Vector serves as a map between the rows in
555  // the VisBuffer and the row IDs in the underlying casacore::MS main
556  // virtual table: mainTableID [i] = rowIds () [ i] = 0;
557 
558  virtual const casacore::Vector<casacore::uInt> & rowIds () const = 0; // [nR]
559 
560  // Returns the spectral window ID for the specified row.
561 
562  //virtual casacore::Int spectralWindow () const = 0;
563 
564  virtual const casacore::Vector<casacore::Int> & spectralWindows () const = 0; // [nR]
565  virtual void setSpectralWindows (const casacore::Vector<casacore::Int> & spectralWindows) = 0;
566 
567  virtual casacore::CountedPtr<WeightScaling> getWeightScaling () const = 0;
568 
569 protected:
570 
571  virtual void associateWithVi2 (const VisibilityIterator2 *);
574  casacore::Bool isNewSpectralWindow, const Subchunk & subchunk,
576  const casacore::Vector<casacore::Int> & correlations,
577  const casacore::Vector<casacore::Stokes::StokesTypes> & correlationsDefined,
578  const casacore::Vector<casacore::Stokes::StokesTypes> & correlationsSelected,
579  casacore::CountedPtr<WeightScaling> weightScaling) = 0;
580  virtual void invalidate() = 0;
581  virtual casacore::Bool isRekeyable () const = 0;
582  virtual void setFillable (casacore::Bool isFillable) = 0;
583  virtual void setRekeyable (casacore::Bool isRekeable) = 0;
584  virtual bool setWritability (bool /*newWritability*/) { ThrowCc ("Should be overridden"); } // Kluge
585 
586  virtual casacore::Vector<casacore::Bool> & flagRowRef () = 0; // [nR]
587  virtual casacore::Cube<casacore::Bool> & flagCubeRef () = 0; // [nC,nF,nR]
588  virtual casacore::Cube<casacore::Complex> & visCubeRef () = 0; // [nC,nF,nR]
589  virtual casacore::Cube<casacore::Complex> & visCubeCorrectedRef () = 0; // [nC,nF,nR]
590  virtual casacore::Cube<casacore::Complex> & visCubeModelRef () = 0; // [nC,nF,nR]
591  virtual casacore::Cube<casacore::Float> & weightSpectrumRef () = 0; // [nC,nF,nR]
592 
593 private:
594 
596 
597 };
598 
600 
601 public:
602 
605 };
606 
607 
608 } // end namespace vi
609 
610 
611 } //# NAMESPACE CASA - END
612 
613 
614 #endif
615 
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
virtual const casacore::Vector< casacore::Float > & parang(casacore::Double time) const =0
Calculates the parallactic angle of each antenna in the array at the specified time.
A Measure: astronomical direction.
Definition: MDirection.h:174
virtual casacore::Int polarizationId() const =0
virtual void setAntenna1(const casacore::Vector< casacore::Int > &value)=0
A 1-D Specialization of the Array class.
virtual void setStateId(const casacore::Vector< casacore::Int > &value)=0
VisBuffer2 & operator=(const VisBuffer2 &)=delete
int Int
Definition: aipstype.h:50
virtual casacore::Cube< casacore::Float > & weightSpectrumRef()=0
std::vector< double > Vector
Definition: ds9context.h:24
virtual void resetWeightsUsingSigma()=0
Set the weight cube using the sigma cube.
virtual const casacore::Vector< casacore::Int > & getChannelNumbers(casacore::Int rowInBuffer) const =0
virtual void initWeightSpectrum(const casacore::Cube< casacore::Float > &wtspec)=0
virtual const casacore::Vector< casacore::Int > & antenna2() const =0
virtual casacore::CountedPtr< WeightScaling > getWeightScaling() const =0
virtual void setVisCubeFloat(const casacore::Cube< casacore::Float > &)=0
virtual casacore::Bool isNewMs() const =0
virtual casacore::Cube< casacore::Complex > & visCubeModelRef()=0
virtual void initSigmaSpectrum(const casacore::Cube< casacore::Float > &sigspec)=0
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
virtual casacore::Cube< casacore::Complex > & visCubeRef()=0
virtual const casacore::Matrix< casacore::Float > & sigma() const =0
virtual const casacore::Vector< casacore::Double > & getFrequencies(casacore::Int rowInBuffer, casacore::Int frame=FrameNotSpecified) const =0
virtual ms::MsRow * getRow(casacore::Int row) const
virtual const casacore::Vector< casacore::MDirection > & direction2() const =0
FinalTvi2 - Class that serves as the final Tvi2 in a pipeline; it adds simple write functionality tha...
Definition: FinalTvi2.h:100
Stokes parameter definitions for interface to table data.
Definition: Stokes.h:51
virtual void setDataDescriptionIds(const casacore::Vector< casacore::Int > &)=0
virtual void setVisCubeModel(const casacore::Complex &c)=0
class MsRowAttributes {
Definition: MsRows.h:131
virtual casacore::Double getFrequency(casacore::Int rowInBuffer, casacore::Int frequencyIndex, casacore::Int frame=FrameNotSpecified) const =0
virtual void setProcessorId(const casacore::Vector< casacore::Int > &value)=0
virtual void dirtyComponentsClear()=0
TableExprNode phase(const TableExprNode &node)
The phase (i.e.
Definition: ExprNode.h:1405
virtual const casacore::Vector< casacore::Int > & arrayId() const =0
virtual void setFlagCategory(const casacore::Array< casacore::Bool > &value)=0
virtual const casacore::Cube< casacore::Complex > & visCubeCorrected() const =0
virtual const casacore::Matrix&lt;CStokesVector&gt; &amp; vis () const = 0; // [nF,nR] virtual void setVis (cas...
virtual casacore::Bool isNewFieldId() const =0
virtual void associateWithVi2(const VisibilityIterator2 *)
virtual const casacore::MDirection & phaseCenter() const =0
Returns the phase center of the array for the specified row.
virtual const VisibilityIterator2 * getVi() const
For attached VBs this returns the VI the VB is attached to.
virtual casacore::Int nAntennas() const =0
virtual const casacore::Vector< casacore::Float > & feedPa1() const =0
Calculates the parallactic angle for feed 0 of the row&#39;s Antenna1.
virtual void setSigmaSpectrum(const casacore::Cube< casacore::Float > &value)=0
VisBufferOptions
These are options to be applied to a VisBuffer, usually when it&#39;s created.
Definition: VisBuffer2.h:80
virtual casacore::Cube< casacore::Complex > & visCubeCorrectedRef()=0
virtual const casacore::Cube< casacore::Float > & sigmaSpectrum() const =0
virtual void setFeed2(const casacore::Vector< casacore::Int > &value)=0
static VisBuffer2 * factory(VisBufferOptions vbOptions=VbNoOptions)
virtual void dirtyComponentsSet(const VisBufferComponents2 &dirtyComponents)=0
virtual const casacore::Vector< casacore::Double > & timeInterval() const =0
virtual const casacore::Cube< casacore::Complex > & visCubeModel() const =0
virtual bool setWritability(bool)
Definition: VisBuffer2.h:584
virtual const casacore::Vector< casacore::Int > & processorId() const =0
virtual const casacore::Vector< casacore::Int > & stateId() const =0
virtual const casacore::Matrix&lt;casacore::Float&gt; &amp; sigmaMat () const = 0; // [nC,nR] ...
virtual void setFlagRow(const casacore::Vector< casacore::Bool > &value)=0
virtual ms::MsRow * getRowMutable(casacore::Int row)
virtual const casacore::Vector< casacore::Int > & dataDescriptionIds() const =0
virtual casacore::Int dataDescriptionId () const = 0; virtual void setDataDescriptionId (casacore::In...
virtual casacore::Bool existsColumn(VisBufferComponent2 id) const =0
virtual const casacore::Vector< casacore::uInt > & rowIds() const =0
The returned casacore::Vector serves as a map between the rows in the VisBuffer and the row IDs in th...
virtual void setImagingWeight(const casacore::Matrix< casacore::Float > &newImagingWeights)=0
virtual casacore::IPosition getShape() const =0
virtual void dirtyComponentsAdd(const VisBufferComponents2 &additionalDirtyComponents)=0
virtual void setTime(const casacore::Vector< casacore::Double > &value)=0
static void phaseCenterShift(VisBuffer2 &vb, const casacore::Vector< casacore::Double > &phase)
virtual casacore::Int getChannelNumber(casacore::Int rowInBuffer, casacore::Int frequencyIndex) const =0
virtual casacore::Float getSigmaScaled(casacore::Int row) const =0
virtual void copyComponents(const VisBuffer2 &other, const VisBufferComponents2 &components, casacore::Bool allowShapeChange=false, casacore::Bool fetchIfNeeded=true)=0
Copies the specified components (or just the ones in the cache if fetchIfNeeded is false) from the sp...
virtual const casacore::Vector< casacore::Float > & feedPa2() const =0
Calculates the parallactic angle for feed 0 of the row&#39;s Antenna2.
virtual const casacore::Vector< casacore::Int > & feed1() const =0
Referenced counted pointer for constant data.
Definition: VisModelData.h:42
virtual void setVisCubeCorrected(const casacore::Cube< casacore::Complex > &)=0
virtual void setVisCube(const casacore::Complex &c)=0
Fast Square Matrix class with fixed (templated) size.
virtual void normalize()=0
casacore::Sort/unsort the correlations, if necessary (Rudimentary handling of non-canonically sorted ...
const VisibilityIterator2 * associatedVi_p
Definition: VisBuffer2.h:595
virtual void setSpectralWindows(const casacore::Vector< casacore::Int > &spectralWindows)=0
virtual casacore::Cube< casacore::Bool > & flagCubeRef()=0
virtual const casacore::Vector< casacore::Int > & observationId() const =0
virtual const casacore::Vector< casacore::Int > & correlationTypes() const =0
Returns the correlation type of each correlation in the VisCube.
double Double
Definition: aipstype.h:55
virtual void writeChangesBack()=0
virtual const casacore::Vector< casacore::MDirection > & azel(casacore::Double time) const =0
Returns the pointing angle for each antenna in the array at the specified time.
virtual casacore::Int polarizationFrame() const =0
Returns the polarization frame for the specified row.
virtual const casacore::Vector< casacore::SquareMatrix< casacore::Complex, 2 > > & cjones() const =0
Returns the Jones C matrix for each antenna.
virtual casacore::Int nRows() const =0
Returns the number of rows in this VisBuffer.
virtual casacore::Vector< casacore::Int > getCorrelationTypes() const =0
virtual void validateShapes() const =0
virtual const casacore::Vector< casacore::Int > & scan() const =0
virtual const casacore::Matrix< casacore::Double > & uvw() const =0
virtual const casacore::MeasurementSet & ms() const
Definition: VisBuffer2.h:220
virtual const casacore::Vector< casacore::Int > & feed2() const =0
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual const casacore::Vector< casacore::Int > & fieldId() const =0
virtual void setShape(casacore::Int nCorrelations, casacore::Int nChannels, casacore::Int nRows, casacore::Bool clearCache=false)=0
virtual const vi::SubtableColumns & subtableColumns() const
Definition: VisBuffer2.h:221
virtual casacore::Bool isRekeyable() const =0
virtual void invalidate()=0
virtual void setWeightSpectrum(const casacore::Cube< casacore::Float > &value)=0
virtual void setRekeyable(casacore::Bool isRekeable)=0
virtual casacore::Bool isNewSpectralWindow() const =0
virtual casacore::Float getWeightScaled(casacore::Int row) const =0
virtual const casacore::Matrix&lt;CStokesVector&gt; &amp; visModel () const = 0; // [nF,nR] virtual void setVis...
virtual casacore::Vector< casacore::Stokes::StokesTypes > getCorrelationTypesDefined() const =0
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
virtual casacore::Vector< casacore::Stokes::StokesTypes > getCorrelationTypesSelected() const =0
float Float
Definition: aipstype.h:54
virtual void copyCoordinateInfo(const VisBuffer2 *other, casacore::Bool includeDirections, casacore::Bool allowShapeChange=false, casacore::Bool fetchIfNeeded=true)=0
Copies the coordinate components (or just the ones in the cache if fetchIfNeeded is false) from the s...
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
virtual casacore::Int nCorrelations() const =0
Returns the number of correlations along the visCube correlation axis.
virtual ~VisBuffer2()
Used by framework.
Definition: VisBuffer2.h:165
A Table intended to hold astronomical data (a set of Measurements).
virtual casacore::Vector< casacore::Bool > & flagRowRef()=0
virtual casacore::Double hourang(casacore::Double time) const =0
Returns the hour angle of the array at the specified time.
virtual void setObservationId(const casacore::Vector< casacore::Int > &value)=0
virtual void setArrayId(const casacore::Vector< casacore::Int > &)=0
virtual const casacore::Vector< casacore::Double > & timeCentroid() const =0
virtual const casacore::Array< casacore::Bool > & flagCategory() const =0
virtual const casacore::Matrix&lt;casacore::Bool&gt; &amp; flag () const = 0; // [nF,nR] virtual void setFlag (...
virtual casacore::Vector< casacore::Int > getChannelNumbersSelected(casacore::Int outputChannelIndex) const =0
virtual casacore::Int nChannels() const =0
virtual Subchunk getSubchunk() const =0
virtual const casacore::Vector< casacore::Double > & exposure() const =0
#define ThrowCc(m)
Definition: Error.h:85
virtual const casacore::Cube< casacore::Complex > & visCube() const =0
Visibility data accessors in order of observed, corrected, float, &amp; model
virtual void setFillable(casacore::Bool isFillable)=0
virtual const casacore::Vector< casacore::Bool > & flagRow() const =0
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
virtual void configureNewSubchunk(casacore::Int msId, const casacore::String &msName, casacore::Bool isNewMs, casacore::Bool isNewArrayId, casacore::Bool isNewFieldId, casacore::Bool isNewSpectralWindow, const Subchunk &subchunk, casacore::Int nRows, casacore::Int nChannels, casacore::Int nCorrelations, const casacore::Vector< casacore::Int > &correlations, const casacore::Vector< casacore::Stokes::StokesTypes > &correlationsDefined, const casacore::Vector< casacore::Stokes::StokesTypes > &correlationsSelected, casacore::CountedPtr< WeightScaling > weightScaling)=0
virtual void setUvw(const casacore::Matrix< casacore::Double > &value)=0
virtual const casacore::Cube< casacore::Bool > & flagCube() const =0
virtual VisBufferComponents2 dirtyComponentsGet() const =0
virtual casacore::MDirection azel0(casacore::Double time) const =0
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
const Double c
Fundamental physical constants (SI units):
virtual const casacore::Vector< casacore::MDirection > & direction1() const =0
virtual const casacore::Vector< casacore::Float > & feedPa(casacore::Double time) const =0
Calculates the parallactic angle for the first receptor of each antenna at the specified time...
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual void phaseCenterShift(const casacore::Vector< casacore::Double > &phase)=0
Rotate visibility phase for given vector (dim = nrow of vb) of phases (metres)
virtual void setFeed1(const casacore::Vector< casacore::Int > &value)=0
virtual casacore::Bool isWritable() const =0
virtual casacore::Float parang0(casacore::Double time) const =0
Calculates the parallactic angle of the array as a whole at the specified time.
virtual void copy(const VisBuffer2 &other, casacore::Bool fetchIfNeeded)=0
virtual void setWeight(const casacore::Matrix< casacore::Float > &value)=0
virtual void setTimeInterval(const casacore::Vector< casacore::Double > &value)=0
This class encapsulates an enum with values corresponding to the various data components accessible v...
virtual casacore::Int msId() const =0
virtual void setSigma(const casacore::Matrix< casacore::Float > &value)=0
virtual void setFlagCube(const casacore::Cube< casacore::Bool > &value)=0
virtual void setFieldId(const casacore::Vector< casacore::Int > &)=0
virtual const casacore::Cube< casacore::Float > & visCubeFloat() const =0
virtual const casacore::Matrix&lt;CStokesVector&gt; &amp; visCorrected () const = 0; // [nF,nR] virtual void setVisCorrected (const casacore::Matrix&lt;CStokesVector&gt; &amp;) = 0; // [nF,nR]
virtual const casacore::Matrix< casacore::Float > & imagingWeight() const =0
This method returns the imagin g If an imaging weight generator has not been supplied to the associat...
virtual const casacore::Matrix< casacore::Float > & weight() const =0
virtual casacore::String msName(casacore::Bool stripPath=false) const =0
virtual casacore::Bool isNewArrayId() const =0
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
virtual void setAntenna2(const casacore::Vector< casacore::Int > &value)=0
virtual const casacore::Cube< casacore::Float > & weightSpectrum() const =0
virtual const casacore::Matrix&lt;casacore::Float&gt; &amp; weightMat () const = 0; // [nC,nR] virtual void set...
virtual void setTimeCentroid(const casacore::Vector< casacore::Double > &value)=0
unsigned int uInt
Definition: aipstype.h:51
virtual const casacore::Vector< casacore::Double > & time() const =0
virtual void setScan(const casacore::Vector< casacore::Int > &value)=0
virtual casacore::Bool isFillable() const =0
virtual casacore::Bool isAttached() const =0
virtual const casacore::Vector< casacore::Int > & spectralWindows() const =0
Returns the spectral window ID for the specified row.
virtual void setExposure(const casacore::Vector< casacore::Double > &value)=0
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42