casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSTransformBufferImpl.h
Go to the documentation of this file.
1 //# MSTransformBufferImpl.h: This file contains the interface definition of the MSTransformBufferImpl.h 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 MSTransformBufferImpl_H_
24 #define MSTransformBufferImpl_H_
25 
26 // Where VisBufferImpl2 interface is defined
28 
29 // Class containing the actual transformation logic
31 
32 namespace casa {
33 
35 {
36 
37 public:
38 
40  virtual ~DataCubeHolderBase() {}
41  virtual void setMatrixIndex(casacore::uInt matrixIndex) = 0;
42  virtual void setVectorIndex(casacore::uInt vectorIndex) = 0;
47 
48 protected:
49 
54 };
55 
56 template <class T> class DataCubeHolder : public DataCubeHolderBase
57 {
58 
59 public:
60 
61  DataCubeHolder(casacore::Cube<T> &dataCube) {cube_p.reference(dataCube);}
63 
66 
67  void setMatrixIndex(casacore::uInt matrixIndex)
68  {
69  matrix_p.resize(); // Resize to 0 to avoid shape conformance problems
70  matrixIndex_p = matrixIndex;
71  matrix_p.reference(cube_p.xyPlane(matrixIndex));
72  matrixShape_p = matrix_p.shape();
73  }
74 
75  void setVectorIndex(casacore::uInt vectorIndex)
76  {
77  vector_p.resize(); // Resize to 0 to avoid shape conformance problems
78  vectorIndex_p = vectorIndex;
79  vector_p.reference(matrix_p.row(vectorIndex));
80  vectorShape_p = vector_p.shape();
81  }
82 
83 protected:
84 
88 };
89 
91 {
92 
93 public:
94 
97 
98  void add(casacore::MS::PredefinedColumns key,DataCubeHolderBase* dataCubeHolder){dataCubeMap_p[key] = dataCubeHolder;}
99 
100  void setWindowShape(casacore::IPosition windowShape) {windowShape_p = windowShape;}
102 
104  {
105  DataCubeHolder<T> *flagCubeHolder = static_cast< DataCubeHolder<T>* >(dataCubeMap_p[key]);
106  return flagCubeHolder->getVector();
107  }
108 
110  {
111  DataCubeHolder<T> *flagCubeHolder = static_cast< DataCubeHolder<T>* >(dataCubeMap_p[key]);
112  return flagCubeHolder->getVector();
113  }
114 
116  {
118  {
119  dataCubeMapIter_p->second->setMatrixIndex(rowIndex);
120  }
121  }
122 
123  void setVectorIndex(casacore::uInt vectorIndex)
124  {
126  {
127  dataCubeMapIter_p->second->setVectorIndex(vectorIndex);
128  }
129  }
130 
132  {
133  return dataCubeMap_p.begin()->second->getMatrixShape();
134  }
135 
137  {
138  return dataCubeMap_p.begin()->second->getVectorShape();
139  }
140 
141 
142 protected:
143 
145  std::map<casacore::MS::PredefinedColumns, DataCubeHolderBase*> dataCubeMap_p;
146  std::map<casacore::MS::PredefinedColumns, DataCubeHolderBase*>::iterator dataCubeMapIter_p;
147 };
148 
150  DataCubeMap &inputDataMap,
151  DataCubeMap &outputDataMap) const;
152 
154  DataCubeMap &inputDataMap,
155  DataCubeMap &outputDataMap,
156  casacore::IPosition &inputPos,
157  casacore::IPosition &outputPos,
158  casacore::IPosition &kernelShape) const;
159 
161  DataCubeMap &inputDataMap,
162  DataCubeMap &outputDataMap,
163  casacore::uInt &inputPos,
164  casacore::uInt &outputPos,
165  casacore::uInt &kernelSize) const;
166 
168 {
169 
170 public:
171 
174 
175  void resetState();
176  void setRowIdOffset(casacore::uInt rowOffset) {rowIdOffset_p = rowOffset;}
178 
179  void generateWeights() const;
180 
181  // Re-indexable Vectors
182  const casacore::Vector<casacore::Int> & dataDescriptionIds () const; // [nR]
183  const casacore::Vector<casacore::Int> & spectralWindows () const; // [nR]
184  const casacore::Vector<casacore::Int> & observationId () const; // [nR]
185  const casacore::Vector<casacore::Int> & arrayId () const; // [nR]
186  const casacore::Vector<casacore::Int> & fieldId () const; // [nR]
187  const casacore::Vector<casacore::Int> & stateId () const; // [nR]
188  const casacore::Vector<casacore::Int> & antenna1 () const; // [nR]
189  const casacore::Vector<casacore::Int> & antenna2 () const; // [nR]
190 
191  // Not-Re-indexable Vectors
192  const casacore::Vector<casacore::Int> & scan () const; // [nR]
193  const casacore::Vector<casacore::Int> & processorId () const; // [nR]
194  const casacore::Vector<casacore::Int> & feed1 () const; // [nR]
195  const casacore::Vector<casacore::Int> & feed2 () const; // [nR]
196  const casacore::Vector<casacore::Double> & time () const; // [nR]
197  const casacore::Vector<casacore::Double> & timeCentroid () const; // [nR]
198  const casacore::Vector<casacore::Double> & timeInterval () const; // [nR]
199 
200  // Average-able vectors
201  const casacore::Vector<casacore::Double> & exposure () const; // [nR]
202  const casacore::Vector<casacore::Bool> & flagRow () const; // [nR]
203 
204  const casacore::Matrix<casacore::Double> & uvw () const; // [3,nR]
205  const casacore::Matrix<casacore::Float> & weight () const; // [nC, nR]
206  const casacore::Matrix<casacore::Float> & sigma () const; // [nC, nR]
207  const casacore::Cube<casacore::Bool> & flagCube () const; // [nC,nF,nR]
208  const casacore::Cube<casacore::Complex> & visCube () const; // [nC,nF,nR]
209  const casacore::Cube<casacore::Complex> & visCubeCorrected () const; // [nC,nF,nR]
210  const casacore::Cube<casacore::Complex> & visCubeModel () const; // [nC,nF,nR]
211  const casacore::Cube<casacore::Float> & visCubeFloat () const; // [nC,nF,nR]
212  const casacore::Cube<casacore::Float> & weightSpectrum () const; // [nC,nF,nR]
213  const casacore::Cube<casacore::Float> & sigmaSpectrum () const; // [nC,nF,nR]
214  const casacore::Array<casacore::Bool> & flagCategory () const; // [nC,nF,nCategories,nR]
215 
216  casacore::IPosition getShape () const;
217  casacore::Int nRows () const;
218  casacore::Int nChannels () const;
219  casacore::Int nCorrelations () const;
220  casacore::Int nAntennas () const;
221 
222  // For plotms
230 
235 
236  casacore::Double getFrequency (casacore::Int rowInBuffer, casacore::Int frequencyIndex, casacore::Int frame = FrameNotSpecified) const;
238  casacore::Int getChannelNumber (casacore::Int rowInBuffer, casacore::Int frequencyIndex) const;
241 
242  const casacore::Vector<casacore::uInt> & rowIds () const;
243 
244  // Rotate visibility phase for given vector (dim = nrow of vb) of phases (metres)
246  // Rotate visibility phase for phase center offsets (arcsecs)
248 
249  const casacore::MDirection& phaseCenter () const;
251 
252 protected:
253 
255 
257  DataCubeMap &inputDataCubeMap,
258  DataCubeMap &outputDataCubeMap,
259  TransformFunction funcPointer) const;
260 
261  void channelAverage( vi::VisBuffer2 *vb,
262  DataCubeMap &inputDataCubeMap,
263  DataCubeMap &outputDataCubeMap) const;
264 
266  DataCubeMap &inputDataCubeMap,
267  DataCubeMap &outputDataCubeMap,
268  TransformKernel1D kernelPointer) const;
269 
271  DataCubeMap &inputDataCubeMap,
272  DataCubeMap &outputDataCubeMap,
273  casacore::uInt &inputPos,
274  casacore::uInt &outputPos,
275  casacore::uInt &kernelSize) const;
276 
277 private:
278 
281  map<casacore::uInt,casacore::uInt> inputOutputSPWIndexMap_p;
283 
284  // OTF frequency transformation
288 
289  // Phase shifting
292 
293  // NONE datacol handling
295 
329  mutable map< casacore::Int,casacore::Vector<casacore::Int> > outputInputChannelMap_p;
337 
379 
406 
407 };
408 
409 } //# NAMESPACE CASA - END
410 
411 
412 #endif /* MSTransformBufferImpl_H_ */
413 
A Vector of integers, for indexing into Array&lt;T&gt; objects.
Definition: IPosition.h:119
casacore::Vector< casacore::Bool > flagRow_p
void setVectorIndex(casacore::uInt vectorIndex)
const casacore::MDirection & phaseCenter() const
Returns the phase center of the array for the specified row.
casacore::IPosition & getVectorShape()
A Measure: astronomical direction.
Definition: MDirection.h:174
casacore::Vector< casacore::Stokes::StokesTypes > getCorrelationTypesDefined() const
casacore::Float parang0(casacore::Double time) const
NOMINAL parallactic angle (feed p.a.
A 1-D Specialization of the Array class.
casacore::Matrix< T > matrix_p
casacore::Cube< casacore::Bool > flagCube_p
A Measure: position on Earth.
Definition: MPosition.h:79
int Int
Definition: aipstype.h:50
casacore::Vector< casacore::Int > spectralWindows_p
const casacore::Cube< casacore::Bool > & flagCube() const
const casacore::Vector< casacore::Double > & exposure() const
Average-able vectors.
casacore::Vector< casacore::Int > getCorrelationTypes() const
casacore::MPosition observatoryPosition_p
const casacore::Vector< casacore::Int > & antenna1() const
casacore::IPosition vectorShape_p
Definition: UtilsTVI.h:81
map< casacore::Int, casacore::Vector< casacore::Int > > outputInputChannelMap_p
const casacore::Vector< casacore::Int > & feed1() const
casacore::Cube< T > cube_p
Definition: UtilsTVI.h:192
casacore::Array< casacore::Bool > flagCategory_p
casacore::Vector< casacore::Double > timeInterval_p
void add(casacore::MS::PredefinedColumns key, DataCubeHolderBase *dataCubeHolder)
const casacore::Vector< casacore::Int > & correlationTypes() const
Returns the correlation type of each correlation in the VisCube.
casacore::Vector< casacore::Double > time_p
casacore::Vector< casacore::Double > timeCentroid_p
casacore::Int nRows() const
Returns the number of rows in this VisBuffer.
const casacore::Cube< casacore::Float > & sigmaSpectrum() const
casacore::IPosition & getMatrixShape()
casacore::ArrayMeasColumn< casacore::MFrequency > spwRefRame_p
const casacore::Vector< casacore::Double > & getFrequencies(casacore::Int rowInBuffer, casacore::Int frame=FrameNotSpecified) const
const casacore::Cube< casacore::Complex > & visCubeModel() const
DataCubeHolder(casacore::Cube< T > &dataCube)
casacore::ArrayColumn< casacore::Double > spwFrequencies_p
casacore::MFrequency::Convert generateFreqRefTranEngine(casacore::Double time, casacore::Int outputRefFrame, casacore::Bool toObservedFrame) const
TableExprNode phase(const TableExprNode &node)
The phase (i.e.
Definition: ExprNode.h:1405
casacore::Vector< casacore::Int > fieldId_p
casacore::Matrix< T > matrix_p
Definition: UtilsTVI.h:193
casacore::Vector< casacore::Int > scan_p
casacore::uInt matrixIndex_p
Definition: UtilsTVI.h:77
A 3-D Specialization of the Array class.
const casacore::Cube< casacore::Float > & weightSpectrum() const
virtual const casacore::Matrix&lt;casacore::Float&gt; &amp; weightMat () const = 0; // [nC,nR] virtual void set...
std::map< casacore::MS::PredefinedColumns, DataCubeHolderBase * >::iterator dataCubeMapIter_p
void flagAverageKernel(vi::VisBuffer2 *vb, DataCubeMap &inputDataCubeMap, DataCubeMap &outputDataCubeMap, casacore::uInt &inputPos, casacore::uInt &outputPos, casacore::uInt &kernelSize) const
A 2-D Specialization of the Array class.
casacore::MFrequency::Types freqRefFrameType_p
casacore::Vector< casacore::MDirection > azel_p
PredefinedColumns
The Main table colums with predefined meaning.
Definition: MSMainEnums.h:65
casacore::Int getChannelNumber(casacore::Int rowInBuffer, casacore::Int frequencyIndex) const
casacore::Vector< casacore::Int > arrayId_p
const casacore::Matrix< casacore::Double > & uvw() const
const casacore::Array< casacore::Bool > & flagCategory() const
virtual const casacore::Matrix&lt;casacore::Bool&gt; &amp; flag () const; virtual void setFlag (const casacore:...
casacore::Vector< casacore::Int > antenna2_p
casacore::IPosition getShape() const
const casacore::Vector< casacore::MDirection > & direction1() const
const casacore::Vector< casacore::Int > & feed2() const
casacore::Vector< casacore::Int > getChannelNumbersSelected(casacore::Int outputChannelIndex) const
void decimationWindow(vi::VisBuffer2 *vb, DataCubeMap &inputDataCubeMap, DataCubeMap &outputDataCubeMap, TransformKernel1D kernelPointer) const
casacore::MDirection azel0(casacore::Double time) const
const casacore::Vector< casacore::MDirection > & azel(casacore::Double time) const
Returns the pointing angle for each antenna in the array at the specified time.
casacore::MDirection phaseCenter_p
OTF frequency transformation.
casacore::IPosition matrixShape_p
Definition: UtilsTVI.h:80
casacore::Matrix< casacore::Float > sigma_p
casacore::Matrix< T > & getMatrix()
casacore::Vector< casacore::Int > observationId_p
void setMatrixIndex(casacore::uInt rowIndex)
const casacore::Vector< casacore::Double > & timeCentroid() const
casacore::Vector< T > & getVector(casacore::MS::PredefinedColumns key)
void setVectorIndex(casacore::uInt vectorIndex)
casacore::Vector< casacore::Int > antenna1_p
const casacore::Cube< casacore::Complex > & visCubeCorrected() const
virtual const casacore::Matrix&lt;CStokesVector&gt; &amp; vis () const = 0; // [nF,nR] virtual void setVis (cas...
const casacore::Vector< casacore::Int > & fieldId() const
const casacore::Cube< casacore::Float > & visCubeFloat() const
virtual const casacore::Matrix&lt;CStokesVector&gt; &amp; visCorrected () const; virtual void setVisCorrected (...
void phaseCenterShift(const casacore::Vector< casacore::Double > &phase)
Rotate visibility phase for given vector (dim = nrow of vb) of phases (metres)
casacore::Matrix< casacore::Float > weight_p
const casacore::Vector< casacore::Int > & spectralWindows() const
virtual const casacore::Matrix&lt;casacore::Float&gt; &amp; sigmaMat () const; virtual casacore::Int spectralWi...
void(casa::MSTransformBufferImpl::* TransformFunction)(vi::VisBuffer2 *vb, DataCubeMap &inputDataMap, DataCubeMap &outputDataMap) const
casacore::Vector< casacore::Double > exposure_p
const casacore::Vector< casacore::Int > & stateId() const
virtual const casacore::Matrix&lt;casacore::Float&gt; &amp; sigmaMat () const = 0; // [nC,nR] ...
virtual void setMatrixIndex(casacore::uInt matrixIndex)=0
double Double
Definition: aipstype.h:55
std::map< casacore::MS::PredefinedColumns, DataCubeHolderBase * >::iterator dataCubeMapIter_p
Definition: UtilsTVI.h:252
casacore::Int nChannels() const
const casacore::MFrequency::Types & freqRefFrameType() const
casacore::Bool applyPhaseShifting_p
Phase shifting.
const casacore::Vector< casacore::Int > & arrayId() const
casacore::Vector< casacore::Float > parang_p
const casacore::Vector< casacore::Int > & antenna2() const
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void setWindowShape(casacore::IPosition windowShape)
casacore::Vector< casacore::Int > dataDescriptionIds_p
casacore::Cube< T > cube_p
void setRowIdOffset(casacore::uInt rowOffset)
std::map< casacore::MS::PredefinedColumns, DataCubeHolderBase * > dataCubeMap_p
Definition: UtilsTVI.h:251
casacore::Int nCorrelations() const
Returns the number of correlations along the visCube correlation axis.
casacore::IPosition vectorShape_p
float Float
Definition: aipstype.h:54
const casacore::Vector< casacore::Bool > & flagRow() const
MSTransformBufferImpl(MSTransformManager *manager)
casacore::Vector< casacore::Int > feed1_p
void setMatrixIndex(casacore::uInt matrixIndex)
const casacore::Vector< casacore::Int > & dataDescriptionIds() const
Re-indexable Vectors.
casacore::IPosition & getWindowShape()
void shiftRowIdOffset(casacore::Int nRows)
const casacore::Vector< casacore::Double > & time() const
casacore::Vector< T > & getVector()
Definition: UtilsTVI.h:144
casacore::uInt vectorIndex_p
Definition: UtilsTVI.h:78
const casacore::Vector< casacore::Double > & timeInterval() const
casacore::Cube< casacore::Complex > visCubeModel_p
casacore::Vector< casacore::uInt > rowIds_p
casacore::Vector< casacore::Int > stateId_p
casacore::Vector< casacore::Stokes::StokesTypes > getCorrelationTypesSelected() const
casacore::Matrix< casacore::Double > uvw_p
map< casacore::uInt, casacore::uInt > inputOutputSPWIndexMap_p
const casacore::Vector< casacore::Float > & feedPa(casacore::Double time) const
For plotms.
casacore::Vector< casacore::Int > processorId_p
void channelAverage(vi::VisBuffer2 *vb, DataCubeMap &inputDataCubeMap, DataCubeMap &outputDataCubeMap) const
const casacore::Matrix< casacore::Float > & weight() const
virtual const casacore::Matrix&lt;CStokesVector&gt; &amp; vis () const; virtual void setVis (casacore::Matrix&lt;C...
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
const casacore::Vector< casacore::Int > & getChannelNumbers(casacore::Int rowInBuffer) const
casacore::Vector< T > vector_p
Definition: UtilsTVI.h:194
casacore::Vector< T > & getVector()
virtual void setVectorIndex(casacore::uInt vectorIndex)=0
void(casa::MSTransformBufferImpl::* TransformKernel1D)(vi::VisBuffer2 *vb, DataCubeMap &inputDataMap, DataCubeMap &outputDataMap, casacore::uInt &inputPos, casacore::uInt &outputPos, casacore::uInt &kernelSize) const
const casacore::Vector< casacore::uInt > & rowIds() const
The returned casacore::Vector serves as a map between the rows in the VisBuffer and the row IDs in th...
casacore::Cube< casacore::Complex > visCube_p
casacore::Matrix< T > & getMatrix(casacore::MS::PredefinedColumns key)
casacore::Cube< casacore::Float > sigmaSpectrum_p
const casacore::Vector< casacore::Float > & parang(casacore::Double time) const
Calculates the parallactic angle of each antenna in the array at the specified time.
casacore::Vector< casacore::Int > feed2_p
const casacore::Vector< casacore::Int > & processorId() const
void transformDataCube(vi::VisBuffer2 *vb, DataCubeMap &inputDataCubeMap, DataCubeMap &outputDataCubeMap, TransformFunction funcPointer) const
casacore::Double getFrequency(casacore::Int rowInBuffer, casacore::Int frequencyIndex, casacore::Int frame=FrameNotSpecified) const
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
casacore::IPosition & getVectorShape()
const casacore::Cube< casacore::Complex > & visCube() const
virtual void setVisModel (casacore::Matrix&lt;CStokesVector&gt; &amp;);
casacore::Vector< casacore::Double > frequencies_p
VisBufferImpls encapsulate one chunk of visibility data for processing.
casacore::Vector< T > vector_p
casacore::Int nAntennas() const
casacore::IPosition matrixShape_p
const casacore::Matrix< casacore::Float > & sigma() const
casacore::Vector< casacore::Float > feedPa_p
casacore::Cube< casacore::Complex > visCubeCorrected_p
std::map< casacore::MS::PredefinedColumns, DataCubeHolderBase * > dataCubeMap_p
casacore::IPosition & getMatrixShape()
MSTransformManager definition.
void(casa::MSTransformBufferImpl::* TransformKernel)(vi::VisBuffer2 *vb, DataCubeMap &inputDataMap, DataCubeMap &outputDataMap, casacore::IPosition &inputPos, casacore::IPosition &outputPos, casacore::IPosition &kernelShape) const
casacore::Vector< casacore::Int > channelNumbers_p
unsigned int uInt
Definition: aipstype.h:51
const casacore::Vector< casacore::Int > & observationId() const
casacore::Bool noneDataCol_p
NONE datacol handling.
casacore::Cube< casacore::Float > weightSpectrum_p
casacore::Double hourang(casacore::Double time) const
Hour angle for specified time.
const casacore::Vector< casacore::Int > & scan() const
Not-Re-indexable Vectors.
casacore::IPosition windowShape_p
casacore::Cube< casacore::Float > visCubeFloat_p