casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VisBufferAsync.h
Go to the documentation of this file.
1 /*
2  * VisibilityBufferAsync.h
3  *
4  * Created on: Nov 3, 2010
5  * Author: jjacobs
6  */
7 
8 #ifndef VISIBILITYBUFFERASYNC_H_
9 #define VISIBILITYBUFFERASYNC_H_
10 
11 #include <msvis/MSVis/VisBuffer.h>
12 
13 namespace casa {
14 
15 class ROVisibilityIteratorAsync;
16 
17 namespace asyncio {
18  class VlaDatum;
19  class VLAT;
20 }
21 
22 class VisBufferAsync : public VisBuffer {
23 
24  friend class Rovia_Test;
25  friend class ViReadImplAsync;
26  friend class VisBufferAsyncWrapper;
27  friend class VisBufferAutoPtr;
28  friend class asyncio::VlaDatum;
29  friend class asyncio::VLAT;
30 
31 public:
32 
33  //VisBufferAsync (const VisBuffer& vb);
34 
35  ~VisBufferAsync ();
36 
37  VisBufferAsync & operator= (const VisBufferAsync & other);
38 
40  virtual VisBufferAsync & assign (const VisBuffer & vb, casacore::Bool copy);
43  virtual VisBuffer * clone () const;
44  //virtual casacore::Int dataDescriptionId() const;
45  virtual void detachFromVisIter ();
48  virtual void invalidate (); // This one is booby-trapped right now
49  virtual void invalidateAsync (); // Use this one in async code
50 // virtual casacore::Vector<casacore::Double> & lsrFrequency ();
51 // virtual const casacore::Vector<casacore::Double> & lsrFrequency () const;
52  virtual void lsrFrequency(const casacore::Int& spw, casacore::Vector<casacore::Double>& freq, casacore::Bool& convert) const;
53  virtual const casacore::ROMSColumns& msColumns() const;
54  casacore::Int msId () const;
55  virtual casacore::Bool newArrayId () const;
56  virtual casacore::Bool newFieldId () const;
57  casacore::Bool newMS() const;
58  virtual casacore::Bool newSpectralWindow () const;
60  return nRowChunk_p;
61  }
62 
63  casacore::Int numberAnt () const;
64  casacore::Int numberCoh () const;
67  virtual casacore::Int polarizationId() const;
68  virtual casacore::Vector<casacore::uInt>& rowIds(){throw(casacore::AipsError("rowIds() not implemented for VBA."));}
69  virtual const casacore::Vector<casacore::uInt>& rowIds() const {throw(casacore::AipsError("rowIds() const not implemented for VBA."));}
71  virtual void setCorrectedVisCube (const casacore::Cube<casacore::Complex> & vis);
72  virtual void setModelVisCube(casacore::Complex c);
73  virtual void setModelVisCube (const casacore::Cube<casacore::Complex> & vis);
74  virtual void setModelVisCube (const casacore::Vector<casacore::Float> & stokes);
75  virtual void setVisCube(casacore::Complex c);
76  virtual void setVisCube (const casacore::Cube<casacore::Complex>& vis);
77 
78 protected:
79 
80  // The constructors are not public because creation should be performed
81  // by a factory object (e.g., VisBufferAutoPtr). The use of a factory
82  // makes it possible to fine tune at run time whether a VisBuffer or a
83  // VisBufferAsync is created.
84 
85  VisBufferAsync ();
86  VisBufferAsync (const VisBufferAsync & other);
88 
90  void checkVisIter (const char * func, const char * file, int line, const char * extra = "") const;
91  void clear ();
92  void construct ();
93  virtual void copyAsyncValues (const VisBufferAsync & other);
94  virtual void copyCache (const VisBuffer & other, casacore::Bool force);
95  template<typename T> void copyVector (const casacore::Vector<T> & from, casacore::Vector<T> & to);
98  void fillFrom (const VisBufferAsync & other);
103  const casacore::MeasurementSet & getMs () const;
104  casacore::Int getNSpw () const;
107  void setAngleInfo (casacore::Bool allBeamOffsetsZero,
108  const casacore::Vector<casacore::String> antennaMounts,
110  const casacore::Cube<casacore::Double> & receptorAngles);
111  void initializeScalars ();
113  void setFilling (casacore::Bool isFilling);
114  void setLsrInfo (const casacore::Block <casacore::Int> & channelGroupNumber,
115  const casacore::Block <casacore::Int> & channelIncrement,
116  const casacore::Block <casacore::Int> & channelStart,
117  const casacore::Block <casacore::Int> & channelWidth,
118  const casacore::MPosition & observatoryPosition,
120  casacore::Bool velocitySelection);
122  void setMeasurementSetId (casacore::Int id, bool isNew);
123  void setMEpoch (const casacore::MEpoch & mEpoch);
124  void setMSD (const casacore::MSDerivedValues & msd);
126  void setNCoh (casacore::Int);
127  void setNSpw (casacore::Int);
131  void setReceptor0Angle (const casacore::Vector<casacore::Float> & receptor0Angle);
133  void setSelectedNVisibilityChannels (const casacore::Vector<casacore::Int> & nVisibilityChannels);
134  void setSelectedSpectralWindows (const casacore::Vector<casacore::Int> & spectralWindows);
136  void setVisibilityShape (const casacore::IPosition & pvisibilityShape);
137  void updateCoordInfo (const VisBuffer *, const casacore::Bool dirDependent=true);
138 
141  static casacore::MEpoch unsharedCopyEpoch (const casacore::MEpoch & mEpoch);
143 
144 private:
145 
150 
153  mutable casacore::Vector<casacore::MDirection> azelCached_p; // mutable because it is a cached value
154  mutable casacore::Double azelCachedTime_p; // mutable because it is a cached value
160  //casacore::Int dataDescriptionId_p;
161  mutable casacore::Vector<casacore::Float> feedpaCached_p; // mutable because it is a cached value
162  mutable casacore::Double feedpaCachedTime_p; // mutable because it is a cached value
164  casacore::Vector<casacore::Double> lsrFrequency_p; // calculated by getTopoFreqs if velSelection_p
167  mutable casacore::ROMSColumns * msColumns_p; // [own]
176  //const casacore::ScalarColumn<casacore::Int> * obsMFreqTypes_p; // [use]
178  mutable casacore::Vector<casacore::Float> parangCached_p; // mutable because it is a cached value
179  mutable casacore::Double parangCachedTime_p; // mutable because it is a cached value
188 };
189 
190 
191 template<typename T>
193 {
194  // Make an independent copy of the vector.
195  // N.B.: the independence is only at the top casacore::Vector level
196  // so any deep dependence is not undone
197 
198  casacore::Vector<T> tmp = from;
199  to = tmp.copy();
200 }
201 
202 
203 } // end namespace casa
204 
205 
206 #endif /* VISIBILITYBUFFERASYNC_H_ */
void setNSpw(casacore::Int)
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
A Measure: astronomical direction.
Definition: MDirection.h:174
virtual casacore::Bool newSpectralWindow() const
A Measure: position on Earth.
Definition: MPosition.h:79
int Int
Definition: aipstype.h:50
void checkVisIter(const char *func, const char *file, int line, const char *extra="") const
void setNCoh(casacore::Int)
MSDerivedValues calculates values derived from a MS.
void setNRowChunk(casacore::Int)
casacore::Bool fillAllBeamOffsetsZero()
virtual void setVisCube(casacore::Complex c)
Set the visibility to a constant, note that this only changes the buffer, no values are written back ...
casacore::Int nSpw_p
casacore::Cube< casacore::Double > receptorAngles_p
friend class Rovia_Test
casacore::Bool newArrayId_p
casacore::Vector< casacore::Int > selectedNVisibilityChannels_p
StatsData< AccumType > copy(const StatsData< AccumType > &stats)
virtual casacore::Vector< casacore::MDirection > azel(casacore::Double time) const
virtual void copyAsyncValues(const VisBufferAsync &other)
virtual VisBuffer * clone() const
casacore::MPosition observatoryPosition_p
const casacore::ScalarColumn&lt;casacore::Int&gt; * obsMFreqTypes_p; // [use]
casacore::Vector< casacore::String > antennaMounts_p
virtual casacore::Bool newArrayId() const
VlaDatum is a single elemement in the VlaDatum buffer ring used to support the ROVisibilityIteratorAs...
void setSelectedSpectralWindows(const casacore::Vector< casacore::Int > &spectralWindows)
virtual casacore::Int polarizationId() const
casacore::Block< casacore::Int > channelWidth_p
casacore::MEpoch mEpoch_p
casacore::MDirection getPhaseCenter() const
void setLsrInfo(const casacore::Block< casacore::Int > &channelGroupNumber, const casacore::Block< casacore::Int > &channelIncrement, const casacore::Block< casacore::Int > &channelStart, const casacore::Block< casacore::Int > &channelWidth, const casacore::MPosition &observatoryPosition, const casacore::MDirection &phaseCenter, casacore::Bool velocitySelection)
virtual casacore::Bool newFieldId() const
virtual casacore::Double hourang(casacore::Double time) const
Hour angle for specified time.
virtual casacore::Vector< casacore::Float > feed_pa(casacore::Double time) const
Note that feed_pa is a function instead of a cached value.
casacore::Vector< casacore::Float > parangCached_p
casacore::Vector< casacore::MDirection > & fillDirection2()
VLAT is the Visibility LookAhead Thread. This thread advances a visibility iterator and fills the dat...
Definition: VLAT.h:219
void attachToVisIter(ROVisibilityIterator &iter)
Attach to a VisIter.
casacore::MSDerivedValues * msd_p
casacore::Int polarizationId_p
casacore::Int numberCoh() const
casacore::Vector< casacore::String > fillAntennaMounts()
casacore::Block< casacore::Int > channelIncrement_p
virtual void detachFromVisIter()
virtual casacore::Int dataDescriptionId() const;
casacore::Cube< casacore::RigidVector< casacore::Double, 2 > > beamOffsets_p
casacore::Double azelCachedTime_p
casacore::Vector< casacore::Double > lsrFrequency_p
virtual casacore::Vector< casacore::Float > parang(casacore::Double time) const
casacore::ROMSColumns * msColumns_p
const casacore::Vector< casacore::String > & getAntennaMounts() const
void setNAntennas(casacore::Int)
casacore::Double feedpaCachedTime_p
casacore::Vector< casacore::MDirection > & fillDirection1()
virtual void invalidateAsync()
void setAngleInfo(casacore::Bool allBeamOffsetsZero, const casacore::Vector< casacore::String > antennaMounts, casacore::Cube< casacore::RigidVector< casacore::Double, 2 > > beamOffsets, const casacore::Cube< casacore::Double > &receptorAngles)
virtual casacore::MDirection azel0(casacore::Double time) const
Note that azel is a function instead of a cached value.
casacore::Vector< casacore::Float > feedpaCached_p
casacore::Int dataDescriptionId_p;
Array< T > copy(ArrayInitPolicy policy=ArrayInitPolicies::NO_INIT) const
This makes a copy of the array and returns it.
A Measure: instant in time.
Definition: MEpoch.h:104
casacore::IPosition visibilityShape_p
virtual casacore::Vector< casacore::uInt > & rowIds()
Return the row Ids from the original ms.
void setMEpoch(const casacore::MEpoch &mEpoch)
casacore::Int numberAnt() const
Fast Vector classes with fixed (templated) length.
static casacore::MPosition unsharedCopyPosition(const casacore::MPosition &position)
void setSelectedNVisibilityChannels(const casacore::Vector< casacore::Int > &nVisibilityChannels)
virtual void setModelVisCube(casacore::Complex c)
casacore::Bool velSelection_p
void setTopoFreqs(const casacore::Vector< casacore::Double > &lsrFreq, const casacore::Vector< casacore::Double > &selFreq_p)
virtual void setCorrectedVisCube(casacore::Complex c)
casacore::Int nAntennas_p
casacore::Vector< casacore::Double > selFreq_p
const casacore::MeasurementSet & getMs() const
static void unsharedCopyDirectionVector(casacore::Vector< casacore::MDirection > &direction)
virtual void allSelectedSpectralWindows(casacore::Vector< casacore::Int > &spws, casacore::Vector< casacore::Int > &nvischan)
Get all selected spectral windows not just the one in the actual buffer.
casacore::Bool getAllBeamOffsetsZero() const
virtual casacore::MDirection & phaseCenter()
Definition: VisBuffer.h:464
virtual const casacore::Vector< casacore::uInt > & rowIds() const
casacore::Block< casacore::Int > channelGroupNumber_p
double Double
Definition: aipstype.h:55
void setFilling(casacore::Bool isFilling)
A class to provide easy read-only access to MeasurementSet columns.
Definition: MSColumns.h:111
static casacore::MDirection unsharedCopyDirection(const casacore::MDirection &direction)
casacore::Vector< casacore::Float > receptor0Angle_p
void setReceptor0Angle(const casacore::Vector< casacore::Float > &receptor0Angle)
void fillFrom(const VisBufferAsync &other)
A convenience class to assist in migrating code to potentially use asynchronous I/O.
Definition: VisBuffer.h:1198
casacore::Int nCoh_p
virtual void lsrFrequency(const casacore::Int &spw, casacore::Vector< casacore::Double > &freq, casacore::Bool &convert) const
virtual casacore::Vector&lt;casacore::Double&gt; &amp; lsrFrequency (); virtual const casacore::Vector&lt;casacore...
void setMSD(const casacore::MSDerivedValues &msd)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual void copyCache(const VisBuffer &other, casacore::Bool force)
void setMeasurementSet(const casacore::MeasurementSet &ms)
float Float
Definition: aipstype.h:54
VisBuffers encapulsate one chunk of visibility data for processing.
VisBufferAsync()
The constructors are not public because creation should be performed by a factory object (e...
const casacore::Cube< casacore::RigidVector< casacore::Double, 2 > > & getBeamOffsets() const
casacore::Int msId() const
Return the actual msid, useful if using multiple ms to monitor which ms in the list is being dealt wi...
casacore::Bool isFilling_p
A Table intended to hold astronomical data (a set of Measurements).
casacore::Int nRowChunk() const
void setRowIds(const casacore::Vector< casacore::uInt > &rowIds)
VisBufferAsync & operator=(const VisBufferAsync &other)
void setNewEntityFlags(bool newArrayId, bool newFieldId, bool newSpectralWindow)
void setPolarizationId(casacore::Int)
casacore::Bool allBeamOffsetsZero_p
casacore::Int nRowChunk_p
const casacore::Cube< casacore::Double > & getReceptorAngles() const
casacore::Block< casacore::Int > channelStart_p
virtual VisBufferAsync & assign(const VisBuffer &vb, casacore::Bool copy)
Assignment, optionally without copying the data across; with copy=true this is identical to normal as...
casacore::Bool newFieldId_p
Base class for all Casacore library errors.
Definition: Error.h:134
const casacore::MeasurementSet * measurementSet_p
casacore::Int getNSpw() const
casacore::Cube< casacore::Double > fillReceptorAngles()
virtual casacore::Float parang0(casacore::Double time) const
NOMINAL parallactic angle (feed p.a.
casacore::Vector< casacore::MDirection > azelCached_p
const Double c
Fundamental physical constants (SI units):
void setMeasurementSetId(casacore::Int id, bool isNew)
virtual const casacore::ROMSColumns & msColumns() const
Access the current casacore::ROMSColumns object via VisIter.
static casacore::MEpoch unsharedCopyEpoch(const casacore::MEpoch &mEpoch)
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
virtual casacore::Vector< casacore::Double > & time()
Definition: VisBuffer.h:512
casacore::Double parangCachedTime_p
casacore::Cube< casacore::RigidVector< casacore::Double, 2 > > fillBeamOffsets()
casacore::Bool newSpectralWindow_p
ROVisibilityIterator iterates through one or more readonly MeasurementSets.
casacore::MDirection & fillPhaseCenter()
virtual void invalidate()
Invalidate the cache.
void copyVector(const casacore::Vector< T > &from, casacore::Vector< T > &to)
void setVisibilityShape(const casacore::IPosition &pvisibilityShape)
void updateCoordInfo(const VisBuffer *, const casacore::Bool dirDependent=true)
Update coordinate info - useful for copied VisBuffers that need to retain some state for later refere...
casacore::Vector< casacore::Int > selectedSpectralWindows_p
~VisBufferAsync()
VisBufferAsync (const VisBuffer&amp; vb);.
casacore::Bool newMS() const
checked if the ms has changed since the last chunk processed
Defines nreal time structures used by the VLA table filler.
Definition: nreal.h:100