casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AveragingVi2Factory.h
Go to the documentation of this file.
1 /*
2  * AveragingViFactory.h
3  *
4  * Created on: Feb 25, 2013
5  * Author: jjacobs
6  */
7 
8 #ifndef MSVIS_AVERAGINGVIFACTORY_H_
9 #define MSVIS_AVERAGINGVIFACTORY_H_
10 
12 
13 namespace casa {
14 
15 class MeasurementSet2;
16 
17 namespace vi {
18 
19 // AveragingOptions
20 //
21 // A container for the options that can be specified when creating
22 // an AveragingTvi2 based VI. The user can specify which of the
23 // data cubes (observed, model and corrected) are to be averaged.
24 // The source of the weights applied to each cube can also be specified.
25 // See enum Options below for the symbols to use; the symbols are usually
26 // combined using bitwise-and ("|") in the constructor.
27 
29 
30 public:
31 
32  enum Options {Nothing = 0,
33  AverageObserved = 1 << 0, // Average the observed data
34  AverageModel = 1 << 1, // Average the model data
35  AverageCorrected = 1 << 2, // Average the corrected data
36  AverageFloat = 1 << 3, // Average float (single dish) data
37  ObservedPlainAvg = 1 << 4,
38  ObservedFlagAvg = 1 << 5,
41  ModelPlainAvg = 1 << 8,
42  ModelFlagAvg = 1 << 9,
47  CorrectedPlainAvg = 1 << 14,
48  CorrectedFlagAvg = 1 << 15,
51  BaselineDependentAveraging = 1 << 18, // Do averaging with lengths dependent on baselines
52  // Requires specifying a max uvw distance parameter
53  phaseShifting = 1 << 19,
55  };
56 
59  explicit AveragingOptions (Options o) : options_p (o) {}
60 
62  {
63  return AveragingOptions (other.options_p & options_p);
64  }
65 
67  {
68  return AveragingOptions (other.options_p | options_p);
69  }
70 
72  {
73  * this = AveragingOptions (options_p | other.options_p);
74 
75  return * this;
76  }
77 
79  {
80  * this = AveragingOptions (options_p | options);
81 
82  return * this;
83  }
84 
86  {
87  return AveragingOptions (~ options_p);
88  }
89 
90  casacore::Bool contains (Options o) const { return (o & options_p) != 0; }
91 
93  nSet (casacore::Int o) const
94  {
95  casacore::Int result = o & options_p;
96  casacore::Int nSet = 0;
97 
98  for (casacore::Int mask = 1; mask < MarksLast; mask = mask << 1){
99 
100  nSet += (result & mask) != 0 ? 1 : 0;
101 
102  }
103 
104  return nSet;
105  }
106 
107 private:
108 
109 
111 };
112 
114 
115 public:
116 
118 
119  AveragingParameters (casacore::Double averagingInterval,
120  casacore::Double chunkInterval,
121  const SortColumns & sortColumns = SortColumns (),
123  casacore::Double maxUvwDistance = 0,
124  WeightScaling * weightScalingForAveraging = 0,
125  casacore::Bool isWriteable = false,
126  casacore::Double dx = 0,
127  casacore::Double dy = 0);
128 
130 
132 
136  const AveragingOptions & getOptions() const;
137  const SortColumns & getSortColumns () const;
138  WeightScaling * getWeightScaling () const;
141  casacore::Bool isWriteable () const;
142 
145  void setSortColumns (const SortColumns &);
146  void setOptions (const AveragingOptions &);
149  void setWritable (casacore::Bool isWritable);
151 
152 private:
153 
154  void validate ();
155  void validateOptions ();
156 
166 
168 
169 };
170 
171 // The AveragingVi2Factory is used to initialize a VisibilityIterator2 so that
172 // it performs time averaging. The parameters are fairly straightforward:
173 //
174 // averagingInterval - the time period to average over
175 // chunkInterval - the time interval of an averaged chunk
176 // sortColumns - the usual set of sort columns. The sort columns also determine
177 // the boundaries of a chunk. If a column is present in the sort
178 // columns, then there will be no averaging across values with different
179 // values of that column (e.g., scan_number, array_id, etc.). This is
180 // because a chunk is defined to be the set of records having the same
181 // values for all of the sort columns except for time. The time column
182 // is used to select rows having the same sort-column values but within
183 // a specified interval of time.
184 
186 
187 public:
188 
189  AveragingVi2Factory (const AveragingParameters & parameters,
191 
192  AveragingVi2Factory (const AveragingParameters & parameters,
195  ...);
196  // use 0 to mark end of MSs
197 
198  AveragingVi2Factory (const AveragingParameters & parameters,
200 
202 
203 protected:
204 
205  virtual ViImplementation2 * createVi () const;
206 
207 private:
208 
209  void initialize (const AveragingParameters & parameters,
211 
214 };
215 
216 
218 
219 public:
220 
222 
224 
225  protected:
226 
227 
228  virtual ViImplementation2 * createInstance(ViImplementation2* vii0) const;
229 
231 
232 };
233 
234 
235 } // end namesapce vi
236 } // end namespace casa
237 
238 
239 #endif /* MSVIS_AVERAGINGVIFACTORY_H_ */
int Int
Definition: aipstype.h:50
WeightScaling * getWeightScaling() const
LatticeExprNode mask(const LatticeExprNode &expr)
This function returns the mask of the given expression.
Requires specifying a max uvw distance parameter.
void setChunkInterval(casacore::Double)
casacore::Int nSet(casacore::Int o) const
casacore::Bool contains(Options o) const
const AveragingParameters avepars_p
casacore::Double getXpcOffset() const
void setWritable(casacore::Bool isWritable)
VisBufferComponents2 allDataColumns() const
AveragingVi2LayerFactory(const AveragingParameters &avepars)
AveragingParameters & operator=(const AveragingParameters &other)
void setWeightScaling(WeightScaling *)
Options options
AveragingOptions & operator|=(const AveragingOptions &other)
const AveragingOptions & getOptions() const
The AveragingVi2Factory is used to initialize a VisibilityIterator2 so that it performs time averagin...
casacore::Double getAveragingInterval() const
casacore::Bool isWriteable() const
double Double
Definition: aipstype.h:55
void setPhaseShift(casacore::Double dx, casacore::Double dy)
AveragingOptions operator~() const
void setSortColumns(const SortColumns &)
casacore::Double getYpcOffset() const
AveragingOptions operator&(const AveragingOptions &other) const
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Double getMaxUvwDistance() const
void setMaxUvwDistance(casacore::Double)
AveragingOptions operator|(const AveragingOptions &other) const
A Table intended to hold astronomical data (a set of Measurements).
void setOptions(const AveragingOptions &)
void setAveragingInterval(casacore::Double)
AveragingOptions(casacore::Int options)
simple 1-D array
virtual ViImplementation2 * createInstance(ViImplementation2 *vii0) const
Make a ViImplementation with another as input Must be specialized for each type.
casacore::Block< const casacore::MeasurementSet * > mss_p
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
virtual ViImplementation2 * createVi() const
const SortColumns & getSortColumns() const
casacore::Double getChunkInterval() const
This class encapsulates an enum with values corresponding to the various data components accessible v...
void initialize(const AveragingParameters &parameters, const casacore::Block< const casacore::MeasurementSet * > &mss)
AveragingVi2Factory(const AveragingParameters &parameters, casacore::MeasurementSet *ms)