casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RegriddingTVI.h
Go to the documentation of this file.
1 //# RegriddingTVI.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 RegriddingTVI_H_
24 #define RegriddingTVI_H_
25 
26 // Base class
28 
29 // To handle variant parameters
31 
32 // casacore::MS Access
33 #include <ms/MeasurementSets.h>
34 
35 // To get observatory position from observatory name
37 
38 // calcChanFreqs
40 
41 // 1d interpolation methods
43 
44 namespace casa { //# NAMESPACE CASA - BEGIN
45 
46 namespace vi { //# NAMESPACE VI - BEGIN
47 
49 // Enumerations (see equivalences in InterpolateArray1D.h)
51 
53  // nearest neighbour
55  // linear
57  // cubic
59  // cubic spline
61  // fft shift
63  };
64 
66 
68 // RegriddingTVI class
70 
71 class RegriddingTVI : public FreqAxisTVI
72 {
73 
74 public:
75 
76  RegriddingTVI( ViImplementation2 * inputVii,
77  const casacore::Record &configuration);
78 
79  // Report the the ViImplementation type
80  virtual casacore::String ViiType() const { return casacore::String("Regridding( ")+getVii()->ViiType()+" )"; };
81 
82  // Navigation methods
83  void origin ();
84 
85  // Frequency specification methods
86  casacore::Int getReportingFrameOfReference () const; // Used by VisBufferImpl2 to determine default ref. frame
88  casacore::Int spectralWindowId, casacore::Int msId) const;
89  // casacore::Data accessors
90  void flag(casacore::Cube<casacore::Bool>& flagCube) const;
91  void floatData (casacore::Cube<casacore::Float> & vis) const;
95  void weightSpectrum(casacore::Cube<casacore::Float> &weightSp) const;
96  void sigmaSpectrum (casacore::Cube<casacore::Float> &sigmaSp) const;
97 
98  bool weightSpectrumExists () const {return true;}
99  bool sigmaSpectrumExists () const {return true;}
100 
101 protected:
102 
103  casacore::Bool parseConfiguration(const casacore::Record &configuration);
104  void initialize();
105 
106  void initFrequencyGrid();
108 
109  template<class T> void transformDataCube( const casacore::Cube<T> &inputVis,
110  casacore::Cube<T> &outputVis) const;
111 
112  int nChan_p;
122 
126 
133 
136 
139 
142 
143  mutable map<casacore::Int,casacore::Float> weightFactorMap_p;
144  mutable map<casacore::Int,casacore::Float> sigmaFactorMap_p;
146 };
147 
148 
150 // RegriddingTVIFactory class
152 
153 class RegriddingTVIFactory : public ViFactory
154 {
155 
156 public:
157 
158  RegriddingTVIFactory(casacore::Record &configuration,ViImplementation2 *inputVII);
159 
160 protected:
161 
163  vi::ViImplementation2 * createVi () const;
164 
167 };
168 
170 // RegriddingTVILayerFactory class (for _recursive_ layering)
172 
174 {
175 
176 public:
177 
179 
181 
182 protected:
183 
184 
185  virtual ViImplementation2 * createInstance(ViImplementation2* vii0) const;
186 
188 
189 };
190 
192 // RegriddingTransformEngine class
194 
195 template<class T> class RegriddingKernel; // Forward declaration
196 
197 template<class T> class RegriddingTransformEngine : public FreqAxisTransformEngine2<T>
198 {
199 
202 
203 public:
204 
206  DataCubeMap *inputData,
207  DataCubeMap *outputData);
208 
209  void transform();
210 
211 protected:
212 
213  // This member has to be a pointer, otherwise there
214  // are compile time problems due to the fact that
215  // it is a pure virtual class.
217 };
218 
220 // RegriddingKernel class
222 
223 template<class T> class RegriddingKernel
224 {
225 
226 public:
227 
229  virtual void kernel(DataCubeMap *inputData,DataCubeMap *outputData) = 0;
230  virtual ~RegriddingKernel() {}
231 
232 protected:
233 
238 
243 
248 
249 };
250 
252 // DataInterpolationKernel class
254 
255 template<class T> class DataInterpolationKernel : public RegriddingKernel<T>
256 {
261 
262 public:
263 
264  DataInterpolationKernel( casacore::uInt interpolationMethod,
267 
269 
270  void kernel(DataCubeMap *inputData,DataCubeMap *outputData);
271 
272 protected:
273 
277 };
278 
280 // FlagFFTKernel class
282 
283 template<class T> class DataFFTKernel : public RegriddingKernel<T>
284 {
289 
290 public:
291 
293 
295 
296  void kernel(DataCubeMap *inputData,DataCubeMap *outputData);
297 
298 protected:
299 
300  void fftshift( casacore::Vector<casacore::Complex> &inputDataVector,
301  casacore::Vector<casacore::Bool> &inputFlagVector,
302  casacore::Vector<casacore::Complex> &outputDataVector,
303  casacore::Vector<casacore::Bool> &outputFlagVector);
304 
305  void fftshift( casacore::Vector<casacore::Float> &inputDataVector,
306  casacore::Vector<casacore::Bool> &inputFlagVector,
307  casacore::Vector<casacore::Float> &outputDataVector,
308  casacore::Vector<casacore::Bool> &outputFlagVector);
309 
310 
313 };
314 
315 } //# NAMESPACE VI - END
316 
317 } //# NAMESPACE CASA - END
318 
319 #endif /* RegriddingTVI_H_ */
320 
map< casacore::Int, casacore::Float > sigmaFactorMap_p
RegriddingTVI(ViImplementation2 *inputVii, const casacore::Record &configuration)
A Measure: astronomical direction.
Definition: MDirection.h:174
casac::variant * phaseCenterPar_p
casacore::Vector< casacore::Double > * inputFreq_p
casacore::MSFieldColumns * inputMSFieldCols_p
A Measure: position on Earth.
Definition: MPosition.h:79
int Int
Definition: aipstype.h:50
casacore::MRadialVelocity radialVelocity_p
void visibilityModel(casacore::Cube< casacore::Complex > &vis) const
casacore::FFTServer< casacore::Float, casacore::Complex > fFFTServer_p
casacore::uInt regriddingMethod_p
const casacore::Record configuration_p
casacore::Double fftShift_p
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
casacore::Bool radialVelocityCorrection_p
casacore::Vector< casacore::Bool > & getOutputFlagVector(DataCubeMap *outputData)
casacore::Vector< casacore::Bool > & getInputFlagVector(DataCubeMap *inputData)
virtual void time(casacore::Vector< double > &t) const override
Return MJD midpoint of interval.
void transformDataCube(const casacore::Cube< T > &inputVis, casacore::Cube< T > &outputVis) const
cubic spline
Definition: RegriddingTVI.h:60
casacore::Int getReportingFrameOfReference() const
Frequency specification methods.
casacore::Bool refFrameTransformation_p
virtual ViImplementation2 * createInstance(ViImplementation2 *vii0) const
Make a ViImplementation with another as input Must be specialized for each type.
map< casacore::Int, casacore::Float > weightFactorMap_p
casacore::Vector< T > & getOutputDataVector(DataCubeMap *outputData)
map< casacore::uInt, pair< spwInfo, spwInfo > > inputOutputSpwMap
casacore::MPosition observatoryPosition_p
void kernel(DataCubeMap *inputData, DataCubeMap *outputData)
void sigmaSpectrum(casacore::Cube< casacore::Float > &sigmaSp) const
Return sgimaspectrum (a sigma for each channel)
casacore::MDirection phaseCenter_p
A Measure: radial velocity.
inputOutputSpwMap inputOutputSpwMap_p
void initFrequencyTransformationEngine() const
virtual void kernel(DataCubeMap *inputData, DataCubeMap *outputData)=0
ViImplementation2 * inputVii_p
casacore::String width_p
A Measure: instant in time.
Definition: MEpoch.h:104
casacore::String start_p
casacore::Record configuration_p
void visibilityObserved(casacore::Cube< casacore::Complex > &vis) const
nearest neighbour
Definition: RegriddingTVI.h:54
casacore::Vector< T > outputDummyDataVector_p
virtual casacore::String ViiType() const
Report the the ViImplementation type.
Definition: RegriddingTVI.h:80
A class to provide easy read-write access to MSField columns.
defines physical units
Definition: Unit.h:189
RegriddingTVIFactory(casacore::Record &configuration, ViImplementation2 *inputVII)
casacore::FFTServer< casacore::Float, casacore::Complex > fFFTServer_p
casacore::Vector< casacore::Double > getFrequencies(casacore::Double time, casacore::Int frameOfReference, casacore::Int spectralWindowId, casacore::Int msId) const
casacore::uInt freqTransEngineRowId_p
bool sigmaSpectrumExists() const
Determine whether SIGMA_SPECTRUM exists.
Definition: RegriddingTVI.h:99
casacore::String interpolationMethodPar_p
casacore::MFrequency::Types inputReferenceFrame_p
casacore::Double fftShift_p
casacore::Vector< T > & getInputDataVector(DataCubeMap *inputData)
DataFFTKernel(casacore::Double fftShift)
double Double
Definition: aipstype.h:55
RegriddingKernel< T > * regriddingKernel_p
This member has to be a pointer, otherwise there are compile time problems due to the fact that it is...
A class to provide easy read-only access to MeasurementSet columns.
Definition: MSColumns.h:111
RegriddingTVILayerFactory(casacore::Record &configuration)
const casacore::Unit Hz(casacore::String("Hz"))
void weightSpectrum(casacore::Cube< casacore::Float > &weightSp) const
Return weightspectrum (a weight for each channel)
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
bool weightSpectrumExists() const
Determine whether WEIGHT_SPECTRUM exists.
Definition: RegriddingTVI.h:98
casacore::Vector< casacore::Bool > inputDummyFlagVector_p
casacore::Vector< casacore::Double > * outputFreq_p
void fftshift(casacore::Vector< casacore::Complex > &inputDataVector, casacore::Vector< casacore::Bool > &inputFlagVector, casacore::Vector< casacore::Complex > &outputDataVector, casacore::Vector< casacore::Bool > &outputFlagVector)
void flag(casacore::Cube< casacore::Bool > &flagCube) const
casacore::Data accessors
void floatData(casacore::Cube< casacore::Float > &vis) const
Return FLOAT_DATA as a casacore::Cube (npol, nchan, nrow) if found in the MS.
casacore::Bool outputDummyDataVectorInitialized_p
void visibilityCorrected(casacore::Cube< casacore::Complex > &vis) const
Return the visibilities as found in the casacore::MS, casacore::Cube (npol,nchan,nrow).
DataInterpolationKernel(casacore::uInt interpolationMethod, casacore::Vector< casacore::Double > *inputFreq, casacore::Vector< casacore::Double > *outputFreq)
casacore::Bool inputDummyFlagVectorInitialized_p
casacore::Bool parseConfiguration(const casacore::Record &configuration)
void kernel(DataCubeMap *inputData, DataCubeMap *outputData)
casacore::String outputReferenceFramePar_p
casacore::MEpoch referenceTime_p
casacore::ROMSColumns * selectedInputMsCols_p
casacore::String restFrequency_p
casacore::Vector< casacore::Bool > outputDummyFlagVector_p
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
casacore::String velocityType_p
virtual casacore::String ViiType() const =0
Report the the ViImplementation type.
casacore::Bool outputDummyFlagVectorInitialized_p
vi::ViImplementation2 * createVi() const
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::String mode_p
casacore::MFrequency::Types outputReferenceFrame_p
RegriddingTransformEngine(RegriddingKernel< T > *kernel, DataCubeMap *inputData, DataCubeMap *outputData)
casacore::Vector< T > inputDummyDataVector_p
casacore::MFrequency::Convert freqTransEngine_p
void origin()
Navigation methods.
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
casacore::Bool radialVelocityCorrectionSignificant_p
virtual casacore::Int msId() const override
reference to actual ms in interator
casacore::Bool inputDummyDataVectorInitialized_p
unsigned int uInt
Definition: aipstype.h:51