casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VisBufferUtil.h
Go to the documentation of this file.
1 //# VisBufferUtil.h: Definitions for VisBuffer utilities
2 //# Copyright (C) 1996-2014
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be adressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef MSVIS_VISBUFFERUTIL_H
30 #define MSVIS_VISBUFFERUTIL_H
31 
32 #include <casa/aips.h>
33 #include <msvis/MSVis/VisBuffer.h>
34 #include <msvis/MSVis/VisBuffer2.h>
40 #include <unordered_map>
41 namespace casa { //# NAMESPACE CASA - BEGIN
42 //forward
43 class VisBuffer;
44 // <summary>
45 // </summary>
46 
47 // <reviewed reviewer="" date="" tests="" demos="">
48 
49 // <prerequisite>
50 // </prerequisite>
51 //
52 // <etymology>
53 // </etymology>
54 //
55 // <synopsis>
56 // </synopsis>
57 //
58 // <example>
59 // <srcblock>
60 // </srcblock>
61 // </example>
62 //
63 // <motivation>
64 // </motivation>
65 //
66 // <todo asof="">
67 // </todo>
69 
70 public:
71 
72  //Empty Constructor
73  VisBufferUtil();
74 
75  // Construct from a VisBuffer (sets a casacore::MeasFrame)
76  VisBufferUtil(const VisBuffer& vb);
77 
78  // Same as above but with VisBuffer2;
79  // It has to be attached to a VisIter2 as the frame is determined that way
80  // otherwise use one of the constructors below or the empty constructor above
81  VisBufferUtil(const vi::VisBuffer2& vb);
82  // Construct with the vi2 to get access to the ms to define frame
83 
85 
86  VisBufferUtil(const casacore::MeasFrame& mframe);
87 
88  // Make PSF VisBuffer
89  void makePSFVisBuffer(VisBuffer& vb);
90 
91 
92  //Regrid the data on a new frequency grid (defined by outFreqGrid) , on the frequency
93  //frame (defined by freqFrame). It will pass back the interpolated data and flags
94 
97  const VisBuffer& vb,
102 
103  // Converts the frequency in this visbuffer to the frame requested
105  const VisBuffer& vb,
106  const casacore::MFrequency::Types freqFrame);
107  //This one is just to test VisBuffer2 internal conversions
109  const vi::VisBuffer2& vb,
110  const casacore::MFrequency::Types freqFrame);
111  //This is a helper function as vi2 does not have a get Freq range for the data selected
113 
114  //Get the freqRange from in Frame to range it represents in outFrame for
115  //all the fields and time selected in the vi
116  //Returns False if failed to do any conversion.
117  static casacore::Bool getFreqRangeFromRange(casacore::Double& outfreqMin, casacore::Double& outfreqMax, const casacore::MFrequency::Types inFreqFrame, const casacore::Double infreqMin, const casacore::Double infreqMax, vi::VisibilityIterator2& vi, casacore::MFrequency::Types outFreqFrame);
118 
119  // Converts the frequency in this VisBuffer to velocity in the frame/def requested
121  const VisBuffer& vb,
122  const casacore::MFrequency::Types freqFrame,
123  const casacore::MVFrequency restFreq,
124  const casacore::MDoppler::Types veldef);
125 
126  // Converts the frequencies on given row of VisBuffer2 to velocity in the frame/def requested
128  const vi::VisBuffer2& vb,
129  const casacore::MFrequency::Types freqFrame,
130  const casacore::MVFrequency restFreq,
131  const casacore::MDoppler::Types veldef,
132  const casacore::Int row=0);
133 
137  const vi::VisBuffer2& vb,
138  const vi::VisibilityIterator2& iter,
139  const casacore::MFrequency::Types freqFrame,
140  const casacore::MVFrequency restFreq,
141  const casacore::MDoppler::Types veldef,
142  const casacore::Int row=0);
143 
144 
149  const casacore::MFrequency::Types outfreqFrame,
151  const casacore::MFrequency::Types inFreqFrame,
152  const casacore::MEpoch& ep,
153  const casacore::MDirection& dir,
154  const casacore::MVFrequency restFreq,
155  const casacore::MDoppler::Types veldef);
156 
157  //Rotate the uvw in the vb along with giving the phase needed to convert the visibilities to a new phasecenter
158  // will return a false if it is a NoOP...don't need then to waste time
159  //applying the phasor etc
160  casacore::Bool rotateUVW(const vi::VisBuffer2&vb, const casacore::MDirection& desiredDir,
162 
165  casacore::MDirection getPointingDir(const VisBuffer& vb, const casacore::Int antid, const casacore::Int row);
167  //get the phaseCenter for a given time ..cached so that it does not need to do small read every time of access
168  // time -ve means use the first time in the vb
171  //or the first time in the visBuffer
173 
174  private:
179  //A quicker pointing index finder
180  //void pointingIndex(const casacore::MSPointing& pcols, const casacore::Int antenna, const casacore::Int ntimes, casacore::Double*& ptime, casacore::Vector<casacore::Int>& indices,casacore::Vector<casacore::MDirection>& direction );
181  void pointingIndex( casacore::Double*& timecol, casacore::Int*& antcol, casacore::Double*& intervalcol, const casacore::Int nrow, const casacore::Int antenna, const casacore::Int ntimes, casacore::Double*& ptime, casacore::Vector<casacore::Int>& indices );
182  //get ephemeris based direction corrected for parallax for the position in the frame
184  // A casacore::MeasFrame for conversions
191 };
192 
193 } //# NAMESPACE CASA - END
194 
195 #endif
196 
A Measure: astronomical direction.
Definition: MDirection.h:174
casacore::MDirection getPointingDir(const VisBuffer &vb, const casacore::Int antid, const casacore::Int row)
get the pointing direction for a given integration and antenna id will cache it for large pointing ta...
casacore::MDirection getEphemDir(const vi::VisBuffer2 &vb, const casacore::Double time=-1.0)
Get the ephemeris direction of a source fieldid of vb at time given.
int Int
Definition: aipstype.h:50
void pointingIndex(casacore::Double *&timecol, casacore::Int *&antcol, casacore::Double *&intervalcol, const casacore::Int nrow, const casacore::Int antenna, const casacore::Int ntimes, casacore::Double *&ptime, casacore::Vector< casacore::Int > &indices)
A quicker pointing index finder void pointingIndex(const casacore::MSPointing&amp; pcols, const casacore::Int antenna, const casacore::Int ntimes, casacore::Double*&amp; ptime, casacore::Vector&lt;casacore::Int&gt;&amp; indices,casacore::Vector&lt;casacore::MDirection&gt;&amp; direction);.
Internal value for MFrequency.
Definition: MVFrequency.h:97
casacore::Int oldPCMSId_p
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
casacore::Vector< casacore::Vector< casacore::MDirection > > cachedPointingDir_p
casacore::Int oldMSId_p
casacore::Vector< std::map< casacore::Double, casacore::MDirection > > cachedPhaseCenter_p
casacore::Bool rotateUVW(const vi::VisBuffer2 &vb, const casacore::MDirection &desiredDir, casacore::Matrix< casacore::Double > &uvw, casacore::Vector< casacore::Double > &dphase)
Rotate the uvw in the vb along with giving the phase needed to convert the visibilities to a new phas...
ABSTRACT TOOL CLASSES A PlotTool is a higher level event handler for a PlotCanvas The idea is to take common tasks which may require multiple events and put them in one place PlotTools also provide additional functionality in that they can be active and blocking non blocking The PlotCanvas will only send events to active and will not send events to later tools or event handlers if the latest tool was blocking In this way a single tool can be used to handle ALL user interaction via the GUI at one time
Definition: PlotTool.h:43
Container for Measure frame.
Definition: MeasFrame.h:137
static casacore::Bool getFreqRangeFromRange(casacore::Double &outfreqMin, casacore::Double &outfreqMax, const casacore::MFrequency::Types inFreqFrame, const casacore::Double infreqMin, const casacore::Double infreqMax, vi::VisibilityIterator2 &vi, casacore::MFrequency::Types outFreqFrame)
Get the freqRange from in Frame to range it represents in outFrame for all the fields and time select...
PredefinedColumns
The Main table colums with predefined meaning.
Definition: MSMainEnums.h:65
VisBufferUtil()
Empty Constructor.
Interpolate in one dimension.
A Measure: instant in time.
Definition: MEpoch.h:104
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
Types
Types of known MDirections Warning: The order defines the order in the translation matrix FromTo in ...
Definition: MDirection.h:188
InterpolationMethod
Interpolation methods.
void swapyz(casacore::Cube< casacore::Bool > &out, const casacore::Cube< casacore::Bool > &in)
casacore::MeasFrame mframe_
A casacore::MeasFrame for conversions.
double Double
Definition: aipstype.h:55
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
Types
Types of known MDopplers Warning: The order defines the order in the translation matrix FromTo in th...
Definition: MDoppler.h:149
casacore::MDirection getEphemBasedPhaseDir(const vi::VisBuffer2 &vb, const casacore::String &ephemPath, const casacore::MDirection &refDir, const casacore::Double t)
get ephemeris based direction corrected for parallax for the position in the frame ...
casacore::Vector< std::map< std::pair< double, int >, int > > timeAntIndex_p
void toVelocity(casacore::Vector< casacore::Double > &outVel, const VisBuffer &vb, const casacore::MFrequency::Types freqFrame, const casacore::MVFrequency restFreq, const casacore::MDoppler::Types veldef)
Converts the frequency in this VisBuffer to velocity in the frame/def requested.
void makePSFVisBuffer(VisBuffer &vb)
Make PSF VisBuffer.
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
static void getFreqRange(casacore::Double &freqMin, casacore::Double &freqMax, vi::VisibilityIterator2 &vi, casacore::MFrequency::Types freqFrame)
This is a helper function as vi2 does not have a get Freq range for the data selected.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Bool interpolateFrequency(casacore::Cube< casacore::Complex > &data, casacore::Cube< casacore::Bool > &flags, const VisBuffer &vb, const casacore::Vector< casacore::Float > &outFreqGrid, const casacore::MS::PredefinedColumns whichCol=casacore::MS::DATA, const casacore::MFrequency::Types freqFrame=casacore::MFrequency::LSRK, const casacore::InterpolateArray1D< casacore::Float, casacore::Complex >::InterpolationMethod interp=(casacore::InterpolateArray1D< casacore::Float, casacore::Complex >::nearestNeighbour))
Regrid the data on a new frequency grid (defined by outFreqGrid), on the frequency frame (defined by ...
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
void rejectConsecutive(const casacore::Vector< casacore::Double > &t, casacore::Vector< casacore::Double > &retval)
void convertFrequency(casacore::Vector< casacore::Double > &outFreq, const VisBuffer &vb, const casacore::MFrequency::Types freqFrame)
Converts the frequency in this visbuffer to the frame requested.
casacore::MDirection getPhaseCenter(const vi::VisBuffer2 &vb, const casacore::Double time=-1.0)
get the phaseCenter for a given time..cached so that it does not need to do small read every time of ...
Types
Types of known MFrequencies Warning: The order defines the order in the translation matrix FromTo in...
Definition: MFrequency.h:176
Complex visibility matrix.
Definition: MSMainEnums.h:183