casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AveragingTvi2.h
Go to the documentation of this file.
1 #if ! defined (Msvis_AveragingTvi2_H_121211_1236)
2 #define Msvis_AveragingTvi2_H_121211_1236
3 
4 #include <casa/aips.h>
8 
9 namespace casa {
10 
11 namespace ms {
12 
13 class MsRow;
14 
15 };
16 
17 namespace vi {
18 
19 class AveragingOptions;
20 
21 namespace avg {
22 
23 class MsRowAvg;
24 class VbAvg;
25 
26 }
27 
29 
30 public:
31 
32  AveragingTvi2 (ViImplementation2 * inputVii,
33  const AveragingParameters & averagingParameters);
34  ~AveragingTvi2 ();
35 
36  // Report the the ViImplementation type
37  virtual casacore::String ViiType() const { return casacore::String("TimeAve( ")+getVii()->ViiType()+" )"; };
38 
40  //
41  // Chunk/Subchunk structure in the AveragingTvi2
42  //
43  // The averaging interval, in seconds, is specified at construction time.
44  // The interval (i.e., the size of the chunk in time) is also specified
45  // at creation time; the interval must be an integer multiple of the
46  // averaging interval.
47  //
48  // The input VI's setting must be compatible with those of the
49  // AveragingTvi2. This means that the chunk size of the input VI must
50  // have the same duration as the averaging VI. Although the input VI
51  // and the averaging VI have the same duration, the averaging VI will
52  // have fewer subchunks since N input subchunks will be averaged down
53  // to create a single output subchunk.
54  //
55  // The input VI will also define the averaging boundaries by its
56  // definition of a chunk. For example, if the input VI allows data with
57  // different scans to be in the same chunk, then they will potentially
58  // be averaged together.
59  //
60  // The input VI must use the data description ID as a sort column so that
61  // a chunk will only contain data from a single DDID setting.
62 
63  void originChunks (casacore::Bool forceRewind = false);
64  void nextChunk ();
65  casacore::Bool moreChunks () const;
66 
67  void origin ();
68  void next ();
69  casacore::Bool more () const;
70 
72  void writeFlagRow (const casacore::Vector<casacore::Bool> & rowflags);
73 
75  virtual void visibilityModel(casacore::Cube<casacore::Complex>& vis) const;
77  virtual void floatData(casacore::Cube<casacore::Float>& fcube) const;
78  virtual void flag(casacore::Cube<casacore::Bool>& flags) const;
79  virtual void flagRow(casacore::Vector<casacore::Bool>& rowflags) const;
80  virtual void weight(casacore::Matrix<casacore::Float>& wtmat) const;
81  virtual void sigma(casacore::Matrix<casacore::Float>& sigmat) const;
82  virtual void weightSpectrum (casacore::Cube<casacore::Float> & wtsp) const;
83  virtual void sigmaSpectrum (casacore::Cube<casacore::Float> & sigsp) const;
84  virtual casacore::Bool weightSpectrumExists () const;
85  virtual casacore::Bool sigmaSpectrumExists () const;
86  virtual void exposure (casacore::Vector<double> & expo) const;
87  virtual void getRowIds (casacore::Vector<casacore::uInt> & rowids) const;
88  virtual void time (casacore::Vector<double> & t) const;
89  virtual void timeInterval (casacore::Vector<double> & ti) const;
90  virtual void timeCentroid (casacore::Vector<double> & t) const;
91  virtual void antenna1 (casacore::Vector<casacore::Int> & ant1) const;
92  virtual void antenna2 (casacore::Vector<casacore::Int> & ant2) const;
93  virtual void uvw (casacore::Matrix<double> & uvwmat) const;
94 
97  {
98  return sigma > FLT_MIN ? 1.0 / (sigma * sigma) : 0.0; // bad sample
99  }
100 
101 
104 
105 protected:
106 
107  void advanceInputVii ();
109  casacore::Bool inputExceedsTimeDistance (ms::MsRow * rowInput, avg::MsRowAvg * rowAveraged);
110  casacore::Bool inputExceedsUvwDistance (ms::MsRow * rowInput, avg::MsRowAvg * rowAveraged);
111  void produceSubchunk ();
112  void processInputSubchunk (const VisBuffer2 *);
114  void captureIterationInfo (const VisBuffer2 * vb2);
115  bool subchunksReady () const;
117 
118 private:
119 
120  const casacore::Double averagingInterval_p; // averaging interval in seconds
123  casacore::Int ddidLastUsed_p; // ddId last used to produce a subchunk.
124  casacore::Bool inputViiAdvanced_p; // true if input VII was advanced but data not used
126  Subchunk subchunk_p;
128  avg::VbAvg * vbAvg_p;
132 };
133 
134 } // end namespace vi
135 
136 } // end namespace casa
137 
138 #endif // ! defined (Msvis_AveragingTvi2_H_121211_1236)
virtual casacore::String ViiType() const
Report the the ViImplementation type.
Definition: AveragingTvi2.h:37
int Int
Definition: aipstype.h:50
virtual void sigmaSpectrum(casacore::Cube< casacore::Float > &sigsp) const
Return sgimaspectrum (a sigma for each channel)
virtual void weightSpectrum(casacore::Cube< casacore::Float > &wtsp) const
Return weightspectrum (a weight for each channel)
casacore::Bool subchunkExists_p
class MsRowAttributes {
Definition: MsRows.h:131
virtual void visibilityCorrected(casacore::Cube< casacore::Complex > &vis) const
Return the visibilities as found in the casacore::MS, casacore::Cube (npol,nchan,nrow).
casacore::Bool inputExceedsTimeDistance(ms::MsRow *rowInput, avg::MsRowAvg *rowAveraged)
AveragingOptions averagingOptions_p
void processInputSubchunk(const VisBuffer2 *)
casacore::Bool reachedAveragingBoundary()
static casacore::Float weightToSigma(casacore::Float weight)
static casacore::Vector< casacore::Float > average(const casacore::Matrix< casacore::Float > &data, const casacore::Matrix< casacore::Bool > &flags)
casacore::Int ddidLastUsed_p
virtual void antenna1(casacore::Vector< casacore::Int > &ant1) const
+=========================+ | | | Subchunk casacore::Data Accessors | | | +=========================+...
virtual casacore::Bool weightSpectrumExists() const
Determine whether WEIGHT_SPECTRUM exists.
void captureIterationInfo(const VisBuffer2 *vb2)
casacore::Int startBuffer_p
AveragingTvi2(ViImplementation2 *inputVii, const AveragingParameters &averagingParameters)
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
virtual void getRowIds(casacore::Vector< casacore::uInt > &rowids) const
Return the row ids as from the original root table.
virtual void visibilityObserved(casacore::Cube< casacore::Complex > &vis) const
void writeFlagRow(const casacore::Vector< casacore::Bool > &rowflags)
Write/modify the flag row column; dimension casacore::Vector (nrow)
bool subchunksReady() const
casacore::Int determineDdidToUse() const
static casacore::Float sigmaToWeight(casacore::Float sigma)
Definition: AveragingTvi2.h:96
double Double
Definition: aipstype.h:55
virtual void exposure(casacore::Vector< double > &expo) const
Return actual time interval.
casacore::Bool moreChunks() const
ViImplementation2 * getVii() const
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void writeFlag(const casacore::Cube< casacore::Bool > &flag)
Write/modify the flags in the data.
the interval must be an integer multiple of the averaging interval The input VI s setting must be compatible with those of the AveragingTvi2 This means that the chunk size of the input VI must have the same duration as the averaging VI Although the input VI and the averaging VI have the same the averaging VI will have fewer subchunks since N input subchunks will be averaged down to create a single output subchunk The input VI will also define the averaging boundaries by its definition of a chunk For if the input VI allows data with different scans to be in the same then they will potentially be averaged together The input VI must use the data description ID as a sort column so that a chunk will only contain data from a single DDID setting *void originChunks(casacore::Bool forceRewind=false)
Methods to control chunk iterator.
virtual casacore::Bool sigmaSpectrumExists() const
Determine whether SIGMA_SPECTRUM exists.
virtual void flagRow(casacore::Vector< casacore::Bool > &rowflags) const
Return row flag.
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
float Float
Definition: aipstype.h:54
virtual void time(casacore::Vector< double > &t) const
Return MJD midpoint of interval.
virtual void timeInterval(casacore::Vector< double > &ti) const
Return nominal time interval.
AveragingParameters averagingParameters_p
const casacore::Double averagingInterval_p
virtual void flag(casacore::Cube< casacore::Bool > &flags) const
Return flag for each polarization, channel and row.
virtual void timeCentroid(casacore::Vector< double > &t) const
Return MJD centroid of interval.
casacore::Int endBuffer_p
virtual void visibilityModel(casacore::Cube< casacore::Complex > &vis) const
virtual void sigma(casacore::Matrix< casacore::Float > &sigmat) const
Return sigma.
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
casacore::Bool more() const
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
void validateInputVi(ViImplementation2 *)
virtual casacore::String ViiType() const =0
Report the the ViImplementation type.
WeightScaling * weightScaling_p
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Bool inputViiAdvanced_p
casacore::Bool inputExceedsUvwDistance(ms::MsRow *rowInput, avg::MsRowAvg *rowAveraged)
void origin()
+==================================+ | | | Iteration Control and Monitoring | | | +==================...
virtual void uvw(casacore::Matrix< double > &uvwmat) const
Return u,v and w (in meters)
virtual void antenna2(casacore::Vector< casacore::Int > &ant2) const
Return antenna2.
virtual void floatData(casacore::Cube< casacore::Float > &fcube) const
Return FLOAT_DATA as a casacore::Cube (npol, nchan, nrow) if found in the MS.
virtual void weight(casacore::Matrix< casacore::Float > &wtmat) const
Return weight.