00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef MSVIS_VISBUFFERUTIL_H
00030 #define MSVIS_VISBUFFERUTIL_H
00031
00032 #include <casa/aips.h>
00033 #include <msvis/MSVis/VisBuffer.h>
00034 #include <msvis/MSVis/VisBuffer2.h>
00035 #include <measures/Measures/MDirection.h>
00036 #include <measures/Measures/MPosition.h>
00037 #include <measures/Measures/MFrequency.h>
00038 #include <ms/MeasurementSets/MeasurementSet.h>
00039 #include <scimath/Mathematics/InterpolateArray1D.h>
00040 namespace casa {
00041
00042 class VisBuffer;
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 class VisBufferUtil{
00068
00069 public:
00070
00071
00072 VisBufferUtil();
00073
00074
00075 VisBufferUtil(const VisBuffer& vb);
00076
00077
00078
00079
00080 VisBufferUtil(const vi::VisBuffer2& vb);
00081
00082
00083 VisBufferUtil(const vi::VisibilityIterator2& iter);
00084
00085 VisBufferUtil(const MeasFrame& mframe);
00086
00087
00088 void makePSFVisBuffer(VisBuffer& vb);
00089
00090
00091
00092
00093
00094 Bool interpolateFrequency(Cube<Complex>& data,
00095 Cube<Bool>& flags,
00096 const VisBuffer& vb,
00097 const Vector<Float>& outFreqGrid, const MS::PredefinedColumns whichCol=MS::DATA,
00098 const MFrequency::Types freqFrame=MFrequency::LSRK,
00099 const InterpolateArray1D< Float, Complex>::InterpolationMethod interp =
00100 (InterpolateArray1D<Float,Complex>::nearestNeighbour));
00101
00102
00103 void convertFrequency(Vector<Double>& outFreq,
00104 const VisBuffer& vb,
00105 const MFrequency::Types freqFrame);
00106
00107 void convertFrequency(Vector<Double>& outFreq,
00108 const vi::VisBuffer2& vb,
00109 const MFrequency::Types freqFrame);
00110
00111 static void getFreqRange(Double& freqMin, Double& freqMax, vi::VisibilityIterator2& vi, MFrequency::Types freqFrame);
00112
00113
00114
00115 void toVelocity(Vector<Double>& outVel,
00116 const VisBuffer& vb,
00117 const MFrequency::Types freqFrame,
00118 const MVFrequency restFreq,
00119 const MDoppler::Types veldef);
00120
00121
00122 void toVelocity(Vector<Double>& outVel,
00123 const vi::VisBuffer2& vb,
00124 const MFrequency::Types freqFrame,
00125 const MVFrequency restFreq,
00126 const MDoppler::Types veldef,
00127 const Int row=0);
00128
00131 void toVelocity(Vector<Double>& outVel,
00132 const vi::VisBuffer2& vb,
00133 const vi::VisibilityIterator2& iter,
00134 const MFrequency::Types freqFrame,
00135 const MVFrequency restFreq,
00136 const MDoppler::Types veldef,
00137 const Int row=0);
00138
00139
00143 void toVelocity(Vector<Double>& outVel,
00144 const MFrequency::Types outfreqFrame,
00145 const Vector<Double>& inFreq,
00146 const MFrequency::Types inFreqFrame,
00147 const MEpoch& ep,
00148 const MDirection& dir,
00149 const MVFrequency restFreq,
00150 const MDoppler::Types veldef);
00151
00152
00153
00154
00155 Bool rotateUVW(const vi::VisBuffer2&vb, const MDirection& desiredDir,
00156 Matrix<Double>& uvw, Vector<Double>& dphase);
00157
00160 MDirection getPointingDir(const VisBuffer& vb, const Int antid, const Int row);
00161 private:
00162 void swapyz(Cube<Bool>& out, const Cube<Bool>& in);
00163 void swapyz(Cube<Complex>& out, const Cube<Complex>& in);
00164 void rejectConsecutive(const Vector<Double>& t, Vector<Double>& retval);
00165
00166 MeasFrame mframe_;
00167 Int oldMSId_p;
00168 Vector<std::map<String, Int> > timeAntIndex_p;
00169 Vector<Vector<MDirection> > cachedPointingDir_p;
00170
00171 };
00172
00173 }
00174
00175 #endif
00176