casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CalCache.h
Go to the documentation of this file.
1 //# CalCache.h: CalTable-specific casacore::Data cache for plotms.
2 //# Copyright (C) 2009
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 addressed 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 //# $Id: $
27 #ifndef CALCACHE_H_
28 #define CALCACHE_H_
29 
31 
42 #include <casa/aips.h>
43 #include <casa/Arrays.h>
44 #include <casa/Containers/Block.h>
45 
46 namespace casa {
47 
48 //# Forward declarations.
49 class PlotMSApp;
50 class PlotMSIndexer;
51 
52 class CalCache : public PlotMSCacheBase {
53 
54  // Friend class declarations.
55  friend class PlotMSIndexer;
56 
57 public:
58 
59  // Constructor which takes parent PlotMS.
60  CalCache(PlotMSApp* parent);
61 
62  // Destructor
63  virtual ~CalCache();
64 
65  // Identify myself
67 
68  // Is the underlying table complex?
70 
71  // ...not yet CAL-specific... (or ever?)
72  // Set up indexing for the plot
73  // void setUpIndexer(PMS::Axis iteraxis=PMS::SCAN,
74  // casacore::Bool globalXRange=false, casacore::Bool globalYRange=false);
75 
76  // Convert poln index->name and name->index
78 
79  // given filename, get cal type
80  void setFilename(casacore::String filename);
81 
82 protected:
83 
84  // CAL-specific loadIt method
85  virtual void loadIt(std::vector<PMS::Axis>& loadAxes,
86  std::vector<PMS::DataColumn>& loadData,
87  ThreadCommunication* thread = nullptr);
88 
89 private:
90 
91  // Forbid copy for now
92  CalCache(const CalCache&);
93 
94  // NewCalTable:
95  void loadNewCalTable(std::vector<PMS::Axis>& loadAxes,
96  std::vector<PMS::DataColumn>& loadData, ThreadCommunication* thread = nullptr);
97  void setUpCalIter(NewCalTable& selct, casacore::Bool readonly=True);
98  void countChunks(ROCTIter& ci,
99  std::vector<PMS::Axis>& loadAxes,
100  std::vector<PMS::DataColumn>& loadData,
101  ThreadCommunication* thread);
102  void loadCalChunks(ROCTIter& ci, const std::vector<PMS::Axis> loadAxes,
103  ThreadCommunication* thread);
104  void loadCalAxis(ROCTIter& cti, casacore::Int chunk, PMS::Axis axis,
105  casacore::String pol);
106  virtual void flagToDisk(const PlotMSFlagging& flagging,
110 
111  // CalTable:
112  void countChunks(casacore::Int nrowMain, std::vector<PMS::Axis>& loadAxes,
113  std::vector<PMS::DataColumn>& loadData, ThreadCommunication* thread);
114  void setMSname(casacore::String msname); // set msname_; adds path to name
115  void getNamesFromMS(); // for locate
116  void setUpLoad(ThreadCommunication* thread, casacore::Slice& parSlice);
117  void getCalDataAxis(PMS::Axis axis, casacore::Cube<casacore::Complex>& viscube,
118  casacore::Int chunk); // get axes derived from raw viscube
119 
120  // BPOLY CalTable:
121  void loadBPoly(std::vector<PMS::Axis>& loadAxes,
122  std::vector<PMS::DataColumn>& loadData, ThreadCommunication* thread = nullptr);
124  casacore::Int nrow, const std::vector<PMS::Axis> loadAxes,
126  ThreadCommunication* thread);
128  casacore::Int chunk, PMS::Axis axis);
133  // cube selected by channel:
134  template<class T>
135  void getSelectedCube(const casacore::Cube<T>& inputCube,
136  const casacore::Vector<casacore::Slice>& chanSlices,
137  casacore::Cube<T>& outputCube);
138 
139  // GSPLINE CalTable:
140  void loadGSpline(std::vector<PMS::Axis>& loadAxes,
141  std::vector<PMS::DataColumn>& loadData, ThreadCommunication* thread = nullptr);
143  casacore::Int nsample, const std::vector<PMS::Axis> loadAxes,
144  casacore::Vector<int>& selectedAnts, ThreadCommunication* thread);
145  void checkAxes(const std::vector<PMS::Axis>& loadAxes);
146  // cube selected by antenna1:
147  template<class T>
148  void getSelectedCube(casacore::Cube<T>& inputcube,
149  const casacore::Vector<casacore::Int> selectedRows);
150 
151  // Utilities for all cal tables:
152  // Get axis string for VisCal Slice code
153  casacore::String toVisCalAxis(PMS::Axis axis);
154  // Check axis and slice param column appropriately
156  // Check for divide-by-zero (=inf); set to 1.0 and flag it
158  // Trap attempt to use to much memory (too many points)
159  // void trapExcessVolume(map<PMS::Axis,casacore::Bool> pendingLoadAxes);
160 
161  // All
162  // Check divide-by-zero in ratio plot (checkRatioArray)
163  bool divZero_;
164  // Volume meter for volume calculation
165  // PMSCacheVolMeter vm_;
166 
167  // NewCalTable iterator pointers
170  // The polarization basis
172  // Is parameter column complex?
174 
175  // CalTable (cannot plot BPOLY or GSPLINE without MS)
177 };
179 
180 
181 }
182 
183 #endif /* CALCACHE_H_ */
int Int
Definition: aipstype.h:50
casacore::Bool parsAreComplex()
Is the underlying table complex?
Definition: CalCache.h:69
void loadGSpline(std::vector< PMS::Axis > &loadAxes, std::vector< PMS::DataColumn > &loadData, ThreadCommunication *thread=nullptr)
GSPLINE CalTable:
virtual casacore::String polname(casacore::Int ipol)
...not yet CAL-specific...
void loadBPoly(std::vector< PMS::Axis > &loadAxes, std::vector< PMS::DataColumn > &loadData, ThreadCommunication *thread=nullptr)
BPOLY CalTable:
CalCache(PlotMSApp *parent)
Constructor which takes parent PlotMS.
ROCalDescColumns: Read-only cal_desc calibration table column access.
TableExprNode array(const TableExprNode &values, const TableExprNodeSet &shape)
Create an array of the given shape and fill it with the values.
Definition: ExprNode.h:1886
ROGJonesSplineMCol: Read-only GJonesSpline cal_main column access.
Definition: GJonesMCol.h:228
casacore::String toVisCalAxis(PMS::Axis axis)
Utilities for all cal tables: Get axis string for VisCal Slice code.
ROCTIter * ci_p
Volume meter for volume calculation PMSCacheVolMeter vm_;.
Definition: CalCache.h:168
void setUpLoad(ThreadCommunication *thread, casacore::Slice &parSlice)
void getSelectedCube(const casacore::Cube< T > &inputCube, const casacore::Vector< casacore::Slice > &chanSlices, casacore::Cube< T > &outputCube)
cube selected by channel:
virtual void flagToDisk(const PlotMSFlagging &flagging, casacore::Vector< casacore::Int > &chunks, casacore::Vector< casacore::Int > &relids, casacore::Bool flag, PlotMSIndexer *indexer, int index)
ROCTIter: Read-only iterating interface to New Calibration tables.
Definition: CTIter.h:76
void getCalDataAxis(PMS::Axis axis, casacore::Cube< casacore::Complex > &viscube, casacore::Int chunk)
Controller class for plotms.
Definition: PlotMS.h:55
void setMSname(casacore::String msname)
void loadCalChunks(ROCTIter &ci, const std::vector< PMS::Axis > loadAxes, ThreadCommunication *thread)
CTIter * wci_p
Definition: CalCache.h:169
Referenced counted pointer for constant data.
Definition: VisModelData.h:42
define a (start,length,increment) along an axis
Definition: Slice.h:93
void getNamesFromMS()
ROBJonesPolyMCol: Read-only BJonesPoly cal_main column access.
Definition: BJonesMCol.h:184
Specifies flagging parameters (including possibly flag extension) for an MS.
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Array< casacore::Bool > & flag(casacore::Int chunk)
Writable version (limited to certain &#39;columns&#39;)
Definition: CTIter.h:202
void getSelFreqsForSpw(casacore::Vector< casacore::Slice > &chansel, casacore::Vector< casacore::Double > &chanFreqs, casacore::Vector< casacore::Int > &chanNums)
void checkRatioArray(casacore::Array< float > &array, int chunk)
Check for divide-by-zero (=inf); set to 1.0 and flag it.
template &lt;class T, class U&gt; class vector;
Definition: MSFlagger.h:37
virtual void loadIt(std::vector< PMS::Axis > &loadAxes, std::vector< PMS::DataColumn > &loadData, ThreadCommunication *thread=nullptr)
CAL-specific loadIt method.
casacore::CountedPtr< CalCache > CalCachePtr
Definition: CalCache.h:178
casacore::String basis_
The polarization basis.
Definition: CalCache.h:171
PlotMSIndexer & indexer(int dataIndex, casacore::uInt i)
Reference an indexer; returns -1 if there is no indexer for the given dataIndex.
ROSolvableVisJonesMCol: Read-only SolvableVisJones cal_main column access.
PlotMSCacheBase::Type cacheType() const
Identify myself.
Definition: CalCache.h:66
void getChanFreqsFromMS(casacore::Vector< casacore::Vector< casacore::Double > > &mschanfreqs)
void setFilename(casacore::String filename)
given filename, get cal type
void countChunks(ROCTIter &ci, std::vector< PMS::Axis > &loadAxes, std::vector< PMS::DataColumn > &loadData, ThreadCommunication *thread)
Type
TBD: friend class PlotMSData;.
casacore::String msname_
CalTable (cannot plot BPOLY or GSPLINE without MS)
Definition: CalCache.h:176
casacore::Slice getParSlice(casacore::String axis, casacore::String polnSel)
Check axis and slice param column appropriately.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
bool divZero_
Trap attempt to use to much memory (too many points) void trapExcessVolume(map&lt;PMS::Axis,casacore::Bool&gt; pendingLoadAxes);.
Definition: CalCache.h:163
void loadCalAxis(ROCTIter &cti, casacore::Int chunk, PMS::Axis axis, casacore::String pol)
virtual ~CalCache()
Destructor.
Subchunk class Provides the ordered pair identifying the current subchunk The first component is the chunk(goes from 0 to nChunks-1 during the outer loop iteration).The second component is the subchunk number which is zero after VisibilityIterator
void checkAxes(const std::vector< PMS::Axis > &loadAxes)
const Bool True
Definition: aipstype.h:43
Defines communication mechanisms that the model and data can use to communicate with the UI concernin...
void loadNewCalTable(std::vector< PMS::Axis > &loadAxes, std::vector< PMS::DataColumn > &loadData, ThreadCommunication *thread=nullptr)
NewCalTable:
void setUpCalIter(NewCalTable &selct, casacore::Bool readonly=True)
casacore::Bool parsAreComplex_
Is parameter column complex?
Definition: CalCache.h:173