casa
$Rev:20696$
|
00001 //# PlotMSVBAverager.h: class to average VisBuffers for PlotMS 00002 //# Copyright (C) 2000,2002 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id: VisBuffAccumulator.h,v 19.6 2004/11/30 17:50:38 ddebonis Exp $ 00027 00028 #ifndef PLOTMSVBAVERAGER_H 00029 #define PLOTMSVBAVERAGER_H 00030 00031 #include <casa/aips.h> 00032 #include <synthesis/MSVis/VisBuffer.h> 00033 #include <synthesis/MSVis/CalVisBuffer.h> 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 // <summary> 00038 // A class to average VisBuffers for PlotMS 00039 // </summary> 00040 // 00041 // <use visibility=export> 00042 // 00043 // <reviewed reviewer="" date="yyyy/mm/dd" tests="" demos=""> 00044 // </reviewed> 00045 00046 // <prerequisite> 00047 // <li> VisBuffer 00048 // </prerequisite> 00049 // 00050 // <etymology> 00051 // </etymology> 00052 // 00053 // <synopsis> 00054 // This class averages VisBuffers together for PlotMS 00055 // </synopsis> 00056 // 00057 // <example> 00058 // </example> 00059 // 00060 // <motivation> 00061 // </motivation> 00062 // 00063 // <thrown> 00064 // <li> 00065 // <li> 00066 // </thrown> 00067 // 00068 // <todo asof="2009/04/24"> 00069 // <li> averaging over other indices. 00070 // </todo> 00071 00072 class PlotMSVBAverager 00073 { 00074 public: 00075 // Construct from the number of antennas, the averaging interval and 00076 // the pre-normalization flag 00077 PlotMSVBAverager(Int nAnt,Bool chanDepWt); 00078 00079 // Null destructor 00080 ~PlotMSVBAverager(); 00081 00082 // Set up baseline averaging 00083 inline void setBlnAveraging(Bool doBln) { 00084 blnAve_p=doBln; if (doBln) setAntAveraging(False); }; 00085 // Set up baseline averaging 00086 inline void setAntAveraging(Bool doAnt) { 00087 antAve_p=doAnt; if (doAnt) setBlnAveraging(False); }; 00088 00089 // Set scalar averaging flag 00090 inline void setScalarAve(Bool doScalar) { 00091 // cout << "Using " << (doScalar ? "SCALAR" : "VECTOR") << " averaging." << endl; 00092 inCoh_p = doScalar; }; 00093 00094 // Control which data column to average 00095 inline void setNoData() {doVC_p=doMVC_p=doCVC_p=doWC_p=doUVW_p=False;}; 00096 inline void setDoVC() {doVC_p= doWC_p=True;}; 00097 inline void setDoMVC() {doMVC_p=doWC_p=True;}; 00098 inline void setDoCVC() {doCVC_p=doWC_p=True;}; 00099 inline void setDoUVW() {doUVW_p=True;}; 00100 00101 // Accumulate a VisBuffer 00102 inline void accumulate (VisBuffer& vb) { antAve_p ? antAccumulate(vb) : simpAccumulate(vb); }; 00103 00104 // Finalize averaging, and return the result 00105 void finalizeAverage(); 00106 00107 // Return a reference to the result 00108 // TBD: is it ok to return a CVB as a VB reference? (do I need an 00109 // explicit cast here? 00110 VisBuffer& aveVisBuff() { return avBuf_p; } 00111 CalVisBuffer& aveCalVisBuff() { return avBuf_p; } 00112 00113 private: 00114 // Prohibit null constructor, copy constructor and assignment for now 00115 PlotMSVBAverager(); 00116 PlotMSVBAverager& operator= (const PlotMSVBAverager&); 00117 PlotMSVBAverager (const PlotMSVBAverager&); 00118 00119 // Diagnostic printing level 00120 Int& prtlev() { return prtlev_; }; 00121 00122 // Initialize the next accumulation interval 00123 // (should this be public?) 00124 void initialize(VisBuffer& vb); 00125 00126 // Different accumulate versions 00127 void simpAccumulate (VisBuffer& vb); // ordinary 00128 void antAccumulate (VisBuffer& vb); // antenna-based averaging version 00129 00130 // Verify zero or two crosshands present (if antAve_p) 00131 void verifyCrosshands(VisBuffer& vb); 00132 00133 // Hash function to return the row offset for an interferometer (ant1, ant2) 00134 Int baseline(const Int& ant1, const Int& ant2); 00135 00136 // Convert r/i to a/p 00137 void convertToAP(Cube<Complex>& d); 00138 00139 // Number of antennas, correlations, and channels 00140 Int nAnt_p, nCorr_p, nChan_p, nBlnMax_p; 00141 00142 // Weights in input VBs are chan-independent 00143 Bool chanIndepWt_p; 00144 00145 // Validation by baseline (if False, no attempt to accumulate this baseline) 00146 Vector<Bool> blnOK_p; 00147 00148 // Are we averaging baselines together? 00149 Bool blnAve_p; 00150 00151 // Are we averaging antennas together? 00152 Bool antAve_p; 00153 00154 // Are we incoherently (scalar) averaging? 00155 Bool inCoh_p; 00156 00157 // Accumulation helpers... 00158 Double timeRef_p; 00159 Double minTime_p; 00160 Double maxTime_p; 00161 Double aveTime_p; 00162 Double aveInterval_p; 00163 Vector<Double> blnWtSum_p; 00164 Double vbWtSum_p; 00165 Int aveScan_p; 00166 00167 // Optional averaging triggers 00168 Bool doVC_p,doMVC_p,doCVC_p,doUVW_p,doWC_p; 00169 00170 // Accumulation buffer 00171 CalVisBuffer avBuf_p; 00172 00173 // Keep track of initialization state 00174 Bool initialized_p; 00175 00176 // Correlation list for cross-hand swapping 00177 Vector<Int> jcor_p; 00178 00179 // Diagnostic print level 00180 Int prtlev_; 00181 00182 }; 00183 00184 00185 } //# NAMESPACE CASA - END 00186 00187 #endif 00188 00189