Line data Source code
1 : //# CalVisBuffer.h: A VisBuffer with extra stuff for calibration 2 : //# Copyright (C) 2008 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: VisBuffer.h,v 19.14 2006/02/28 04:48:58 mvoronko Exp $ 27 : 28 : #ifndef MSVIS_CALVISBUFFER_H 29 : #define MSVIS_CALVISBUFFER_H 30 : 31 : #include <casacore/casa/aips.h> 32 : #include <msvis/MSVis/VisBuffer.h> 33 : 34 : namespace casa { //# NAMESPACE CASA - BEGIN 35 : 36 : //#forward 37 : 38 : //<summary>CalVisBuffer extends VisBuffer to support storage and recall of associated residual and differentiated residual data. </summary> 39 : // 40 : // <use visibility=export> 41 : // 42 : // <reviewed reviewer="" date="" tests="" demos=""> 43 : 44 : // <prerequisite> 45 : // <li> <linkto class="VisBuffer">VisBuffer</linkto> 46 : // </prerequisite> 47 : // 48 : // <etymology> 49 : // CalVisBuffer is a VisBuffer for calibration solving 50 : // </etymology> 51 : // 52 : //<synopsis> 53 : // This class extends <linkto class="VisBuffer">VisBuffer to support 54 : // storage and recall of calibration solving-related information 55 : // such as residuals (difference of trial-corrupted model data and 56 : // observed data) and corresponding differentiated residuals. 57 : // 58 : // (say something about synchronization with VisIter, etc.) 59 : // 60 : //</synopsis> 61 : 62 : //<todo> 63 : // <li> write todo list 64 : //</todo> 65 : class CalVisBuffer : public VisBuffer 66 : { 67 : public: 68 : // Create empty VisBuffer you can assign to or attach. 69 : CalVisBuffer(); 70 : // Construct VisBuffer for a particular VisibilityIterator 71 : // The buffer will remain synchronized with the iterator. 72 : CalVisBuffer(ROVisibilityIterator & iter); 73 : 74 : // Copy construct, looses synchronization with iterator: only use buffer for 75 : // current iteration (or reattach). 76 : CalVisBuffer(const CalVisBuffer& cvb); 77 : 78 : // Destructor (detaches from VisIter) 79 : ~CalVisBuffer(); 80 : 81 : // Assignment, looses synchronization with iterator: only use buffer for 82 : // current iteration (or reattach) 83 : CalVisBuffer& operator=(const VisBuffer& cvb); 84 : 85 : // Assignment, optionally without copying the data across; with copy=true 86 : // this is identical to normal assignment operator 87 : CalVisBuffer& assign(const VisBuffer& vb, casacore::Bool copy=true); 88 : 89 : // Update (simple) coord info 90 : // (this OVERRIDES VisBuffer::updateCoordInfo(), which does more) 91 : void updateCoordInfo(const VisBuffer * vb = NULL, const casacore::Bool dirDependent=true); 92 : 93 : // Apply amp-only or phase-only to data 94 : void enforceAPonData(const casacore::String& apmode); 95 : 96 : // Set the focus channel 97 : // (forms references to focus-channel flag/data/model) 98 : void setFocusChan(const casacore::Int focusChan=-1); 99 : 100 : // Size/init/finalize the residuals workspaces 101 : void sizeResiduals(const casacore::Int& nPar,const casacore::Int& nDiff); 102 : void initResidWithModel(); 103 : void finalizeResiduals(); 104 : 105 : // Delete the workspaces 106 : void cleanUp(); 107 : 108 : // <group> 109 : // Access functions 110 : // 111 : 112 : // Access to focus-channel slices of the flags, data, and model 113 : // casacore::Cube<casacore::Bool>& infocusFlagCube() { return infocusFlagCube_p; } 114 : // const casacore::Cube<casacore::Bool>& infocusFlagCube() const {return this->infocusFlagCube();} 115 : 116 0 : casacore::Matrix<casacore::Bool>& infocusFlag() { return infocusFlag_p; } 117 : const casacore::Matrix<casacore::Bool>& infocusFlag() const {return infocusFlag_p;} 118 : 119 : casacore::Cube<casacore::Complex>& infocusVisCube() { return infocusVisCube_p; } 120 : const casacore::Cube<casacore::Complex>& infocusVisCube() const {return infocusVisCube_p;} 121 : 122 : casacore::Cube<casacore::Complex>& infocusModelVisCube() { return infocusModelVisCube_p; } 123 : const casacore::Cube<casacore::Complex>& infocusModelVisCube() const {return infocusModelVisCube_p;} 124 : 125 : // Workspace for the residual visibilities 126 0 : casacore::Cube<casacore::Complex>& residuals() { return residuals_p; } 127 : const casacore::Cube<casacore::Complex>& residuals() const {return residuals_p;} 128 : 129 : // Workspace for flags of the residuals 130 0 : casacore::Matrix<casacore::Bool>& residFlag() { return residFlag_p; } 131 : const casacore::Matrix<casacore::Bool>& residFlag() const {return residFlag_p;} 132 : 133 : // Workspace for the differentiated residuals 134 0 : casacore::Array<casacore::Complex>& diffResiduals() { return diffResiduals_p; } 135 : const casacore::Array<casacore::Complex>& diffResiduals() const {return diffResiduals_p;} 136 : 137 : //</group> 138 : 139 : private: 140 : 141 : // The current in-focus channel 142 : casacore::Int focusChan_p; 143 : 144 : // actual storage for the data 145 : // casacore::Cube<casacore::Bool> infocusFlagCube_p; 146 : casacore::Matrix<casacore::Bool> infocusFlag_p; 147 : casacore::Cube<casacore::Complex> infocusVisCube_p; 148 : casacore::Cube<casacore::Complex> infocusModelVisCube_p; 149 : 150 : casacore::Cube<casacore::Complex> residuals_p; 151 : casacore::Matrix<casacore::Bool> residFlag_p; 152 : casacore::Array<casacore::Complex> diffResiduals_p; 153 : }; 154 : 155 : 156 : } //# NAMESPACE CASA - END 157 : 158 : #endif 159 :