VisBufferUtil.h

Go to the documentation of this file.
00001 //# VisBufferUtil.h: Definitions for VisBuffer utilities
00002 //# Copyright (C) 1996-2014
00003 //# Associated Universities, Inc. Washington DC, USA.
00004 //#
00005 //# This library is free software; you can redistribute it and/or modify it
00006 //# under the terms of the GNU Library General Public License as published by
00007 //# the Free Software Foundation; either version 2 of the License, or (at your
00008 //# option) any later version.
00009 //#
00010 //# This library is distributed in the hope that it will be useful, but WITHOUT
00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00013 //# License for more details.
00014 //#
00015 //# You should have received a copy of the GNU Library General Public License
00016 //# along with this library; if not, write to the Free Software Foundation,
00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00018 //#
00019 //# Correspondence concerning AIPS++ should be adressed as follows:
00020 //#        Internet email: aips2-request@nrao.edu.
00021 //#        Postal address: AIPS++ Project Office
00022 //#                        National Radio Astronomy Observatory
00023 //#                        520 Edgemont Road
00024 //#                        Charlottesville, VA 22903-2475 USA
00025 //#
00026 //#
00027 //# $Id$
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 { //# NAMESPACE CASA - BEGIN
00041 //forward 
00042 class VisBuffer;
00043 // <summary> 
00044 // </summary>
00045 
00046 // <reviewed reviewer="" date="" tests="" demos="">
00047 
00048 // <prerequisite>
00049 // </prerequisite>
00050 //
00051 // <etymology>
00052 // </etymology>
00053 //
00054 // <synopsis> 
00055 // </synopsis> 
00056 //
00057 // <example>
00058 // <srcblock>
00059 // </srcblock>
00060 // </example>
00061 //
00062 // <motivation>
00063 // </motivation>
00064 //
00065 // <todo asof="">
00066 // </todo>
00067 class VisBufferUtil{
00068 
00069 public:
00070 
00071   //Empty Constructor
00072   VisBufferUtil();
00073 
00074   // Construct from a VisBuffer (sets a MeasFrame)
00075   VisBufferUtil(const VisBuffer& vb);
00076 
00077   // Same as above but with VisBuffer2;
00078   // It has to be attached to a VisIter2 as the frame is determined that way
00079   // otherwise use one of the constructors below or the empty constructor above
00080   VisBufferUtil(const vi::VisBuffer2& vb);
00081   // Construct with the vi2 to get access to the ms to define frame
00082 
00083   VisBufferUtil(const vi::VisibilityIterator2& iter);
00084 
00085   VisBufferUtil(const MeasFrame& mframe);
00086 
00087   // Make PSF VisBuffer
00088   void makePSFVisBuffer(VisBuffer& vb);
00089   
00090 
00091   //Regrid the data on a new frequency grid (defined by outFreqGrid) , on the frequency 
00092   //frame (defined by freqFrame). It will pass back the interpolated data and flags 
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   // Converts the frequency in this visbuffer to the frame requested
00103   void convertFrequency(Vector<Double>& outFreq, 
00104                         const VisBuffer& vb, 
00105                         const MFrequency::Types freqFrame);
00106   //This one is just to test VisBuffer2 internal conversions
00107   void convertFrequency(Vector<Double>& outFreq, 
00108                         const vi::VisBuffer2& vb, 
00109                         const MFrequency::Types freqFrame);
00110   //This is a helper function as vi2 does not have a get Freq range for the data selected
00111   static void getFreqRange(Double& freqMin, Double& freqMax,  vi::VisibilityIterator2& vi, MFrequency::Types freqFrame);
00112   
00113 
00114   // Converts the frequency in this VisBuffer to velocity in the frame/def requested
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   // Converts the frequencies on given row of VisBuffer2 to velocity in the frame/def requested
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   //Rotate the uvw in the vb along with giving the phase needed to convert the visibilities to a new phasecenter
00153   // will return a False if it is a NoOP...don't need then to waste time
00154   //applying the phasor etc 
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   // A MeasFrame for conversions
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 } //# NAMESPACE CASA - END
00174 
00175 #endif
00176 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 31 Aug 2016 for casa by  doxygen 1.6.1