casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GSpline.h
Go to the documentation of this file.
1 //# GJonesPoly.h: Electronic gain Jones matrix as polynomials over time
2 //# Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003
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 adressed 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 //#
27 //# $Id: GJonesPoly.h,v 19.7 2004/11/30 17:50:48 ddebonis Exp $
28 
29 #ifndef SYNTHESIS_GSPLINE_H
30 #define SYNTHESIS_GSPLINE_H
31 
35 
36 namespace casa { //# NAMESPACE CASA - BEGIN
37 
38 // <summary> Electronic gain Jones matrix as spline polynomial over time
39 // </summary>
40 
41 // <use visibility=export>
42 
43 // <reviewed reviewer="" date="" tests="" demos="">
44 
45 // <prerequisite>
46 // <li> <linkto module="GJones">GJones</linkto> module
47 // <li> <linkto module="GJonesPoly">GJonesPoly</linkto> module
48 // </prerequisite>
49 //
50 // <etymology>
51 // GJonesSpline describes the electronic gain visibility Jones matrix
52 // parametrized as a spline polynomial over time.
53 // </etymology>
54 //
55 // <synopsis>
56 //
57 // See <linkto class="VisEquation">VisEquation</linkto> for definition of the
58 // Visibility Measurement Equation.
59 //
60 // The elements of GJonesSpline are only non-zero on the diagonal.
61 //
62 // </synopsis>
63 //
64 // <motivation>
65 // Support electronic gain calibration using splines polynomials over time.
66 // </motivation>
67 //
68 // <todo asof="02/02/01">
69 // i) Support solution and pre-averaging intervals
70 // </todo>
71 
72 class VisEquation;
73 
74 class GJonesSpline : public GJones {
75 public:
76 
77  // Construct from a visibility data set
78  GJonesSpline (VisSet& vs);
79 
80  // Construct from a MSMetaInfoForCal
82 
83  // Destructor
84  virtual ~GJonesSpline();
85 
86  // Return the type enum
87  virtual Type type() { return VisCal::G; };
88 
89  // Return type name as a string
90  virtual casacore::String typeName() { return "GSPLINE"; };
91  virtual casacore::String longTypeName() { return "G Jones SPLINE (elec. gain)"; };
92 
93 
94  // GSpline gathers/solves for itself
95  virtual casacore::Bool useGenericGatherForSolve() { return false; };
96 
97  // Type of Jones matrix according to nPar()
98  // TBD:
100 
101  // Set the solver parameters
102  using GJones::setSolve;
103  virtual void setSolve(const casacore::Record& solvepar);
104 
105  // Set the interpolation parameters
106  using GJones::setApply;
107  virtual void setApply(const casacore::Record& applypar);
108 
109  // Solve
110  virtual void selfGatherAndSolve (VisSet& vs, VisEquation& ve);
111 
112 /*
113  // Set raw phase transfer from another spw
114  void setRawPhaseVisSet(VisSet& rawvs_p);
115 
116  // Set parameters for phase wrapping resolution
117  void setPhaseWrapHelp(const casacore::Int& numpoi, const casacore::Double& phaseWrap);
118 */
119  // Expose calculating pars for plotting
120  inline void doCalcPar() { calcPar(); }
121 
122  protected:
123 
124  // GSPLINE has one trivial casacore::Complex parameter (single pol, for now)
125  // TBD:
126  virtual casacore::Int nPar() { return 2; };
127 
128  // Calc G pars from spline info
129  virtual void calcPar();
130 
131  private:
132 
133  // The underlying VisSet
135 
136  // Private variables containing the solver parameters
139 
140  // casacore::Time for which the current calibration cache is valid
141  //casacore::Double cacheTimeValid_p;
142 
143  // Ptr to a calibration buffer associated with the calibration
144  // solutions which are to be interpolated and applied to the data
146 
147 
148  // Parameters for raw phase removal from another spw
149  //VisSet* rawvs_p;
150  //casacore::Bool rawPhaseRemoval_p;
151  std::map<casacore::String, casacore::Int> timeValueMap_p;
153 
154  // Solution timestamp
156 
157 
158  // Create and fill an empty output calibration buffer
159  void newCalBuffer (const casacore::Vector<casacore::Int>& fieldIdKeys,
160  const casacore::Vector<casacore::Int>& antennaId);
161 
162  // Compute the number of spline knots required and their location
164 
165  // Update the output calibration table
166  virtual void updateCalTable (const casacore::Vector<casacore::Int>& fieldIdKeys,
167  const casacore::Vector<casacore::Int>& antennaId,
168  const casacore::Vector<casacore::String>& freqGrpName,
169  const casacore::Vector<casacore::String>& polyType,
170  const casacore::Vector<casacore::String>& polyMode,
171  const casacore::Vector<casacore::Complex>& scaleFactor,
172  const casacore::Matrix<casacore::Double>& polyCoeffAmp,
173  const casacore::Matrix<casacore::Double>& polyCoeffPhase,
174  const casacore::Vector<casacore::String>& phaseUnits,
175  const casacore::Vector<casacore::Double>& splineKnotsAmp,
176  const casacore::Vector<casacore::Double>& splineKnotsPhase,
178  const casacore::Vector<casacore::Int>& refAnt);
179 
180  // Compute a spline polynomial value
183 
184 
185 /*
186  // fill the raw phase buffer for usage
187  void fillRawPhaseBuff();
188 
189  // return the rawphase of
190  casacore::Double getRawPhase(casacore::Int ant1, casacore::Int ant2, casacore::Double time);
191 
192 */
193 
194  //Plot solutions as compare with data
197  const casacore::Matrix<casacore::Double>& weightall,
198  const casacore::Vector<casacore::Double>& errall,
200 
201  // Return all field id.'s in the underlying MS
203 
204  //Logging solution and rms
205  void writeAsciiLog(const casacore::String& filename, const casacore::Matrix<casacore::Double>& coeff, const casacore::Vector<casacore::Double>& rmsFit, casacore::Bool phasesoln);
206 
209 
210 
211 };
212 
213 
214 } //# NAMESPACE CASA - END
215 
216 #endif
217 
218 
void writeAsciiLog(const casacore::String &filename, const casacore::Matrix< casacore::Double > &coeff, const casacore::Vector< casacore::Double > &rmsFit, casacore::Bool phasesoln)
Logging solution and rms.
int Int
Definition: aipstype.h:50
std::map< casacore::String, casacore::Int > timeValueMap_p
Parameters for raw phase removal from another spw VisSet* rawvs_p; casacore::Bool rawPhaseRemoval_p;...
Definition: GSpline.h:151
virtual Jones::JonesType jonesType()
Type of Jones matrix according to nPar() TBD:
Definition: GSpline.h:99
virtual casacore::String typeName()
Return type name as a string.
Definition: GSpline.h:90
casacore::Double solTimeStamp_p
Solution timestamp.
Definition: GSpline.h:155
virtual casacore::String longTypeName()
Definition: GSpline.h:91
virtual Type type()
Return the type enum.
Definition: GSpline.h:87
casacore::Bool solvePhase_p
Definition: GSpline.h:137
VisSet * vs_p
The underlying VisSet.
Definition: GSpline.h:134
*void plotsolve(const casacore::Vector< casacore::Double > &x, const casacore::Matrix< casacore::Double > &yall, const casacore::Matrix< casacore::Double > &weightall, const casacore::Vector< casacore::Double > &errall, casacore::Matrix< casacore::Double > &coeff, casacore::Bool phasesoln)
Plot solutions as compare with data.
virtual void setApply()
Set the application parameters.
casacore::Double & refFreq()
Definition: VisCal.h:259
virtual ~GJonesSpline()
Destructor.
virtual casacore::Int nPar()
GSPLINE has one trivial casacore::Complex parameter (single pol, for now) TBD:
Definition: GSpline.h:126
Type
Allowed types of VisCal matrices - &#39;correct&#39; order enum Type{UVMOD,Mf,M,K,B,G,D,C,E,P,T,EP,F}; enum Type{Test=0,ANoise,M,KAntPos,K,B,G,J,D,X,C,P,E,T,F,A,ALL};.
Definition: VisCal.h:62
double Double
Definition: aipstype.h:55
casacore::Int getKnots(const casacore::Vector< casacore::Double > &times, casacore::Vector< casacore::Double > &knots)
Compute the number of spline knots required and their location.
casacore::Double splinetime_p
Definition: GSpline.h:138
void newCalBuffer(const casacore::Vector< casacore::Int > &fieldIdKeys, const casacore::Vector< casacore::Int > &antennaId)
Create and fill an empty output calibration buffer.
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
virtual casacore::Bool useGenericGatherForSolve()
GSpline gathers/solves for itself.
Definition: GSpline.h:95
casacore::Bool solveAmp_p
Private variables containing the solver parameters.
Definition: GSpline.h:137
casacore::Double phaseWrap_p
Definition: GSpline.h:208
casacore::Double getSplineVal(casacore::Double x, casacore::Vector< casacore::Double > &knots, casacore::Vector< casacore::Double > &coeff)
Compute a spline polynomial value.
*void doCalcPar()
Expose calculating pars for plotting.
Definition: GSpline.h:120
casacore::Vector< casacore::Int > fieldIdRange()
Return all field id.
virtual void calcPar()
Calc G pars from spline info.
virtual void updateCalTable(const casacore::Vector< casacore::Int > &fieldIdKeys, const casacore::Vector< casacore::Int > &antennaId, const casacore::Vector< casacore::String > &freqGrpName, const casacore::Vector< casacore::String > &polyType, const casacore::Vector< casacore::String > &polyMode, const casacore::Vector< casacore::Complex > &scaleFactor, const casacore::Matrix< casacore::Double > &polyCoeffAmp, const casacore::Matrix< casacore::Double > &polyCoeffPhase, const casacore::Vector< casacore::String > &phaseUnits, const casacore::Vector< casacore::Double > &splineKnotsAmp, const casacore::Vector< casacore::Double > &splineKnotsPhase, const casacore::Vector< casacore::MFrequency > &refFreq, const casacore::Vector< casacore::Int > &refAnt)
Update the output calibration table.
GJonesSpline(VisSet &vs)
Construct from a visibility data set.
const MSMetaInfoForCal & msmc() const
Access to the MSMetaInfoForCal (throws if none)
Definition: VisCal.h:338
String: the storage and methods of handling collections of characters.
Definition: String.h:223
GJonesSplineMBuf: GJonesSpline calibration main table buffer.
Definition: GJonesMBuf.h:213
virtual void setSolve()
Set the solving parameters.
virtual void selfGatherAndSolve(VisSet &vs, VisEquation &ve)
Solve.
casacore::Matrix< casacore::Double > rawPhase_p
Definition: GSpline.h:152
casacore::Int numpoint_p
Definition: GSpline.h:207
GJonesSplineMBuf * calBuffer_p
casacore::Time for which the current calibration cache is valid casacore::Double cacheTimeValid_p; ...
Definition: GSpline.h:145