casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FiltrationTVI.h
Go to the documentation of this file.
1 //# FiltrationTVI.h: Template class for data filtering TVI
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,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_FILTRATIONTVI_H_
28 #define _MSVIS_FILTRATIONTVI_H_
29 
30 #include <casacore/casa/aips.h>
34 
35 #include <map>
36 #include <vector>
37 #include <memory>
38 
40 
41 namespace casacore {
42 // forward declaration
43 //class Record;
44 }
45 
46 namespace casa { //# NAMESPACE CASA - BEGIN
47 
48 namespace vi { //# NAMESPACE vi - BEGIN
49 
50 //# forward decl
51 //class ViFactory;
52 class ViiLayerFactory;
53 class FiltrationTVIFactory;
54 
55 // Filtering type
57 public:
58  // Filtering type enum
63  };
64 
66  casacore::String type_string = "";
67 
68  switch (type) {
70  type_string = "SDDoubleCircleFilter";
71  break;
72  default:
73  type_string = "InvalidFilter";
74  break;
75  }
76 
77  return type_string;
78  }
79 };
80 
81 
82 // <summary>
83 // FiltrationTVI is an implementation of data filtering
84 // </summary>
85 
86 // <use visibility=export>
87 
88 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
89 // </reviewed>
90 
91 // <prerequisite>
92 // <li> <linkto class="TransformingVi2">TransformingVi2</linkto>
93 // </prerequisite>
94 //
95 // <etymology>
96 //
97 // </etymology>
98 //
99 // <synopsis>
100 // FiltrationTVI works as a visibility filter, returning only necessary data chunk
101 // when iterating through the data. It takes filter implementation
102 // class as its template argument, and work with it to filter out unwanted
103 // data chunk. You can change the behavior of the class by simply replacing
104 // filter implementation with the one that fits your usecase.
105 // </synopsis>
106 //
107 // <example>
108 // <code>
109 // //
110 // </code>
111 // </example>
112 //
113 // <motivation>
114 // For single dish calibration, we need a mechanism to select the data chunk
115 // necessary for calibration. This selection associates with the calibration
116 // type so it is completely different from user-specified selection.
117 // </motivation>
118 //
119 // <thrown>
120 // <li>
121 // <li>
122 // </thrown>
123 //
124 // <todo asof="1997/05/30">
125 // </todo>
126 
127 template<class Filter>
129 
130 public:
131 
132  // Destructor
133 
134  virtual ~FiltrationTVI();
135 
136  // Report the the ViImplementation type
137  virtual casacore::String ViiType() const {
138  return casacore::String("FiltrationTVI<") + filter_p->filterType() + ">( "
139  + getVii()->ViiType() + " )";
140  }
141  ;
142 
143  // +==================================+
144  // | |
145  // | Iteration Control and Monitoring |
146  // | |
147  // +==================================+
148 
149  // Methods to control and monitor subchunk iteration
150 
151  virtual void origin();
152  virtual void next();
153 
154  // Methods to control chunk iterator
155 
156  virtual void originChunks (casacore::Bool forceRewind = false);
157  virtual void nextChunk ();
158 
159  // Return the number of rows in the current iteration
160  // FiltrationTVI may change the number of rows when given vb
161  // is partly filtrate
162  virtual casacore::Int nRows() const;
163 
164  // Return the row ids as from the original root table. This is useful
165  // to find correspondance between a given row in this iteration to the
166  // original ms row
167  virtual void getRowIds(casacore::Vector<casacore::uInt> & rowids) const;
168 
169  // +=========================+
170  // | |
171  // | Subchunk casacore::Data Accessors |
172  // | |
173  // +=========================+
174 
175  // Return antenna1
176 
177  virtual void antenna1(casacore::Vector<casacore::Int> & ant1) const;
178 
179  // Return antenna2
180 
181  virtual void antenna2(casacore::Vector<casacore::Int> & ant2) const;
182 
183  // Return actual time interval
184 
185  virtual void exposure(casacore::Vector<double> & expo) const;
186 
187  // Return feed1
188 
189  virtual void feed1(casacore::Vector<casacore::Int> & fd1) const;
190 
191  // Return feed2
192 
193  virtual void feed2(casacore::Vector<casacore::Int> & fd2) const;
194 
195  // Return the current FieldId
196 
197  virtual void fieldIds(casacore::Vector<casacore::Int>&) const;
198 
199  // Return the current ArrayId
200 
201  virtual void arrayIds(casacore::Vector<casacore::Int>&) const;
202 
203  // Return flag for each polarization, channel and row
204 
205  virtual void flag(casacore::Cube<casacore::Bool> & flags) const;
206 
207  // Return flag for each channel & row
208 
209  virtual void flag(casacore::Matrix<casacore::Bool> & flags) const;
210 
211  // Return flags for each polarization, channel, category, and row.
212 
213  virtual void flagCategory(
214  casacore::Array<casacore::Bool> & flagCategories) const;
215 
216  // Return row flag
217 
218  virtual void flagRow(casacore::Vector<casacore::Bool> & rowflags) const;
219 
220  // Return the OBSERVATION_IDs
221 
222  virtual void observationId(casacore::Vector<casacore::Int> & obsids) const;
223 
224  // Return the PROCESSOR_IDs
225 
226  virtual void processorId(casacore::Vector<casacore::Int> & procids) const;
227 
228  // Return scan number
229 
230  virtual void scan(casacore::Vector<casacore::Int> & scans) const;
231 
232  // Return the STATE_IDs
233 
234  virtual void stateId(casacore::Vector<casacore::Int> & stateids) const;
235 
236  // Return feed configuration matrix for specified antenna
237 
238  virtual void jonesC(
240 
241  // Return sigma
242 
243  virtual void sigma(casacore::Matrix<casacore::Float> & sigmat) const;
244 
245  // Return current SpectralWindow
246 
247  virtual void spectralWindows(casacore::Vector<casacore::Int> & spws) const;
248 
249  // Return MJD midpoint of interval.
250 
251  virtual void time(casacore::Vector<double> & t) const;
252 
253  // Return MJD centroid of interval.
254 
255  virtual void timeCentroid(casacore::Vector<double> & t) const;
256 
257  // Return nominal time interval
258 
259  virtual void timeInterval(casacore::Vector<double> & ti) const;
260 
261  // Return u,v and w (in meters)
262 
263  virtual void uvw(casacore::Matrix<double> & uvwmat) const;
264 
265  // Return the visibilities as found in the casacore::MS, casacore::Cube (npol,nchan,nrow).
266 
267  virtual void visibilityCorrected(
269  virtual void visibilityModel(casacore::Cube<casacore::Complex> & vis) const;
270  virtual void visibilityObserved(
272 
273  // Return FLOAT_DATA as a casacore::Cube (npol, nchan, nrow) if found in the MS.
274 
275  virtual void floatData(casacore::Cube<casacore::Float> & fcube) const;
276 
277  // Return the shape of the visibility Cube
278 
279  virtual casacore::IPosition visibilityShape() const;
280 
281  // Return weight
282 
283  virtual void weight(casacore::Matrix<casacore::Float> & wtmat) const;
284 
285  // Return weightspectrum (a weight for each channel)
286 
287  virtual void weightSpectrum(casacore::Cube<casacore::Float> & wtsp) const;
288  virtual void sigmaSpectrum(casacore::Cube<casacore::Float> & wtsp) const;
289 
290  // +=========================+
291  // | |
292  // | Chunk and casacore::MS Level casacore::Data |
293  // | |
294  // +=========================+
295 
297 
298 protected:
299 
300  FiltrationTVI(ViImplementation2 * inputVi, casacore::Record const &configuration);
301 
302 private:
303  // Filtration operation
304  // increment the iterator until given subchunk passes through the filter
305  void filter();
306  void filterChunk();
307 
309  Filter *filter_p;
312 
313  // boolean flag for each subchunk in the current chunk (True: valid, False: invalid)
315 
317 };
318 
319 // factory
321 
322 public:
323  // Constructor
324  FiltrationTVIFactory(casacore::Record const &configuration,
325  ViImplementation2 *inputVII);
326 // FiltrationTVIFactory(casacore::Record const &configuration,
327 // casacore::MeasurementSet const *ms, SortColumns const sortColumns,
328 // casacore::Double timeInterval, casacore::Bool isWritable);
329 
330  // Destructor
332 
333  ViImplementation2 * createVi() const;
334 
335 private:
338 };
339 
341 
342 public:
343  FiltrationTVILayerFactory(casacore::Record const &configuration);
345  }
346 
347 protected:
348 
350 
352 
353 };
354 
355 } // end namespace vi
356 
357 } //# NAMESPACE CASA - END
358 
359 #endif // _MSVIS_FILTRATIONTVI_H_
360 
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
FiltrationTVILayerFactory(casacore::Record const &configuration)
virtual void timeInterval(casacore::Vector< double > &ti) const
Return nominal time interval.
virtual void scan(casacore::Vector< casacore::Int > &scans) const
Return scan number.
int Int
Definition: aipstype.h:50
virtual void sigma(casacore::Matrix< casacore::Float > &sigmat) const
Return sigma.
virtual void flagCategory(casacore::Array< casacore::Bool > &flagCategories) const
Return flags for each polarization, channel, category, and row.
FilteringTypeEnum
Filtering type enum.
Definition: FiltrationTVI.h:59
virtual casacore::Int nRows() const
Return the number of rows in the current iteration FiltrationTVI may change the number of rows when g...
FiltrationTVI is an implementation of data filtering.
virtual void arrayIds(casacore::Vector< casacore::Int > &) const
Return the current ArrayId.
~FiltrationTVIFactory()
FiltrationTVIFactory(casacore::Record const &amp;configuration, casacore::MeasurementSet const *ms...
virtual void fieldIds(casacore::Vector< casacore::Int > &) const
Return the current FieldId.
FiltrationTVI(ViImplementation2 *inputVi, casacore::Record const &configuration)
virtual void sigmaSpectrum(casacore::Cube< casacore::Float > &wtsp) const
Return sgimaspectrum (a sigma for each channel)
virtual Type type()
Return the type enum.
Filtering type.
Definition: FiltrationTVI.h:56
virtual void processorId(casacore::Vector< casacore::Int > &procids) const
Return the PROCESSOR_IDs.
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 flagRow(casacore::Vector< casacore::Bool > &rowflags) const
Return row flag.
casacore::Vector< bool > is_valid_subchunk_p
boolean flag for each subchunk in the current chunk (True: valid, False: invalid) ...
virtual void dataDescriptionIds(casacore::Vector< casacore::Int > &) const
+=========================+ | | | Chunk and casacore::MS Level casacore::Data | | | +================...
virtual void exposure(casacore::Vector< double > &expo) const
Return actual time interval.
void filter()
Filtration operation increment the iterator until given subchunk passes through the filter...
casacore::Record configuration_p
virtual void spectralWindows(casacore::Vector< casacore::Int > &spws) const
Return current SpectralWindow.
virtual void originChunks(casacore::Bool forceRewind=false)
Methods to control chunk iterator.
virtual void antenna2(casacore::Vector< casacore::Int > &ant2) const
Return antenna2.
virtual void uvw(casacore::Matrix< double > &uvwmat) const
Return u,v and w (in meters)
virtual void nextChunk()
virtual void flag(casacore::Cube< casacore::Bool > &flags) const
Return flag for each polarization, channel and row.
ViImplementation2 * createVi() const
FiltrationTVIFactory(casacore::Record const &configuration, ViImplementation2 *inputVII)
Constructor.
Fast Square Matrix class with fixed (templated) size.
virtual void timeCentroid(casacore::Vector< double > &t) const
Return MJD centroid of interval.
casacore::Vector< casacore::Bool > is_filtrate_p
virtual void observationId(casacore::Vector< casacore::Int > &obsids) const
Return the OBSERVATION_IDs.
virtual void antenna1(casacore::Vector< casacore::Int > &ant1) const
+=========================+ | | | Subchunk casacore::Data Accessors | | | +=========================+...
virtual casacore::String ViiType() const
Report the the ViImplementation type.
virtual void stateId(casacore::Vector< casacore::Int > &stateids) const
Return the STATE_IDs.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
ViImplementation2 * getVii() const
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual casacore::IPosition visibilityShape() const
Return the shape of the visibility Cube.
virtual void weightSpectrum(casacore::Cube< casacore::Float > &wtsp) const
Return weightspectrum (a weight for each channel)
ViImplementation2 * inputVII_p
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
casacore::Record configuration_p
virtual void jonesC(casacore::Vector< casacore::SquareMatrix< casacore::Complex, 2 > > &cjones) const
Return feed configuration matrix for specified antenna.
ViImplementation2 * createInstance(ViImplementation2 *vii0) const
Make a ViImplementation with another as input Must be specialized for each type.
casacore::Int num_filtrates_p
virtual void weight(casacore::Matrix< casacore::Float > &wtmat) const
Return weight.
virtual void feed2(casacore::Vector< casacore::Int > &fd2) const
Return feed2.
virtual void time(casacore::Vector< double > &t) const
Return MJD midpoint of interval.
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
virtual casacore::String ViiType() const =0
Report the the ViImplementation type.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
static casacore::String toString(FilteringTypeEnum type)
Definition: FiltrationTVI.h:65
virtual ~FiltrationTVI()
Destructor.
virtual void visibilityModel(casacore::Cube< casacore::Complex > &vis) const
virtual void feed1(casacore::Vector< casacore::Int > &fd1) const
Return feed1.
virtual void visibilityCorrected(casacore::Cube< casacore::Complex > &vis) const
Return the visibilities as found in the casacore::MS, casacore::Cube (npol,nchan,nrow).
virtual void visibilityObserved(casacore::Cube< casacore::Complex > &vis) const
virtual void getRowIds(casacore::Vector< casacore::uInt > &rowids) const
Return the row ids as from the original root table.
virtual void origin()
+==================================+ | | | Iteration Control and Monitoring | | | +==================...
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42