casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UVContSubTVI.h
Go to the documentation of this file.
1 //# UVContSubTVI.h: This file contains the interface definition of the MSTransformManager class.
2 //#
3 //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
4 //# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved.
5 //# Copyright (C) European Southern Observatory, 2011, All rights reserved.
6 //#
7 //# This library is free software; you can redistribute it and/or
8 //# modify it under the terms of the GNU Lesser General Public
9 //# License as published by the Free software Foundation; either
10 //# version 2.1 of the License, or (at your option) any later version.
11 //#
12 //# This library is distributed in the hope that it will be useful,
13 //# but WITHOUT ANY WARRANTY, without even the implied warranty of
14 //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 //# Lesser General Public License for more details.
16 //#
17 //# You should have received a copy of the GNU Lesser General Public
18 //# License along with this library; if not, write to the Free Software
19 //# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 //# MA 02111-1307 USA
21 //# $Id: $
22 
23 #ifndef UVContSubTVI_H_
24 #define UVContSubTVI_H_
25 
26 // Base class
28 
29 // Fitting classes
33 
34 // OpenMP
35 #ifdef _OPENMP
36 #include <omp.h>
37 #endif
38 
39 using namespace casacore;
40 
41 
42 namespace casa { //# NAMESPACE CASA - BEGIN
43 
44 namespace vi { //# NAMESPACE VI - BEGIN
45 
47 // UVContSubTVI class
49 
50 class UVContSubTVI : public FreqAxisTVI
51 {
52 
53 public:
54 
55  UVContSubTVI( ViImplementation2 * inputVii,
56  const Record &configuration);
57 
58  ~UVContSubTVI();
59 
60  // Report the the ViImplementation type
61  virtual String ViiType() const { return String("UVContSub( ")+getVii()->ViiType()+" )"; };
62 
63  virtual void floatData (Cube<Float> & vis) const;
64  virtual void visibilityObserved (Cube<Complex> & vis) const;
65  virtual void visibilityCorrected (Cube<Complex> & vis) const;
66  virtual void visibilityModel (Cube<Complex> & vis) const;
67 
68 protected:
69 
70  bool parseConfiguration(const Record &configuration);
71  void initialize();
72 
73  template<class T> void transformDataCube( const Cube<T> &inputVis,
74  const Cube<Float> &inputWeight,
75  Cube<T> &outputVis) const;
76 
77  template<class T> void transformDataCore( denoising::GslPolynomialModel<Double>* model,
78  Vector<Bool> *lineFreeChannelMask,
79  const Cube<T> &inputVis,
80  const Cube<Bool> &inputFlags,
81  const Cube<Float> &inputWeight,
82  Cube<T> &outputVis,
83  Int parallelCorrAxis=-1) const;
84  mutable uInt fitOrder_p;
85  mutable Bool want_cont_p;
86  mutable String fitspw_p;
88  mutable uInt nThreads_p;
89  mutable uInt niter_p;
90  mutable map<Int,Vector<Bool> > lineFreeChannelMaskMap_p;
91 
92  mutable map<Int, denoising::GslPolynomialModel<Double>* > inputFrequencyMap_p;
93 };
94 
96 // UVContSubTVIFactory class
98 
99 class UVContSubTVIFactory : public ViFactory
100 {
101 
102 public:
103 
104  UVContSubTVIFactory(Record &configuration,ViImplementation2 *inputVII);
105 
106 protected:
107 
108  vi::ViImplementation2 * createVi (VisibilityIterator2 *) const;
109  vi::ViImplementation2 * createVi () const;
110 
113 };
114 
116 // UVContSubTVILayerFactory class (for _recursive_ layering)
118 
120 {
121 
122 public:
123 
124  UVContSubTVILayerFactory(Record &configuration);
126 
127 protected:
128 
130 
132 
133 };
134 
136 // UVContSubTransformEngine class
138 
139 template<class T> class UVContSubKernel; // Forward declaration
140 
141 template<class T> class UVContSubTransformEngine : public FreqAxisTransformEngine2<T>
142 {
146 
147 public:
148 
150  DataCubeMap *inputData,
151  DataCubeMap *outputData );
152 
153  void transform();
154 
155  void transformCore(DataCubeMap *inputData,DataCubeMap *outputData);
156 
157 protected:
158 
159  // This member has to be a pointer, otherwise there
160  // are compile time problems due to the fact that
161  // it is a pure virtual class.
163 };
164 
166 // UVContSubKernel class
168 
169 template<class T> class UVContSubKernel
170 {
171 
172 public:
173 
175  Vector<Bool> *lineFreeChannelMask);
176 
177  virtual void kernel(DataCubeMap *inputData,
178  DataCubeMap *outputData);
179 
180  virtual void changeFitOrder(size_t order) = 0;
181 
182  virtual void defaultKernel( Vector<T> &inputVector,
183  Vector<T> &outputVector) = 0;
184 
185  virtual void kernelCore(Vector<T> &inputVector,
186  Vector<Bool> &inputFlags,
187  Vector<Float> &inputWeights,
188  Vector<T> &outputVector) = 0;
189 
190  void setDebug(Bool debug) { debug_p = debug;}
191 
192 protected:
193 
195  size_t fitOrder_p;
200 };
201 
203 // UVContSubtractionKernel class
205 
206 template<class T> class UVContSubtractionKernel : public UVContSubKernel<T>
207 {
214 
215 
216 public:
217 
219  Vector<Bool> *lineFreeChannelMask=NULL);
220 
221  void changeFitOrder(size_t order);
222 
223  void defaultKernel( Vector<Complex> &inputVector,
224  Vector<Complex> &outputVector);
225 
226  void defaultKernel( Vector<Float> &inputVector,
227  Vector<Float> &outputVector);
228 
229  void kernelCore( Vector<Complex> &inputVector,
230  Vector<Bool> &inputFlags,
231  Vector<Float> &inputWeights,
232  Vector<Complex> &outputVector);
233 
234  void kernelCore( Vector<Float> &inputVector,
235  Vector<Bool> &inputFlags,
236  Vector<Float> &inputWeights,
237  Vector<Float> &outputVector);
238 
239 private:
240 
242 };
243 
245 // UVContEstimationKernel class
247 
248 template<class T> class UVContEstimationKernel : public UVContSubKernel<T>
249 {
250 
257 
258 public:
259 
261  Vector<Bool> *lineFreeChannelMask=NULL);
262 
263  void changeFitOrder(size_t order);
264 
265  void defaultKernel( Vector<Complex> &inputVector,
266  Vector<Complex> &outputVector);
267 
268  void defaultKernel( Vector<Float> &inputVector,
269  Vector<Float> &outputVector);
270 
271  void kernelCore( Vector<Complex> &inputVector,
272  Vector<Bool> &inputFlags,
273  Vector<Float> &inputWeights,
274  Vector<Complex> &outputVector);
275 
276  void kernelCore( Vector<Float> &inputVector,
277  Vector<Bool> &inputFlags,
278  Vector<Float> &inputWeights,
279  Vector<Float> &outputVector);
280 
281 private:
282 
284 };
285 
287 // UVContSubtractionDenoisingKernel class
289 
290 template<class T> class UVContSubtractionDenoisingKernel : public UVContSubKernel<T>
291 {
298 
299 
300 public:
301 
303  size_t nIter,
304  Vector<Bool> *lineFreeChannelMask=NULL);
305 
306  void changeFitOrder(size_t order);
307 
308  void defaultKernel( Vector<T> &inputVector,
309  Vector<T> &outputVector);
310 
311  void kernelCore( Vector<T> &inputVector,
312  Vector<Bool> &inputFlags,
313  Vector<Float> &inputWeights,
314  Vector<T> &outputVector);
315 
316 private:
317 
319 };
320 
322 // UVContEstimationDenoisingKernel class
324 
325 template<class T> class UVContEstimationDenoisingKernel : public UVContSubKernel<T>
326 {
327 
334 
335 public:
336 
338  size_t nIter,
339  Vector<Bool> *lineFreeChannelMask=NULL);
340 
341  void changeFitOrder(size_t order);
342 
343  void defaultKernel( Vector<T> &inputVector,
344  Vector<T> &outputVector);
345 
346  void kernelCore( Vector<T> &inputVector,
347  Vector<Bool> &inputFlags,
348  Vector<Float> &inputWeights,
349  Vector<T> &outputVector);
350 
351 private:
352 
354 };
355 
356 
357 
358 } //# NAMESPACE VI - END
359 
360 } //# NAMESPACE CASA - END
361 
362 #endif /* UVContSubTVI_H_ */
363 
int Int
Definition: aipstype.h:50
denoising::IterativelyReweightedLeastSquares fitter_p
Definition: UVContSubTVI.h:353
LinearFitSVD< Float > fitter_p
Definition: UVContSubTVI.h:241
Matrix< Double > freqPows_p
Definition: UVContSubTVI.h:197
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
denoising::IterativelyReweightedLeastSquares fitter_p
Definition: UVContSubTVI.h:318
virtual ViImplementation2 * createInstance(ViImplementation2 *vii0) const
VisibilityIteratorImpl2-specific layer-creater.
A 3-D Specialization of the Array class.
void setDebug(Bool debug)
Definition: UVContSubTVI.h:190
denoising::GslPolynomialModel< Double > * model_p
Definition: UVContSubTVI.h:196
Vector< Bool > * lineFreeChannelMask_p
Definition: UVContSubTVI.h:199
UVContSubTransformEngine class template< class T > class UVContSubKernel
Definition: UVContSubTVI.h:136
map< Int, Vector< Bool > > lineFreeChannelMaskMap_p
Definition: UVContSubTVI.h:90
map< Int, denoising::GslPolynomialModel< Double > * > inputFrequencyMap_p
Definition: UVContSubTVI.h:92
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
LinearFitSVD< Float > fitter_p
Definition: UVContSubTVI.h:283
Vector< Float > frequencies_p
Definition: UVContSubTVI.h:198
bool debug
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
UVContSubKernel< T > * uvContSubKernel_p
This member has to be a pointer, otherwise there are compile time problems due to the fact that it is...
Definition: UVContSubTVI.h:162
ViImplementation2 * inputVii_p
Definition: UVContSubTVI.h:112
String: the storage and methods of handling collections of characters.
Definition: String.h:223
virtual String ViiType() const
Report the the ViImplementation type.
Definition: UVContSubTVI.h:61
unsigned int uInt
Definition: aipstype.h:51
transform(a.begin(), a.end(), std::ostream_iterator< int >(cout,"\n"), compose(unary(h), compose(unary(f), unary(f))))
Global Functions.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42