casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MsAverager.h
Go to the documentation of this file.
1 //# MsAverager.h: Measurement Sets (Visiablity Averager)
2 //# Copyright (C) 2003
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 //#
27 //#
28 //# -------------------------------------------------------------------------
29 
30 #if !defined MSAVERAGER_H
31 #define MSAVERAGER_H
32 
33 
34 #include <casa/aips.h>
35 
37 //#include <tables/Tables/Table.h>
41 
44 
45 #include <list>
46 
47 #include <msvis/MSVis/VisBuffer.h>
49 #include <msvis/MSVis/VisSet.h>
50 //#include <msvis/MSVis/SubMS.h>
52 
53 
54 
56 //# Start of documentation.
57 //
58 // <summary>
59 // A class to average a visibilty data set in time and/or channel
60 // </summary>
61 //
62 // <use visibility=export>
63 //
64 // <reviewed reviewer="Me" date="2007/12/25" tests="" demos="">
65 // </reviewed>
66 
67 // <prerequisite>
68 // <li> VisBuffer
69 // <li> MeasurementSet
70 // </prerequisite>
71 //
72 // <etymology>
73 // From "visibility", "time", "channel", "polarization" and "averaging".
74 // </etymology>
75 //
76 // <synopsis>
77 // This class averages VisBuffers in time, channel.
78 // </synopsis>
79 //
80 // <example>
81 // casacore::MS ms("ngc5921.ms" casacore::Table::Update);
82 // MsAverager msa(ms);
83 // //chanlist is matrix of int its rows [spwid, start, end, step]
84 // msa.setAverager(chanlist, 90, 32, "data", "SCALAR");
85 // if (msa.ok()) {
86 // casacore::MS avems;
87 // msa.getMS(avems);
88 // }
89 //
90 // </example>
91 //
92 // <motivation>
93 // Provide time/channel averaging capabilities for plotxy.
94 // </motivation>
95 //
96 // <thrown>
97 // <li>
98 // <li>
99 // </thrown>
100 //
101 // <todo asof="2007/12/25">
102 // <li> everything, and
103 // <li> everything else
104 // </todo>
105 
106 //# End of documentation.
108 
109 namespace casa {
110 
111 
113 {
114 
115 public:
116  enum OutputMode {
117  TableMS = 1,
119  };
120 
122  ~MsAverager();
123 
125  void getMS(casacore::MS& ms);
129 
130  //average engine and its status
131  void setAverager(
135  const casacore::String& column = "DATA",
136  const casacore::String& aveMode = "VECTOR",
137  const casacore::Bool& aveFlag = false,
138  const casacore::Bool& aveScan = false,
139  const casacore::Bool& aveBline = false,
140  const casacore::Bool& aveArray = false,
141  const casacore::Bool& aveVelo = false,
142  const casacore::String& restfreq = "",
143  const casacore::String& frame = "",
144  const casacore::String& doppler = "");
145  casacore::Bool ok() {return aveOK;}
147 
148  void showColumnNames();
150  casacore::Bool hasColumn(const casacore::String& colName);
151  static casacore::Int baselineRow(const casacore::Int& nAnt, const casacore::Int& a, const casacore::Int& b);
152  casacore::Int baselineRow(const casacore::Int& a = -1, const casacore::Int& b = -1);
153 
154  void putAveBuffer(casacore::Double bufTime, casacore::Int bufField, casacore::Int bufScan,
155  casacore::Int bufArray, VisBuffer& p, casacore::Int nTime);
157  void putAveTable(casacore::Double bufTime, casacore::Int bufField, casacore::Int bufScan,
158  casacore::Int bufArray, casacore::Int bufSpw, VisBuffer& p, casacore::Int nTime,
159  casacore::Double timeShift);
163 
164  const static casacore::String DataColumn[4];
168 
169 private:
170  //to be averaged
171  void cleanup();
175  //casacore::MSDerivedValues *msdv;
176 
177  //averaged, store as MS
181  //casacore::MSColumns *msc;
182 
183  //averaged, store as VBs
185  std::list<VisBuffer*> aveList;
186 
187  //averaging inputs, ideally, calculate only needed column
189 
190  //selected channels for each piece for spw expression
191  //each row contains [spwid, start, end, stride]
192  //may contains multiple rows of same spwid
194 
196 
197  //map between averaged and original
199  //casacore::Matrix<casacore::Double> aveTimeMap;
201 
202  //averaging requirements
214 
215  //size of the averaged
221 
225 
227 
228  //utility
229  static const casacore::String clname;
230  //SLog *log;
231 
233 
234 
235 };
236 
237 
238 }
239 #endif
240 
241 
static const casacore::String DataColumn[4]
Definition: MsAverager.h:164
int outputMode
SLog *log;.
Definition: MsAverager.h:232
int Int
Definition: aipstype.h:50
casacore::Bool aveFlag
Definition: MsAverager.h:206
casacore::Int nAveChan
size of the averaged
Definition: MsAverager.h:216
casacore::Vector< SAS > spw
Definition: MsAverager.h:195
casacore::Int nAveTime
Definition: MsAverager.h:217
casacore::Bool aveOK
Definition: MsAverager.h:226
casacore::Int nAnt()
Definition: MsAverager.h:167
void setAverager(const casacore::Matrix< casacore::Int > &chanList, const casacore::Matrix< casacore::Int > &baselines, casacore::Double aveTime, casacore::Int aveChan, const casacore::String &column="DATA", const casacore::String &aveMode="VECTOR", const casacore::Bool &aveFlag=false, const casacore::Bool &aveScan=false, const casacore::Bool &aveBline=false, const casacore::Bool &aveArray=false, const casacore::Bool &aveVelo=false, const casacore::String &restfreq="", const casacore::String &frame="", const casacore::String &doppler="")
average engine and its status
void initAveBuffer(casacore::Double bufTime, VisBuffer &p, casacore::Int nAnt, casacore::Int nChan)
void putAveBuffer(casacore::Double bufTime, casacore::Int bufField, casacore::Int bufScan, casacore::Int bufArray, VisBuffer &p, casacore::Int nTime)
casacore::Bool crossBlines
Definition: MsAverager.h:208
casacore::Double aveTime
Definition: MsAverager.h:204
casacore::Bool ok()
Definition: MsAverager.h:145
static casacore::Int baselineRow(const casacore::Int &nAnt, const casacore::Int &a, const casacore::Int &b)
casacore::Bool crossArrays
Definition: MsAverager.h:209
casacore::String column
averaging inputs, ideally, calculate only needed column
Definition: MsAverager.h:188
casacore::Int aveChan
Definition: MsAverager.h:205
casacore::Matrix< casacore::Int > aveChanMap
map between averaged and original
Definition: MsAverager.h:198
casacore::MS * pMS
Definition: MsAverager.h:172
casacore::Int npol()
Definition: MsAverager.h:165
void cleanup()
to be averaged
casacore::Int nchan()
Definition: MsAverager.h:166
casacore::Matrix< casacore::Int > chanList
selected channels for each piece for spw expression each row contains [spwid, start, end, stride] may contains multiple rows of same spwid
Definition: MsAverager.h:193
void getMS(casacore::MS &ms)
std::list< VisBuffer * > aveList
Definition: MsAverager.h:185
casacore::MS aMS
casacore::MSDerivedValues *msdv;
Definition: MsAverager.h:178
casacore::Bool crossScans
Definition: MsAverager.h:207
casacore::Int msRow
Definition: MsAverager.h:179
void putAveTable(casacore::Double bufTime, casacore::Int bufField, casacore::Int bufScan, casacore::Int bufArray, casacore::Int bufSpw, VisBuffer &p, casacore::Int nTime, casacore::Double timeShift)
casacore::String restfreq
Definition: MsAverager.h:222
void getXY(casacore::Vector< casacore::Double > &x, casacore::Vector< casacore::Double > &y, casacore::Vector< casacore::Int > &f, casacore::Int pol)
casacore::String doppler
Definition: MsAverager.h:224
casacore::String msName
Definition: MsAverager.h:174
void reset(casacore::MS *, OutputMode=MsAverager::TableMS)
casacore::Bool aveVel
Definition: MsAverager.h:211
casacore::Bool crossSpws
Definition: MsAverager.h:210
double Double
Definition: aipstype.h:55
casacore::Int nAveRow
Definition: MsAverager.h:218
MsAverager(casacore::MS *, OutputMode=MsAverager::TableMS)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
void showColumnNames()
casacore::Matrix< casacore::Int > aveRowMap
casacore::Matrix&lt;casacore::Double&gt; aveTimeMap;
Definition: MsAverager.h:200
void showVisRow(casacore::Cube< casacore::Complex > &vc, casacore::Int row)
A Table intended to hold astronomical data (a set of Measurements).
casacore::Bool isDataColumn(const casacore::String &colNmae)
void getMap(casacore::Matrix< casacore::Int > &rowMap, casacore::Matrix< casacore::Int > &chanMap)
casacore::Matrix< casacore::Int > baselines
Definition: MsAverager.h:213
casacore::Bool hasColumn(const casacore::String &colName)
casacore::Int outputFormat()
Definition: MsAverager.h:146
casacore::String aveMode
averaging requirements
Definition: MsAverager.h:203
VisBuffer * pAveBuff
casacore::MSColumns *msc;
Definition: MsAverager.h:184
A class for easy read-write access to MeasurementSet main table columns.
casacore::Bool sorryVel
Definition: MsAverager.h:212
casacore::Int nAvePol
Definition: MsAverager.h:219
void showAveMap(casacore::Matrix< casacore::Int > &rmap, casacore::Matrix< casacore::Int > &cmap)
String: the storage and methods of handling collections of characters.
Definition: String.h:223
static const casacore::String clname
utility
Definition: MsAverager.h:229
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
casacore::MSMainColumns * msc
Definition: MsAverager.h:180
casacore::Int nAntenna
Definition: MsAverager.h:220
casacore::String frame
Definition: MsAverager.h:223
void showMsRow(casacore::MSMainColumns *msc, casacore::Int row)