casa
$Rev:20696$
|
00001 //# BJonesPoly.h: A bandpass visibility Jones matrix of polynomial form 00002 //# Copyright (C) 1996,1997,1998,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 //# $Id: BJonesPoly.h,v 19.9 2004/11/30 17:50:47 ddebonis Exp $ 00028 00029 #ifndef SYNTHESIS_BPOLY_H 00030 #define SYNTHESIS_BPOLY_H 00031 00032 #include <synthesis/MeasurementComponents/SolvableVisCal.h> 00033 #include <synthesis/MeasurementComponents/StandardVisCal.h> 00034 00035 namespace casa { //# NAMESPACE CASA - BEGIN 00036 00037 // <summary> A bandpass visibility Jones matrix of polynomial form 00038 // </summary> 00039 00040 // <use visibility=export> 00041 00042 // <reviewed reviewer="" date="" tests="" demos=""> 00043 00044 // <prerequisite> 00045 // <li> <linkto module="BJones">BJones</linkto> module 00046 // </prerequisite> 00047 // 00048 // <etymology> 00049 // BJonesPoly describes a bandpass visibility Jones matrix of 00050 // polynomial form. 00051 // </etymology> 00052 // 00053 // <synopsis> 00054 // 00055 // See <linkto class="VisEquation">VisEquation</linkto> for definition of the 00056 // Visibility Measurement Equation. 00057 // 00058 // The elements of BJonesPoly are only non-zero on the diagonal. 00059 // 00060 // </synopsis> 00061 // 00062 // <motivation> 00063 // Support polynomial bandpass calibration. 00064 // </motivation> 00065 // 00066 // <todo asof="02/02/01"> 00067 // i) Support solution intervals 00068 // </todo> 00069 00070 class VisEquation; 00071 class VisBuffGroupAcc; 00072 00073 class BJonesPoly : public BJones { 00074 public: 00075 00076 // Construct from a visibility data set 00077 BJonesPoly (VisSet& vs); 00078 00079 // Destructor 00080 virtual ~BJonesPoly() {}; 00081 00082 // Return the type enum 00083 virtual Type type() { return VisCal::B; }; 00084 00085 // Return type name as string 00086 virtual String typeName() { return "BPOLY"; }; 00087 virtual String longTypeName() { return "B Jones Poly (bandpass)"; }; 00088 00089 // BPOLY gathers generically... 00090 virtual Bool useGenericGatherForSolve() { return True; }; 00091 // ...then solves for itself per solution: 00092 virtual Bool useGenericSolveOne() { return False; }; 00093 00094 // Type of Jones matrix according to nPar() 00095 virtual Jones::JonesType jonesType() { return Jones::Diagonal; }; 00096 00097 // Set the solver parameters 00098 using BJones::setSolve; 00099 virtual void setSolve(const Record& solvepar); 00100 00101 // Set the interpolation parameters 00102 using BJones::setApply; 00103 virtual void setApply(const Record& applypar); 00104 00105 // Solve 00106 // (old self-directed gather and solve) 00107 // virtual void selfGatherAndSolve(VisSet& vs, VisEquation& ve); 00108 // (new per-solution self-solving inside generic gather) 00109 virtual void selfSolveOne(VisBuffGroupAcc& vbga); 00110 00111 00112 protected: 00113 00114 // BPOLY has two trivial Complex parameter (formed at fill) 00115 virtual Int nPar() { return 2; }; 00116 00117 // Calculate current parameters 00118 virtual void calcPar(); 00119 00120 virtual void loadMemCalTable (String applyTable,String field); 00121 00122 private: 00123 00124 // The underlying VisSet 00125 VisSet* vs_p; 00126 00127 // Private variables containing the solver parameters 00128 Int degamp_p, degphase_p; 00129 Bool visnorm_p; 00130 Int maskcenter_p; 00131 Float maskedge_p; 00132 00133 // Derived solver parameters 00134 // Center mask half width (in channels) 00135 Int maskcenterHalf_p; 00136 // Fractional edge mask 00137 Float maskedgeFrac_p; 00138 00139 // Some meta info 00140 Double solTimeStamp; 00141 Int solSpwId; 00142 Int solFldId; 00143 00144 // CalDescId per spw 00145 Vector<Int> calDescId_p; 00146 00147 // Determine if a given channel is masked 00148 Bool maskedChannel (const Int& chan, const Int& nChan); 00149 00150 // Update the output calibration table to include the 00151 // current solution parameters 00152 void updateCalTable (const String& freqGrpName, 00153 const Vector<Int>& antennaId, 00154 const Vector<String>& polyType, 00155 const Vector<Complex>& scaleFactor, 00156 const Matrix<Double>& validDomain, 00157 const Matrix<Double>& polyCoeffAmp, 00158 const Matrix<Double>& polyCoeffPhase, 00159 const Vector<String>& phaseUnits, 00160 const Vector<Complex>& sideBandRef, 00161 const Vector<MFrequency>& refFreq, 00162 const Vector<Int>& refAnt); 00163 00164 // Compute a Chebyshev polynomial using the CLIC library 00165 Double getChebVal (const Vector<Double>& coeff, const Double& xinit, 00166 const Double& xfinal, const Double& x); 00167 00168 // Load bandpass parameters from a calibration table and 00169 // pre-compute the corrections (and their inverse) 00170 // void load (const String& applyTable); 00171 00172 // Utility function to return the bandwidth-weighted average 00173 // frequency for a set of spectral window id.'s 00174 Double meanFrequency (const Vector<Int>& spwids); 00175 00176 // Utility function to return the frequency group name for a given spw. id. 00177 String freqGrpName (const Int& spwId); 00178 00179 // Utility function to return the spw id.'s in a given freq. group 00180 Vector<Int> spwIdsInGroup (const String& freqGrpName); 00181 00182 // Utility function to return the frequency axis for a given spw. id. 00183 Vector<Double> freqAxis (const Int& spwId); 00184 00185 void plotsolve2(const Vector<Double>& x, 00186 const Matrix<Double>& ampdata, 00187 const Matrix<Double>& phadata, 00188 const Matrix<Double>& wtdata, 00189 const Vector<Int>& ant1idx, const Vector<Int>& ant2idx, 00190 const Vector<Double>& amperr, Matrix<Double>& ampcoeff, 00191 const Vector<Double>& phaerr, Matrix<Double>& phacoeff) ; 00192 00193 }; 00194 00195 00196 } //# NAMESPACE CASA - END 00197 00198 #endif