casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PlotMSVBAverager.h
Go to the documentation of this file.
1 //# PlotMSVBAverager.h: class to average VisBuffers for PlotMS
2 //# Copyright (C) 2000,2002
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: VisBuffAccumulator.h,v 19.6 2004/11/30 17:50:38 ddebonis Exp $
27 
28 #ifndef PLOTMSVBAVERAGER_H
29 #define PLOTMSVBAVERAGER_H
30 
31 #include <casa/aips.h>
32 #include <msvis/MSVis/VisBuffer2.h>
33 #include <casa/Arrays/Vector.h>
34 #include <casa/Arrays/Matrix.h>
35 #include <casa/Arrays/Cube.h>
36 
37 namespace casa { //# NAMESPACE CASA - BEGIN
38 
39 // <summary>
40 // A class to average VisBuffers for PlotMS
41 // </summary>
42 //
43 // <use visibility=export>
44 //
45 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos="">
46 // </reviewed>
47 
48 // <prerequisite>
49 // <li> VisBuffer2
50 // </prerequisite>
51 //
52 // <etymology>
53 // </etymology>
54 //
55 // <synopsis>
56 // This class averages VisBuffers together for PlotMS
57 // </synopsis>
58 //
59 // <example>
60 // </example>
61 //
62 // <motivation>
63 // </motivation>
64 //
65 // <thrown>
66 // <li>
67 // <li>
68 // </thrown>
69 //
70 // <todo asof="2009/04/24">
71 // <li> averaging over other indices.
72 // </todo>
73 
75 {
76 public:
77  // Construct from the number of antennas, the averaging interval and
78  // the pre-normalization flag
80 
81  // Null destructor
83 
84  // Set up baseline averaging
85  inline void setBlnAveraging(casacore::Bool doBln) {
86  blnAve_p = doBln; if (doBln) setAntAveraging(false); };
87  // Set up antenna averaging
88  inline void setAntAveraging(casacore::Bool doAnt) {
89  antAve_p = doAnt; if (doAnt) setBlnAveraging(false); };
90  // Set scalar averaging flag
91  inline void setScalarAve(casacore::Bool doScalar) {
92  // cout << "Using " << (doScalar ? "SCALAR" : "VECTOR") << " averaging." << endl;
93  inCoh_p = doScalar; };
94 
95  // Control which data column to average
96  inline void setNoData() {doVC_p = doMVC_p = doCVC_p = doFC_p = doWC_p =
97  doUVW_p = false;};
98  inline void setDoVC() {doVC_p = doWC_p = true;};
99  inline void setDoMVC() {doMVC_p = doWC_p = true;};
100  inline void setDoCVC() {doCVC_p = doWC_p = true;};
101  inline void setDoFC() {doFC_p = doWC_p = true;};
102  inline void setDoUVW() {doUVW_p = true;};
103 
104  // Accumulate a VisBuffer
105  inline void accumulate (vi::VisBuffer2& vb) { antAve_p ? antAccumulate(vb) : simpAccumulate(vb); };
106 
107  // Finalize averaging
108  void finalizeAverage();
109 
110  // Return a reference to the result
112 
113 private:
114  // Prohibit null constructor, copy constructor and assignment for now
118 
119  // Diagnostic printing level
120  casacore::Int& prtlev() { return prtlev_; };
121 
122  // Initialize the next accumulation interval
123  void initialize(vi::VisBuffer2& vb);
124 
125  // Different accumulate versions
126  void simpAccumulate (vi::VisBuffer2& vb); // ordinary
127  void antAccumulate (vi::VisBuffer2& vb); // antenna-based averaging version
128 
129  // Verify zero or two crosshands present (if antAve_p)
131 
132  // Hash function to return the row offset for an interferometer (ant1, ant2)
133  casacore::Int baseline(const casacore::Int& ant1, const casacore::Int& ant2);
134 
135  // Convert r/i to a/p
137 
138  // fill vector that is resized larger
139  void fillIds(casacore::Int nrows);
140 
141  // Number of antennas, correlations, and channels
143 
144  // Weights in input VBs are chan-independent
146 
147  // Validation by baseline (if false, no attempt to accumulate this baseline)
149 
150  // Are we averaging baselines together?
152 
153  // Are we averaging antennas together?
155 
156  // Are we incoherently (scalar) averaging?
158 
159  // Accumulation helpers...
168 
169  // Optional averaging triggers
171 
172  // Accumulation buffer
174 
175  // Keep track of initialization state
177 
178  // Correlation list for cross-hand swapping
180 
181  // Diagnostic print level
183 
184  // Mutable arrays, set in avBuf_p when finalized
198  // Need to resize these in final avBuf
203 };
204 
205 
206 } //# NAMESPACE CASA - END
207 
208 #endif
209 
210 
void convertToAP(casacore::Cube< casacore::Complex > &d)
Convert r/i to a/p.
void antAccumulate(vi::VisBuffer2 &vb)
int Int
Definition: aipstype.h:50
vi::VisBuffer2 * avBuf_p
Accumulation buffer.
void finalizeAverage()
Finalize averaging.
void simpAccumulate(vi::VisBuffer2 &vb)
Different accumulate versions.
casacore::Vector< casacore::Int > stateid_
casacore::Int baseline(const casacore::Int &ant1, const casacore::Int &ant2)
Hash function to return the row offset for an interferometer (ant1, ant2)
PlotMSVBAverager & operator=(const PlotMSVBAverager &)
casacore::Vector< casacore::Double > avgTimeInterval_
casacore::Int & prtlev()
Diagnostic printing level.
casacore::Bool antAve_p
Are we averaging antennas together?
casacore::Int prtlev_
Diagnostic print level.
void setBlnAveraging(casacore::Bool doBln)
Set up baseline averaging.
casacore::Cube< casacore::Complex > avgVisCube_
Mutable arrays, set in avBuf_p when finalized.
casacore::Vector< casacore::Int > spw_
casacore::Vector< casacore::Int > obsid_
casacore::Bool chanIndepWt_p
Weights in input VBs are chan-independent.
casacore::Vector< casacore::Int > jcor_p
Correlation list for cross-hand swapping.
A class to average VisBuffers for PlotMS.
vi::VisBuffer2 & aveVisBuff()
Return a reference to the result.
casacore::Cube< casacore::Bool > avgFlagCube_
PlotMSVBAverager()
Prohibit null constructor, copy constructor and assignment for now.
void setAntAveraging(casacore::Bool doAnt)
Set up antenna averaging.
~PlotMSVBAverager()
Null destructor.
double Double
Definition: aipstype.h:55
casacore::Int nAnt_p
Number of antennas, correlations, and channels.
void fillIds(casacore::Int nrows)
fill vector that is resized larger
casacore::Vector< casacore::Bool > avgFlagRow_
casacore::Bool inCoh_p
Are we incoherently (scalar) averaging?
casacore::Double aveTime_p
casacore::Vector< casacore::Int > avgAntenna1_
casacore::Double maxTime_p
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Vector< casacore::Int > fieldid_
Need to resize these in final avBuf.
casacore::Vector< casacore::Int > avgAntenna2_
casacore::Cube< casacore::Float > avgFloatCube_
casacore::Cube< casacore::Float > avgWeight_
casacore::Bool initialized_p
Keep track of initialization state.
casacore::Double minTime_p
casacore::Vector< casacore::Int > avgScan_
casacore::Double vbWtSum_p
casacore::Cube< casacore::Complex > avgModelCube_
void verifyCrosshands(vi::VisBuffer2 &vb)
Verify zero or two crosshands present (if antAve_p)
casacore::Vector< casacore::Double > blnWtSum_p
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
casacore::Cube< casacore::Complex > avgCorrectedCube_
void accumulate(vi::VisBuffer2 &vb)
Accumulate a VisBuffer.
casacore::Vector< casacore::Bool > blnOK_p
Validation by baseline (if false, no attempt to accumulate this baseline)
void setScalarAve(casacore::Bool doScalar)
Set scalar averaging flag.
void setNoData()
Control which data column to average.
casacore::Double aveInterval_p
casacore::Matrix< casacore::Double > avgUvw_
casacore::Vector< casacore::Double > avgTime_
casacore::Bool doVC_p
Optional averaging triggers.
casacore::Double timeRef_p
Accumulation helpers...
void initialize(vi::VisBuffer2 &vb)
Initialize the next accumulation interval.
casacore::Bool blnAve_p
Are we averaging baselines together?