casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MSUVBin.h
Go to the documentation of this file.
1 /*
2  * MSUVBin.h: This file contains the interface definition of the MSUVBin class.
3 //#
4 //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
5 
6  //# Copyright (C) 2014
7 //# Associated Universities, Inc. Washington DC, USA.
8 //#
9 //# This library is free software; you can redistribute it and/or modify it
10 //# under the terms of the GNU General Public License as published by
11 //# the Free Software Foundation; either version 2 of the License, or (at your
12 //# option) any later version.
13 //#
14 //# This library is distributed in the hope that it will be useful, but WITHOUT
15 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
17 //# License for more details.
18 //#
19 //# You should have received a copy of the GNU Library General Public License
20 //# along with this library; if not, write to the Free Software Foundation,
21 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
22 //#
23 
24 //# Postal address:
25 //# National Radio Astronomy Observatory
26 //# 520 Edgemont Road
27 //# Charlottesville, VA 22903-2475 USA
28 //#
29 
30  * Created on: Feb 3, 2014
31  * Author: kgolap
32  */
33 
34 #ifndef MSTRANSFORM_MSUVBIN_H
35 #define MSTRANSFORM_MSUVBIN_H
38 #include <msvis/MSVis/VisBuffer2.h>
39 #include <msvis/MSVis/VisBuffer.h>
41 #include <msvis/MSVis/VisBuffer.h>
43 namespace casa { //# NAMESPACE CASA - BEGIN
44 
45 
46 class MSUVBin {
47 public:
48  MSUVBin();
49  //npol should be only 1, 2 (parallel hands) or 4
50  MSUVBin(const casacore::MDirection& phaseCenter, const casacore::Int nx,
51  const casacore::Int ny, const casacore::Int nchan, const casacore::Int npol, casacore::Quantity cellx, casacore::Quantity celly, casacore::Quantity freqStart, casacore::Quantity freqStep, casacore::Float memFraction=0.5, casacore::Bool dow=false, casacore::Bool doflag=false);
52  //Constructor to bin into an existing gridded ms
54  //The following can be called multiple times to setup multiple input MS
55  virtual casacore::Bool selectData(const casacore::String& msname, const casacore::String& spw = "", const casacore::String& field = "",
56  const casacore::String& baseline = "", const casacore::String& scan = "",
57  const casacore::String& uvrange = "", const casacore::String& taql = "",
58  const casacore::String& subarray = "", const casacore::String& correlation = "",
59  const casacore::String& intent = "", const casacore::String& obs = "");
60  //void setInputMS(const casacore::MeasurementSet& ms);
61  //void setInputMS(const casacore::Block<const casacore::MeasurementSet*> mssPtr);
62  void setOutputMS(const casacore::String& msname);
63  //forceDiskUsage is to avoid using in memory gridding even if there is
65  virtual ~MSUVBin();
66  //Helper function for creating casacore::MDirection from a string
67  static casacore::Bool String2MDirection(const casacore::String& theString,
68  casacore::MDirection& theMeas, const casacore::String msname="");
69 
70 private:
72  const casacore::String& str);
77  void storeGridInfo();
78  void createOutputMS(const casacore::Int nrrows);
94  const casacore::Cube<casacore::Complex>& convFunc, const casacore::Vector<casacore::Int>& convSupport, const casacore::Double wScale, const casacore::Int convSampling);
99  const casacore::Cube<casacore::Complex>& convFunc, const casacore::Vector<casacore::Int>& convSupport, const casacore::Double wScale, const casacore::Int convSampling);
100  void inplaceGridData(const vi::VisBuffer2& vb);
101  void inplaceLargeBW(const vi::VisBuffer2& vb);
102  void inplaceSmallBW(const vi::VisBuffer2& vb);
103  void makeCoordsys();
104  void weightSync();
105  void multiThrLoop(const casacore::Int outchan, const vi::VisBuffer2& vb, casacore::Double refFreq,
108  const casacore::Double& fracbw,
109  casacore::Complex*& grid, casacore::Complex*& wghtSpec, casacore::Bool*& flag,
110  casacore::Bool*& rowFlag, casacore::Double*& uvw, casacore::Int*& ant1,
111  casacore::Int*& ant2, casacore::Double*& timeCen, casacore::Double*& sumWeight, casacore::Double*& numvis,
112  const casacore::Int startchan,
113  const casacore::Int endchan, const casacore::Cube<casacore::Complex>& convFunc, const casacore::Vector<casacore::Int>& convSupport, const casacore::Double wScale, const casacore::Int convSampling );
118  // returns a false if either no channel map or pol map onto grid
125 
127  const casacore::Cube<casacore::Float>&wghtSpec,
130  void fillSubTables();
131  void fillFieldTable();
132  void copySubtable(const casacore::String& tabName, const casacore::Table& inTab,
133  const casacore::Bool noRows=false);
134  void fillDDTables();
135  void setTileCache();
137  casacore::Vector<casacore::Int>& convSupport, casacore::Double& wScale, casacore::Int& convSampling,
138  casacore::Int& convSize);
140  casacore::Vector<casacore::Int>& convSupport,
141  casacore::Double& wScale, casacore::Int& convSampling, casacore::Int& convSize );
159 
160 }; // end class MSUVBin
161 } //# NAMESPACE CASA - END
162 #endif /* MSTRANSFORM_MSUVBIN_H */
casacore::Vector< casacore::Int > whichStokes_p
Definition: MSUVBin.h:149
casacore::String outMSName_p
Definition: MSUVBin.h:151
A Measure: astronomical direction.
Definition: MDirection.h:174
int Int
Definition: aipstype.h:50
void gridDataConv(const vi::VisBuffer2 &vb, casacore::Cube< casacore::Complex > &grid, casacore::Matrix< casacore::Float > &, casacore::Cube< casacore::Complex > &wghtSpec, casacore::Cube< casacore::Bool > &flag, casacore::Vector< casacore::Bool > &rowFlag, casacore::Matrix< casacore::Double > &uvw, casacore::Vector< casacore::Int > &ant1, casacore::Vector< casacore::Int > &ant2, casacore::Vector< casacore::Double > &timeCen, const casacore::Int startchan, const casacore::Int endchan, const casacore::Cube< casacore::Complex > &convFunc, const casacore::Vector< casacore::Int > &convSupport, const casacore::Double wScale, const casacore::Int convSampling)
void fillDDTables()
casacore::Vector< casacore::Int > chanMap_p
Definition: MSUVBin.h:145
void setOutputMS(const casacore::String &msname)
void setInputMS(const casacore::MeasurementSet&amp; ms); void setInputMS(const casacore::Block&lt;const casa...
casacore::Int npol_p
Definition: MSUVBin.h:143
static casacore::Int sepCommaEmptyToVectorStrings(casacore::Vector< casacore::String > &retStr, const casacore::String &str)
Main interface class to a read/write table.
Definition: Table.h:153
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
casacore::CountedPtr< casacore::MeasurementSet > outMsPtr_p
Definition: MSUVBin.h:152
casacore::Bool datadescMap(const vi::VisBuffer2 &vb, casacore::Double &fracbw)
returns a false if either no channel map or pol map onto grid
casacore::Double freqStart_p
Definition: MSUVBin.h:144
casacore::Int recoverGridInfo(const casacore::String &msname)
void weightSync()
void fillFieldTable()
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
casacore::Bool saveData(const casacore::Cube< casacore::Complex > &grid, const casacore::Cube< casacore::Bool > &flag, const casacore::Vector< casacore::Bool > &rowFlag, const casacore::Cube< casacore::Float > &wghtSpec, const casacore::Matrix< casacore::Float > &wght, const casacore::Matrix< casacore::Double > &uvw, const casacore::Vector< casacore::Int > &ant1, const casacore::Vector< casacore::Int > &ant2, const casacore::Vector< casacore::Double > &time)
casacore::Double freqStep_p
Definition: MSUVBin.h:144
casacore::Matrix< casacore::Double > sumWeight_p
Definition: MSUVBin.h:158
casacore::Bool fillOutputMS()
forceDiskUsage is to avoid using in memory gridding even if there is
casacore::Bool fillNewBigOutputMS()
casacore::Matrix< casacore::Double > numVis_p
Definition: MSUVBin.h:157
void gridData(const vi::VisBuffer2 &vb, casacore::Cube< casacore::Complex > &grid, casacore::Matrix< casacore::Float > &wght, casacore::Cube< casacore::Float > &wghtSpec, casacore::Cube< casacore::Bool > &flag, casacore::Vector< casacore::Bool > &rowFlag, casacore::Matrix< casacore::Double > &uvw, casacore::Vector< casacore::Int > &ant1, casacore::Vector< casacore::Int > &ant2, casacore::Vector< casacore::Double > &time, const casacore::Matrix< casacore::Int > &locuv)
casacore::MDirection phaseCenter_p
Definition: MSUVBin.h:147
static casacore::Bool String2MDirection(const casacore::String &theString, casacore::MDirection &theMeas, const casacore::String msname="")
Helper function for creating casacore::MDirection from a string.
VisBufferUtil vbutil_p
Definition: MSUVBin.h:154
void makeCoordsys()
void copySubtable(const casacore::String &tabName, const casacore::Table &inTab, const casacore::Bool noRows=false)
void fillSubTables()
casacore::Int ny_p
Definition: MSUVBin.h:143
casacore::Bool doW_p
Definition: MSUVBin.h:156
casacore::Vector< casacore::Double > deltas_p
Definition: MSUVBin.h:148
double Double
Definition: aipstype.h:55
void gridDataConvThr(const vi::VisBuffer2 &vb, casacore::Cube< casacore::Complex > &grid, casacore::Cube< casacore::Complex > &wghtSpec, casacore::Cube< casacore::Bool > &flag, casacore::Vector< casacore::Bool > &rowFlag, casacore::Matrix< casacore::Double > &uvw, casacore::Vector< casacore::Int > &ant1, casacore::Vector< casacore::Int > &ant2, casacore::Vector< casacore::Double > &timeCen, const casacore::Int startchan, const casacore::Int endchan, const casacore::Cube< casacore::Complex > &convFunc, const casacore::Vector< casacore::Int > &convSupport, const casacore::Double wScale, const casacore::Int convSampling)
void inplaceLargeBW(const vi::VisBuffer2 &vb)
casacore::CoordinateSystem csys_p
Definition: MSUVBin.h:142
void multiThrLoop(const casacore::Int outchan, const vi::VisBuffer2 &vb, casacore::Double refFreq, casacore::Vector< casacore::Float > scale, casacore::Bool hasCorrected, casacore::Bool needRot, const casacore::Vector< casacore::Double > &phasor, const casacore::Vector< casacore::Double > &visFreq, const casacore::Double &fracbw, casacore::Complex *&grid, casacore::Complex *&wghtSpec, casacore::Bool *&flag, casacore::Bool *&rowFlag, casacore::Double *&uvw, casacore::Int *&ant1, casacore::Int *&ant2, casacore::Double *&timeCen, casacore::Double *&sumWeight, casacore::Double *&numvis, const casacore::Int startchan, const casacore::Int endchan, const casacore::Cube< casacore::Complex > &convFunc, const casacore::Vector< casacore::Int > &convSupport, const casacore::Double wScale, const casacore::Int convSampling)
void locateFlagFromGrid(vi::VisBuffer2 &vb, casacore::Cube< casacore::Bool > &datFlag, casacore::Cube< casacore::Float > &wghtSpec, casacore::Cube< casacore::Bool > &flag, casacore::Vector< casacore::Bool > &rowFlag, casacore::Matrix< casacore::Double > &uvw, casacore::Vector< casacore::Int > &ant1, casacore::Vector< casacore::Int > &ant2, casacore::Vector< casacore::Double > &timeCen, const casacore::Int startchan, const casacore::Int endchan)
casacore::Int makeUVW(const casacore::Double reffreq, casacore::Vector< casacore::Double > &incr, casacore::Vector< casacore::Int > &cent, casacore::Matrix< casacore::Double > &uvw)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void storeGridInfo()
void setTileCache()
float Float
Definition: aipstype.h:54
casacore::Vector< casacore::Int > polMap_p
Definition: MSUVBin.h:145
virtual casacore::Bool selectData(const casacore::String &msname, const casacore::String &spw="", const casacore::String &field="", const casacore::String &baseline="", const casacore::String &scan="", const casacore::String &uvrange="", const casacore::String &taql="", const casacore::String &subarray="", const casacore::String &correlation="", const casacore::String &intent="", const casacore::String &obs="")
The following can be called multiple times to setup multiple input MS.
A Table intended to hold astronomical data (a set of Measurements).
void createOutputMS(const casacore::Int nrrows)
simple 1-D array
casacore::Float memFraction_p
Definition: MSUVBin.h:155
casacore::Block< const casacore::MeasurementSet * > mss_p
Definition: MSUVBin.h:153
casacore::Int nchan_p
Definition: MSUVBin.h:143
casacore::Bool fillBigOutputMS()
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
casacore::Int nx_p
Definition: MSUVBin.h:143
String: the storage and methods of handling collections of characters.
Definition: String.h:223
void locateuvw(casacore::Matrix< casacore::Int > &locuv, const casacore::Vector< casacore::Double > &increment, const casacore::Vector< casacore::Int > &center, const casacore::Matrix< casacore::Double > &uvw)
void inplaceGridData(const vi::VisBuffer2 &vb)
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
casacore::Bool existOut_p
Definition: MSUVBin.h:150
virtual ~MSUVBin()
void makeWConv(vi::VisibilityIterator2 &iter, casacore::Cube< casacore::Complex > &convFunc, casacore::Vector< casacore::Int > &convSupport, casacore::Double &wScale, casacore::Int &convSampling, casacore::Int &convSize)
void makeSFConv(casacore::Cube< casacore::Complex > &convFunc, casacore::Vector< casacore::Int > &convSupport, casacore::Double &wScale, casacore::Int &convSampling, casacore::Int &convSize)
void inplaceSmallBW(const vi::VisBuffer2 &vb)
casacore::Vector< casacore::Vector< casacore::Int > > chanMapRev_p
Definition: MSUVBin.h:146
casacore::Bool doFlag_p
Definition: MSUVBin.h:156
Interconvert pixel and world coordinates.
casacore::Bool fillSmallOutputMS()