Line data Source code
1 : //# PhaseShiftingTVI.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 PhaseShiftingTVI_H_ 24 : #define PhaseShiftingTVI_H_ 25 : 26 : // Base class 27 : #include <mstransform/TVI/FreqAxisTVI.h> 28 : 29 : // To handle variant parameters 30 : #include <stdcasa/StdCasa/CasacSupport.h> 31 : 32 : // CAS-12706 To access directly the MS columns to get initial 33 : // time and position for wide-field phase shifting algorithm 34 : #include <casacore/ms/MeasurementSets/MSColumns.h> 35 : 36 : // CAS-12706 UVWMachine for wide-field phase shifting algorithm 37 : #include <casacore/measures/Measures/UVWMachine.h> 38 : #include <casacore/measures/Measures/MeasFrame.h> 39 : 40 : 41 : namespace casa { //# NAMESPACE CASA - BEGIN 42 : 43 : namespace vi { //# NAMESPACE VI - BEGIN 44 : 45 : ////////////////////////////////////////////////////////////////////////// 46 : // PhaseShiftingTVI class 47 : ////////////////////////////////////////////////////////////////////////// 48 : 49 : class PhaseShiftingTVI : public FreqAxisTVI 50 : { 51 : 52 : public: 53 : 54 : PhaseShiftingTVI( ViImplementation2 * inputVii, 55 : const casacore::Record &configuration); 56 : 57 : // Report the the ViImplementation type 58 0 : virtual casacore::String ViiType() const { return casacore::String("PhaseShifting( ")+getVii()->ViiType()+" )"; }; 59 : 60 : // Navigation methods 61 : virtual void origin (); 62 : virtual void next (); 63 : 64 : virtual void visibilityObserved (casacore::Cube<casacore::Complex> & vis) const; 65 : virtual void visibilityCorrected (casacore::Cube<casacore::Complex> & vis) const; 66 : virtual void visibilityModel (casacore::Cube<casacore::Complex> & vis) const; 67 : virtual void uvw (casacore::Matrix<double> & uvw) const; 68 : 69 : protected: 70 : 71 : casacore::Bool parseConfiguration(const casacore::Record &configuration); 72 : void initialize(); 73 : void initializeUWVMachine(); 74 : void shiftUVWPhases(); 75 : 76 : casacore::Double dx_p, dy_p; 77 : 78 : // CAS-12706 Members wide-field phase shifting algorithm 79 : bool wideFieldMode_p; 80 : bool uvwMachineInitialized_p; 81 : casacore::String phaseCenterName_p; 82 : casacore::MDirection phaseCenter_p; 83 : casacore::MSColumns *selectedInputMsCols_p; 84 : casacore::MPosition observatoryPosition_p; 85 : casacore::MEpoch referenceTime_p; 86 : casacore::String referenceTimeUnits_p; 87 : casacore::Matrix<casacore::Double> newUVW_p; 88 : casacore::Vector<casacore::Double> phaseShift_p; 89 : }; 90 : 91 : ////////////////////////////////////////////////////////////////////////// 92 : // PhaseShiftingTVIFactory class 93 : ////////////////////////////////////////////////////////////////////////// 94 : 95 : class PhaseShiftingTVIFactory : public ViFactory 96 : { 97 : 98 : public: 99 : 100 : PhaseShiftingTVIFactory(casacore::Record &configuration,ViImplementation2 *inputVII); 101 : 102 : protected: 103 : 104 : vi::ViImplementation2 * createVi (VisibilityIterator2 *) const; 105 : vi::ViImplementation2 * createVi () const; 106 : 107 : casacore::Record configuration_p; 108 : ViImplementation2 *inputVii_p;; 109 : }; 110 : 111 : ////////////////////////////////////////////////////////////////////////// 112 : // PhaseShiftingTVILayerFactory class (for _recursive_ layering) 113 : ////////////////////////////////////////////////////////////////////////// 114 : 115 : class PhaseShiftingTVILayerFactory : public ViiLayerFactory 116 : { 117 : 118 : public: 119 : 120 : PhaseShiftingTVILayerFactory(casacore::Record &configuration); 121 : 122 0 : virtual ~PhaseShiftingTVILayerFactory() {}; 123 : 124 : protected: 125 : 126 : 127 : virtual ViImplementation2 * createInstance(ViImplementation2* vii0) const; 128 : 129 : const casacore::Record configuration_p; 130 : 131 : }; 132 : 133 : ////////////////////////////////////////////////////////////////////////// 134 : // PhaseShiftingTransformEngine class 135 : ////////////////////////////////////////////////////////////////////////// 136 : 137 : template<class T> class PhaseShiftingTransformEngine : public FreqAxisTransformEngine2<T> 138 : { 139 : using FreqAxisTransformEngine2<T>::inputData_p; 140 : using FreqAxisTransformEngine2<T>::outputData_p; 141 : using FreqAxisTransformEngine2<T>::rowIndex_p; 142 : using FreqAxisTransformEngine2<T>::corrIndex_p; 143 : 144 : public: 145 : 146 : PhaseShiftingTransformEngine(casacore::Double dx, casacore::Double dy, 147 : casacore::Matrix<casacore::Double> *uvw, 148 : casacore::Vector<casacore::Double> *frequencies, 149 : DataCubeMap *inputData, 150 : DataCubeMap *outputData); 151 : 152 : void transform(); 153 : 154 : void transformCore(DataCubeMap *inputData,DataCubeMap *outputData); 155 : 156 : protected: 157 : 158 : casacore::Double dx_p, dy_p; 159 : casacore::Matrix<casacore::Double> *uvw_p; 160 : casacore::Vector<casacore::Double> *frequencies_p; 161 : }; 162 : 163 : ////////////////////////////////////////////////////////////////////////// 164 : // WideFieldPhaseShiftingTransformEngine class 165 : ////////////////////////////////////////////////////////////////////////// 166 : 167 : template<class T> class WideFieldPhaseShiftingTransformEngine : public FreqAxisTransformEngine2<T> 168 : { 169 : using FreqAxisTransformEngine2<T>::inputData_p; 170 : using FreqAxisTransformEngine2<T>::outputData_p; 171 : using FreqAxisTransformEngine2<T>::rowIndex_p; 172 : using FreqAxisTransformEngine2<T>::corrIndex_p; 173 : 174 : public: 175 : 176 : WideFieldPhaseShiftingTransformEngine(const casacore::Vector<casacore::Double> &phaseShift, 177 : casacore::Matrix<casacore::Double> *uvw, 178 : casacore::Vector<casacore::Double> *frequencies, 179 : DataCubeMap *inputData, 180 : DataCubeMap *outputData); 181 : 182 : void transform(); 183 : 184 : void transformCore(DataCubeMap *inputData,DataCubeMap *outputData); 185 : 186 : protected: 187 : 188 : casacore::Vector<casacore::Double> phaseShift_p; 189 : casacore::Matrix<casacore::Double> *uvw_p; 190 : casacore::Vector<casacore::Double> *frequencies_p; 191 : }; 192 : 193 : 194 : 195 : } //# NAMESPACE VI - END 196 : 197 : } //# NAMESPACE CASA - END 198 : 199 : #endif /* PhaseShiftingTVI_H_ */ 200 :