casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
KJones.h
Go to the documentation of this file.
1 //# KJones.h: Declaration of delay-like (geometry) calibration types
2 //# Copyright (C) 1996,1997,2000,2001,2002,2003,2011
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 
28 #ifndef SYNTHESIS_KJONES_H
29 #define SYNTHESIS_KJONES_H
30 
31 #include <casa/aips.h>
33 
34 namespace casa { //# NAMESPACE CASA - BEGIN
35 
36 class DelayFFT {
37 public:
38  // Construct from freq info and data-like casacore::Cube<casacore::Complex>
39  // (for generic testing w/out casacore::MS data)
43 
44  // Construct from freq info and shape, w/ initialization
45  // (for accumulation)
47  casacore::Int nCorr, casacore::Int nElem, casacore::Int refant,
49 
50  // Construct from a VB
51  DelayFFT(const VisBuffer& vb,casacore::Double padBW,casacore::Int refant);
52 
53  // Construct from a VB2
55 
56  // Perform FFT
57  void FFT();
58 
59  // Apply shift theorem
60  void shift(casacore::Double f);
61 
62  // Accumulate another DelayFFT
63  void add(const DelayFFT& other);
64 
65  // Accumulate another DelayFFT, with duplication (if nec) and shift
66  void addWithDupAndShift(const DelayFFT& other);
67 
68  // Find peaks
69  void searchPeak();
70 
71  const casacore::Cube<casacore::Complex>& Vpad() const { return Vpad_; };
72 
73  // Access to results
74  const casacore::Matrix<casacore::Float>& delay() const { return delay_; };
75  const casacore::Matrix<casacore::Bool>& flag() const { return flag_; };
76 
77  // Report some stateinfo
78  void state();
79 
80 protected:
87 
88 };
89 
90 
91  class CrossDelayFFT : public DelayFFT {
92 public:
93  // Construct from freq info and data-like casacore::Cube<casacore::Complex>
94  // (for generic testing w/out casacore::MS data)
97 
98  // Construct from freq info and shape, w/ initialization
99  // (for accumulation)
101 
102  // Construct from a SDB (VB2)
104 
105  // Report some stateinfo
106  void state();
107 
108 };
109 
110 
111 
112 
113 
114 
115 // Forward declarations
116 
117 
118 // K Jones provides support for SBD delays
119 class KJones : public GJones {
120 
121 
122 public:
123 
124  // friend class KJonesTest;
125 
126  // Constructor
127  KJones(VisSet& vs);
128  KJones(casacore::String msname,casacore::Int MSnAnt,casacore::Int MSnSpw);
129  KJones(const MSMetaInfoForCal& msmc);
130  KJones(const casacore::Int& nAnt);
131 
132  virtual ~KJones();
133 
134  // Local setApply to enforce calWt=F for delays
135  virtual void setApply(const casacore::Record& apply);
136  virtual void setApply();
137  using GJones::setApply;
138  virtual void setCallib(const casacore::Record& callib,
139  const casacore::MeasurementSet& selms);
140 
141  // Local setSolve (traps lack of refant)
142  virtual void setSolve(const casacore::Record& solve);
143  using GJones::setSolve;
144 
145  // We have casacore::Float parameters
147 
148  // Return the type enum
149  virtual Type type() { return VisCal::K; };
150 
151  // Return type name as string
152  virtual casacore::String typeName() { return "K Jones"; };
153  virtual casacore::String longTypeName() { return "K Jones (delay)"; };
154 
155  // Type of Jones matrix according to nPar()
157 
158  // Freq dependence (delays)
159  virtual casacore::Bool freqDepPar() { return false; };
160  virtual casacore::Bool freqDepMat() { return true; };
161 
162  // Default parameter value
163  virtual casacore::Complex defaultPar() { return casacore::Complex(0.0); };
164 
165  // Type-specific specify
166  virtual void specify(const casacore::Record& specify);
167 
168  // This type is not yet accumulatable
169  virtual casacore::Bool accumulatable() { return false; };
170 
171  // This type is smoothable
172  virtual casacore::Bool smoothable() { return true; };
173 
174  // Calculate phase(chan) from delay
175  virtual void calcAllJones();
176 
177  // Delay to phase calculator
178  // virtual void calcOneJones(casacore::Vector<casacore::Complex>& mat, casacore::Vector<casacore::Bool>& mOk,
179  // const casacore::Vector<casacore::Complex>& par, const casacore::Vector<casacore::Bool>& pOk );
180 
181 
182  // Hazard a guess at parameters (unneeded here)
183  virtual void guessPar(VisBuffer& ) {};
184 
185  // K now uses generic gather, but solves for itself per solution
186  virtual casacore::Bool useGenericGatherForSolve() { return true; };
187  virtual casacore::Bool useGenericSolveOne() { return false; }
188 
189  // Override G here; nothing to do for K, for now
190  virtual void globalPostSolveTinker() {};
191 
192  // Local implementation of selfSolveOne (generalized signature)
193  virtual void selfSolveOne(VisBuffGroupAcc& vbga);
194  virtual void selfSolveOne(SDBList& sdbs);
195 
196 protected:
197 
198  // K has two "real" parameters
199  virtual casacore::Int nPar() { return 2; };
200 
201  // Jones matrix elements are trivial
202  virtual casacore::Bool trivialJonesElem() { return false; };
203 
204  // dG/dp are trivial
205  virtual casacore::Bool trivialDJ() { return false; };
206 
207  // Initialize trivial dJs
208  virtual void initTrivDJ() {};
209 
210  // FFT solver for one VB
211  virtual void solveOneVB(const VisBuffer& vb);
212  virtual void solveOneSDB(SolveDataBuffer& sdb);
213 
214  // FFT solver for multi-VB (MBD)
215  virtual void solveOneVBmbd(VisBuffGroupAcc& vbga);
216  virtual void solveOneSDBmbd(SDBList& sdbs);
217 
218  // Reference frequencies
220 
221 private:
222 
223 
224 };
225 
226 // (sbd) K for cross-hand solve
227 class KcrossJones : public KJones {
228 public:
229 
230  // Constructor
231  KcrossJones(VisSet& vs);
235 
236 
237  virtual ~KcrossJones();
238 
239  // Return type name as string
240  virtual casacore::String typeName() { return "Kcross Jones"; };
241  virtual casacore::String longTypeName() { return "Kcross Jones (cross-hand delay)"; };
242 
243  // By definition, we consider cross-hands
244  virtual casacore::Bool phandonly() { return false; };
245 
246  // Local implementation of selfSolveOne
247  // This traps combine='spw', which isn't supported yet
248  virtual void selfSolveOne(VisBuffGroupAcc& vbga);
249  virtual void selfSolveOne(SDBList& sdbs);
250 
251 
252 
253 protected:
254 
255 
256  // FFT solver for on VB, that collapses baselines and cross-hands first
257  virtual void solveOneVB(const VisBuffer& vb);
258  virtual void solveOneSDB(SolveDataBuffer& sdb);
259 
260  // MBD support
261  void solveOneSDBmbd(SDBList& sdbs);
262 
263 };
264 
265 
266 // KMBD Jones provides support for multi-band delays
267 class KMBDJones : public KJones {
268 public:
269 
270  // Constructor
271  KMBDJones(VisSet& vs);
274  KMBDJones(const casacore::Int& nAnt);
275 
276  virtual ~KMBDJones();
277 
278  // Return the type enum
279  virtual Type type() { return VisCal::K; };
280 
281  // Return type name as string
282  virtual casacore::String typeName() { return "KMBD Jones"; };
283  virtual casacore::String longTypeName() { return "KMBD Jones (multi-band delay)"; };
284 
285  // Local setApply (to enforce KrefFreq_=0.0)
286  virtual void setApply(const casacore::Record& apply);
287  using KJones::setApply;
288 
289 
290 };
291 
292 
293 
294 class KAntPosJones : public KJones {
295 public:
296 
297  // Constructor
298  KAntPosJones(VisSet& vs);
302 
303 
304  virtual ~KAntPosJones();
305 
306  // Return the type enum
307  virtual Type type() { return VisCal::KAntPos; };
308 
309  // Return type name as string
310  virtual casacore::String typeName() { return "KAntPos Jones"; };
311  virtual casacore::String longTypeName() { return "KAntPos Jones (antenna position errors)"; };
312 
313  // This is a scalar Jones matrix
314  virtual Jones::JonesType jonesType() { return Jones::Scalar; };
315 
316  virtual casacore::Bool timeDepMat() { return true; };
317 
318  // This type is not smoothable
319  virtual casacore::Bool smoothable() { return false; };
320 
321  // Local setApply to enforce spwmap=0 for all spw
322  virtual void setApply(const casacore::Record& apply);
323  using KJones::setApply;
324  virtual void setCallib(const casacore::Record& callib,const casacore::MeasurementSet& selms);
325 
326  // Type-specific specify
327  virtual void specify(const casacore::Record& specify);
328 
329  // Calculate phase(chan) from delay
330  virtual void calcAllJones();
331 
332 protected:
333 
334  // Detect phase direction and antpos for the current VB
335  virtual void syncMeta(const VisBuffer& vb);
336  virtual void syncMeta2(const vi::VisBuffer2& vb);
337 
338  // AntPos has three "real" parameters (dBx, dBy, dBz)
339  virtual casacore::Int nPar() { return 3; };
340 
341  // Jones matrix elements are not trivial
342  virtual casacore::Bool trivialJonesElem() { return false; };
343 
344  // dG/dp are not trivial
345  virtual casacore::Bool trivialDJ() { return false; };
346 
347  // Initialize trivial dJs
348  virtual void initTrivDJ() {};
349 
350 private:
351 
352  // casacore::Geometry info for internal calculations (updated per VB)
356 
357  // utility methods/variables for Trop Delay Error correction
358  bool vlaTrDelCorrApplicable(bool checkCalTable=false);
360  void initTrDelCorr(); // init (at set apply)
361  double calcTrDelError(int iant); // calc (per ant,timestamp)
362  bool doTrDelCorr_; // on or off
363  double userEterm_;
364  casacore::Vector<double> MJDlim_; // applicable date ranges
365  #define MJD0 String("2016/08/09/00:00:00.0")
366  #define MJD1 String("2016/11/15/00:00:00.0")
367  double eterm_; // scale
370 
371 };
372 
373 
374 } //# NAMESPACE CASA - END
375 
376 #endif
virtual casacore::Bool useGenericGatherForSolve()
K now uses generic gather, but solves for itself per solution.
Definition: KJones.h:186
A Measure: astronomical direction.
Definition: MDirection.h:174
virtual void solveOneVB(const VisBuffer &vb)
FFT solver for one VB.
virtual void specify(const casacore::Record &specify)
Type-specific specify.
A Measure: position on Earth.
Definition: MPosition.h:79
virtual casacore::Bool timeDepMat()
Matrices time-dependent per parameter set (nominally no)
Definition: KJones.h:316
int Int
Definition: aipstype.h:50
casacore::Int nCorr_
Definition: KJones.h:82
virtual void syncMeta(const VisBuffer &vb)
Detect phase direction and antpos for the current VB.
virtual VisCalEnum::VCParType parType()
We have casacore::Float parameters.
Definition: KJones.h:146
casacore::Vector< casacore::MDirection > azel_
Definition: KJones.h:369
virtual Type type()
Return the type enum.
Definition: KJones.h:279
virtual casacore::String longTypeName()
Definition: KJones.h:283
Forward declarations.
Definition: KJones.h:119
virtual casacore::String typeName()
Return type name as string.
Definition: KJones.h:310
casacore::Int nPadChan_
Definition: KJones.h:82
void state()
Report some stateinfo.
casacore::MPosition antpos0_p
Definition: KJones.h:355
bool vlaTrDelCorrApplicable(bool checkCalTable=false)
utility methods/variables for Trop Delay Error correction
void addWithDupAndShift(const DelayFFT &other)
Accumulate another DelayFFT, with duplication (if nec) and shift.
void add(const DelayFFT &other)
Accumulate another DelayFFT.
void FFT()
Perform FFT.
virtual casacore::Bool useGenericSolveOne()
Use generic solution engine for a single solve (usually inside the generic gathering mechanism) ...
Definition: KJones.h:187
void apply(const Jones &j1, VisVector &v, const Jones &j2)
Apply a pair of Jones to a VisVector:
virtual Type type()
Return the type enum.
Definition: KJones.h:307
virtual casacore::Bool trivialJonesElem()
Jones matrix elements are trivial.
Definition: KJones.h:202
virtual void selfSolveOne(VisBuffGroupAcc &vbga)
Local implementation of selfSolveOne (generalized signature)
virtual void setCallib(const casacore::Record &callib, const casacore::MeasurementSet &selms)
virtual void calcAllJones()
Calculate phase(chan) from delay.
virtual void setApply()
Set the application parameters.
KAntPosJones(VisSet &vs)
Constructor.
KcrossJones(VisSet &vs)
Constructor.
void shift(casacore::Double f)
Apply shift theorem.
casacore::Double padBW_
Definition: KJones.h:81
double userEterm_
Definition: KJones.h:363
virtual casacore::Bool accumulatable()
This type is not yet accumulatable.
Definition: KJones.h:169
virtual void solveOneSDB(SolveDataBuffer &sdb)
casacore::Double df_
Definition: KJones.h:81
casacore::MDirection phasedir_p
Definition: KJones.h:354
casacore::String epochref_p
casacore::Geometry info for internal calculations (updated per VB)
Definition: KJones.h:348
casacore::Matrix< casacore::Float > delay_
Definition: KJones.h:85
virtual void solveOneSDBmbd(SDBList &sdbs)
virtual void globalPostSolveTinker()
Override G here; nothing to do for K, for now.
Definition: KJones.h:190
casacore::Int refant_
Definition: KJones.h:83
virtual void setApply()
Set the application parameters.
virtual casacore::Bool smoothable()
This type is not smoothable.
Definition: KJones.h:319
casacore::Int & nAnt()
Definition: VisCal.h:237
virtual casacore::Int nPar()
K has two &quot;real&quot; parameters.
Definition: KJones.h:199
virtual casacore::String typeName()
Return type name as string.
Definition: KJones.h:240
virtual casacore::String typeName()
Return type name as string.
Definition: KJones.h:152
void state()
Report some stateinfo.
virtual void initTrivDJ()
Initialize trivial dJs.
Definition: KJones.h:348
virtual casacore::Complex defaultPar()
Default parameter value.
Definition: KJones.h:163
casacore::Double f0_
Definition: KJones.h:81
virtual Jones::JonesType jonesType()
This is a scalar Jones matrix.
Definition: KJones.h:314
casacore::Matrix< casacore::Bool > flag_
Definition: KJones.h:86
SolveDataBuffer is a container for VisBuffer2 data and related residual and differentiation results r...
virtual Type type()
Return the type enum.
Definition: KJones.h:149
casacore::Vector< double > armAz_
Definition: KJones.h:368
const casacore::Matrix< casacore::Float > & delay() const
Access to results.
Definition: KJones.h:74
virtual ~KcrossJones()
casacore::Vector< double > losDist_
Definition: KJones.h:368
double calcTrDelError(int iant)
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
virtual ~KMBDJones()
double Double
Definition: aipstype.h:55
virtual void specify(const casacore::Record &specify)
Type-specific specify.
DelayFFT(casacore::Double f0, casacore::Double df, casacore::Double padBW, casacore::Cube< casacore::Complex > V, casacore::Cube< casacore::Float > wt=casacore::Cube< casacore::Float >())
Construct from freq info and data-like casacore::Cube&lt;casacore::Complex&gt; (for generic testing w/out c...
CrossDelayFFT(casacore::Double f0, casacore::Double df, casacore::Double padBW, casacore::Cube< casacore::Complex > V)
Construct from freq info and data-like casacore::Cube&lt;casacore::Complex&gt; (for generic testing w/out c...
virtual casacore::Bool freqDepPar()
Freq dependence (delays)
Definition: KJones.h:159
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::String typeName()
Return type name as string.
Definition: KJones.h:282
virtual casacore::Bool freqDepMat()
Frequency-dependent Matrices? Nominally same as freqDepPar.
Definition: KJones.h:160
KMBD Jones provides support for multi-band delays.
Definition: KJones.h:267
KJones(VisSet &vs)
friend class KJonesTest;
float Float
Definition: aipstype.h:54
virtual casacore::Bool trivialJonesElem()
Jones matrix elements are not trivial.
Definition: KJones.h:342
virtual casacore::String longTypeName()
Definition: KJones.h:311
A class to group separately averaged VisBuffers.
virtual casacore::Bool trivialDJ()
dG/dp are trivial
Definition: KJones.h:205
virtual void syncMeta2(const vi::VisBuffer2 &vb)
virtual void solveOneVBmbd(VisBuffGroupAcc &vbga)
FFT solver for multi-VB (MBD)
A Table intended to hold astronomical data (a set of Measurements).
virtual void setCallib(const casacore::Record &callib, const casacore::MeasurementSet &selms)
virtual void calcAllJones()
Calculate phase(chan) from delay.
casacore::Int nElem_
Definition: KJones.h:82
virtual casacore::Bool phandonly()
By definition, we consider cross-hands.
Definition: KJones.h:244
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
const MSMetaInfoForCal & msmc() const
Access to the MSMetaInfoForCal (throws if none)
Definition: VisCal.h:338
void markCalTableForTrDelCorr()
const casacore::Cube< casacore::Complex > & Vpad() const
Definition: KJones.h:71
virtual void solveOneSDB(SolveDataBuffer &sdb)
virtual Jones::JonesType jonesType()
Type of Jones matrix according to nPar()
Definition: KJones.h:156
virtual void solveOneVB(const VisBuffer &vb)
FFT solver for on VB, that collapses baselines and cross-hands first.
casacore::Vector< T > solve(const casacore::Matrix< T > &A, const casacore::Vector< T > &y, double &ferr, double &berr)
Given a matrix &quot;A&quot;, and given some vector &quot;y&quot; which is the right hand side of the equation &quot;Ax=y&quot;...
void searchPeak()
Find peaks.
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Vector< casacore::Double > KrefFreqs_
Reference frequencies.
Definition: KJones.h:219
virtual ~KAntPosJones()
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
virtual void selfSolveOne(VisBuffGroupAcc &vbga)
Local implementation of selfSolveOne This traps combine=&#39;spw&#39;, which isn&#39;t supported yet...
virtual void guessPar(VisBuffer &)
Delay to phase calculator virtual void calcOneJones(casacore::Vector&lt;casacore::Complex&gt;&amp; mat...
Definition: KJones.h:183
virtual ~KJones()
casacore::Cube< casacore::Complex > Vpad_
Definition: KJones.h:84
virtual casacore::String longTypeName()
Definition: KJones.h:153
virtual casacore::Bool smoothable()
This type is smoothable.
Definition: KJones.h:172
virtual void setSolve()
Set the solving parameters.
virtual casacore::Bool trivialDJ()
dG/dp are not trivial
Definition: KJones.h:345
const casacore::Matrix< casacore::Bool > & flag() const
Definition: KJones.h:75
virtual void initTrivDJ()
Initialize trivial dJs.
Definition: KJones.h:208
virtual casacore::Int nPar()
AntPos has three &quot;real&quot; parameters (dBx, dBy, dBz)
Definition: KJones.h:339
virtual casacore::String longTypeName()
Definition: KJones.h:241
(sbd) K for cross-hand solve
Definition: KJones.h:227
KMBDJones(VisSet &vs)
Constructor.
void solveOneSDBmbd(SDBList &sdbs)
MBD support.
casacore::Vector< double > MJDlim_
Definition: KJones.h:364