casa
$Rev:20696$
|
00001 //# VisEquation.h: Interface definition for Vis Equation 00002 //# Copyright (C) 1996,1997,1999,2000,2001,2002,2003 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 adressed 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 //# 00027 00028 #ifndef SYNTHESIS_VISEQUATION_H 00029 #define SYNTHESIS_VISEQUATION_H 00030 00031 #include <casa/aips.h> 00032 #include <casa/BasicSL/Complex.h> 00033 #include <casa/Arrays/Array.h> 00034 #include <casa/Arrays/Cube.h> 00035 #include <synthesis/MSVis/VisBuffer.h> 00036 #include <synthesis/MeasurementComponents/VisCal.h> 00037 #include <synthesis/MeasurementComponents/SolvableVisCal.h> 00038 00039 namespace casa { //# NAMESPACE CASA - BEGIN 00040 00041 // <summary> 00042 // Visibility Measurement Equation 00043 // </summary> 00044 00045 // <use visibility=export> 00046 00047 // <reviewed reviewer="" date="" tests="" demos=""> 00048 00049 // <prerequisite> 00050 // <li> <linkto module="MeasurementComponents">MeasurementComponents</linkto> module 00051 // </prerequisite> 00052 // 00053 // <etymology> 00054 // Visibility Equation describes a model for measurements from a 00055 // generic synthesis telescope 00056 // </etymology> 00057 // 00058 // <synopsis> 00059 // This is responsible for the Measurement Equation of the Generic 00060 // Interferometer due to Hamaker, Bregman and Sault and later extended 00061 // by Noordam, and Cornwell. 00062 // 00063 // See <linkto module="MeasurementEquations">MeasurementEquations</linkto> 00064 // for more details of the form of the VisEquation. 00065 // 00066 // VisEquation provides the following: 00067 // <ul> 00068 // <li> Sorting of calibration terms (VisCals) in the Visibility Equation 00069 // <li> Application of calibration terms to data (via delegation to VisCals) 00070 // <li> Delivery of other evaluations of the VisEquation, e.g., (differentiated) residuals 00071 // </ul> 00072 // </synopsis> 00073 // 00074 // <example> 00075 // <srcblock> 00076 // 00077 // </srcblock> 00078 // </example> 00079 // 00080 // <motivation> 00081 // VisEquation is part of a framework of classes that are 00082 // designed for synthesis calibration and imaging. The others are the 00083 // <linkto module=MeasurementComponents>MeasurementComponents</linkto>. 00084 // </motivation> 00085 // 00086 // <todo asof=""> 00087 // </todo> 00088 00089 class VisEquation { 00090 public: 00091 00092 // Contructor 00093 VisEquation(); 00094 00095 // Copy ctor 00096 VisEquation(const VisEquation& other); 00097 00098 // Destructor 00099 virtual ~VisEquation(); 00100 00101 // Assignment 00102 VisEquation& operator=(const VisEquation& other); 00103 00104 // Arrange for apply of a VisCal list (i.e., sort them into the correct order) 00105 void setapply(PtrBlock<VisCal*>& vcin); 00106 00107 // Arrange for solve of a single SolvableVisCal 00108 void setsolve(SolvableVisCal& svc); 00109 00110 // Arrange a pivot point for evaluating the equation in collapseForSim 00111 void setPivot(VisCal::Type pivot); 00112 00113 // Arrange the model to use for calibration 00114 void setModel(const Vector<Float>& stokes); 00115 inline void unSetModel() { useInternalModel_=False; }; 00116 00117 // Report if spw has solutions available from all applied tables 00118 Bool spwOK(const Int& spw); 00119 00120 // Correct in place the OBSERVED visibilities in a VisBuffer 00121 // with the apply-able VisCals 00122 void correct(VisBuffer& vb, Bool trial=False); 00123 00124 // Report flag-by-cal statistics 00125 Record actionRec(); 00126 00127 // Corrupt in place the MODEL visibilities in a VisBuffer 00128 // with the apply-able VisCals 00129 void corrupt(VisBuffer& vb); 00130 00131 // Correct/Corrupt in place the OBSERVED/MODEL visibilities in a VisBuffer 00132 // with the apply-able VisCals on either side of the SolvableVisCal 00133 void collapse(VisBuffer& vb); 00134 00135 00136 // This collapse avoids I/O (assumes the vb data/model are ready), 00137 // and uses a generic pivot (see setPivot) rather than the svc 00138 // void collapseForSim(VisBuffer& vb); 00139 void collapseForSim(VisBuffer& vb); 00140 00141 // Calculate residuals 00142 // (optionally for specific chan) 00143 void residuals(VisBuffer& vb, 00144 Cube<Complex>& R, 00145 const Int chan=-1); 00146 00147 // Calculate residuals and differentiated residuals 00148 // (optionally for specific chan) 00149 void diffResiduals(CalVisBuffer& cvb); 00150 void diffResiduals(VisBuffer& vb, 00151 Cube<Complex>& R, 00152 Array<Complex>& dR, 00153 Matrix<Bool>& Rflg); 00154 void diffResiduals(VisBuffer& R, 00155 VisBuffer& dR0, 00156 VisBuffer& dR1, 00157 Matrix<Bool>& Rflg); 00158 00159 00160 // Report the VisEq's state 00161 void state(); 00162 00163 inline const VisCal::Type pivot() const { return pivot_; }; 00164 00165 // Set the print level 00166 inline void setPrtlev(const Int& prtlev) { prtlev_=prtlev; }; 00167 00168 protected: 00169 00170 Bool ok(); 00171 00172 // Access to the PB of apply terms 00173 inline PtrBlock<VisCal*>& vc() { return (*vcpb_); }; 00174 00175 // Access to SVC 00176 inline SolvableVisCal& svc() { return *svc_; }; 00177 00178 // Detect freq dependence along the Vis Equation 00179 void setFreqDep(); 00180 00181 private: 00182 00183 // Diagnostic print level access 00184 inline Int& prtlev() { return prtlev_; }; 00185 00186 // A local copy of the list of VisCal (pointers) for applying 00187 // (No ownership responsibilities) 00188 PtrBlock<VisCal*>* vcpb_; 00189 00190 // Number of apply VisCals in vc_ 00191 Int napp_; 00192 00193 // Frequency dependence indices 00194 Int lfd_; // Right-most freq-dep term on LEFT side 00195 Int rfd_; // Left-most freq-dep term on RIGHT side 00196 00197 // Trap for frequency averaging in collapse 00198 Bool freqAveOK_; 00199 00200 // VisCal with solving interface 00201 // (No ownership responsibilities) 00202 SolvableVisCal* svc_; 00203 00204 // The pivot point used by collapse2 00205 VisCal::Type pivot_; 00206 00207 // An internal (global) point source model 00208 Bool useInternalModel_; 00209 Vector<Float> stokesModel_; 00210 00211 // Diagnostic print level 00212 Int prtlev_; 00213 00214 }; 00215 00216 } //# NAMESPACE CASA - END 00217 00218 #endif