casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VisCal.h
Go to the documentation of this file.
1 //# VisCal.h: Definitions of interface for VisCal
2 //# Copyright (C) 1996,1997,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: VisCal.h,v 1.10 2006/02/06 19:23:11 gmoellen Exp $
28 
29 #ifndef SYNTHESIS_VISCAL_H
30 #define SYNTHESIS_VISCAL_H
31 
32 #include <casa/aips.h>
33 #include <casa/Containers/Record.h>
34 #include <casa/BasicSL/Complex.h>
35 #include <casa/BasicSL/Constants.h>
40 #include <msvis/MSVis/VisSet.h>
41 #include <msvis/MSVis/VisBuffer2.h>
42 
44 
45 namespace casa { //# NAMESPACE CASA - BEGIN
46 
47 class MSMetaInfoForCal;
48 
49 // **********************************************************
50 // VisCal
51 //
52 
53 class VisCal {
54 
55  friend class SolvableVisJones;
56 
57 public:
58 
59  // Allowed types of VisCal matrices - 'correct' order
60  // enum Type{UVMOD,Mf,M,K,B,G,D,C,E,P,T,EP,F};
61  // enum Type{Test=0,ANoise,M,KAntPos,K,B,G,J,D,X,C,P,E,T,F,A,ALL};
62  enum Type{Test=0,ANoise,M,KAntPos,B,K,G,J,D,X,C,P,E,T,F,A,ALL};
63 
64  // Enumeration of parameter types (casacore::Complex, Real, or Both)
65  enum ParType{Co,Re,CoRe};
66 
68  switch (type) {
69  case ANoise: return "ANoise";
70  case M: return "M";
71  case K: return "K";
72  case B: return "B";
73  case J: return "J";
74  case D: return "D";
75  case X: return "X";
76  case C: return "C";
77  case P: return "P";
78  case E: return "E";
79  case T: return "T";
80  case F: return "F";
81  case A: return "A";
82  default: return "0";
83  }
84  }
85 
86  VisCal(VisSet& vs);
87 
88  VisCal(casacore::String msname,casacore::Int MSnAnt,casacore::Int MSnSpw);
89 
91 
92  VisCal(const casacore::Int& nAnt);
93 
94  virtual ~VisCal();
95 
96  // Return the type of this calibration matrix (actual type of derived class).
97  // (Must be implemented in specializations!)
98  virtual Type type()=0;
99 
100  // Return type name as string
101  virtual casacore::String typeName() { return "Unknown VisCal"; };
102  virtual casacore::String longTypeName() { return "Unknown VisCal"; };
103 
104  // Return casacore::Matrix type
106 
107  // Return the parameter type (nominally complex)
109 
110  // Number of pars per ant/bln
111  // (Must be implemented in specializations!)
112  virtual casacore::Int nPar()=0;
113 
114  // Report calibration availability per spw
115  // (always true for non-tabular?)
117  virtual casacore::Bool spwOK(casacore::Int) { return true; };
118 
119  // Calibration available?
120  // (always true for non-tabular)
121  virtual casacore::Bool calAvailable(vi::VisBuffer2&) { return true;};
122 
123  // Calibration expected AND available?
124  // (always assume true for non-tabular)
125  virtual casacore::Bool VBOKforCalApply(vi::VisBuffer2&) { return true;};
126 
127  // Frequency-dependent Parameters? Nominally not.
128  virtual casacore::Bool freqDepPar() { return false; };
129 
130  // Number of par channels in current spw
131  inline const casacore::Int& nChanPar() const { return nChanPar_[currSpw_]; };
132 
133  // Frequency-dependent Matrices? Nominally same as freqDepPar.
134  virtual casacore::Bool freqDepMat() { return freqDepPar(); };
135 
136  // Freq-dep Weight scaling? // almost always false
137  virtual casacore::Bool freqDepCalWt() { return false; };
138 
139  // Matrices time-dependent per parameter set (nominally no)
140  virtual casacore::Bool timeDepMat() { return false; };
141 
142  // Is this calibration matrix to be applied?
143  inline casacore::Bool isApplied() {return applied_;};
144 
145  // Is this solveable? (never via this interface)
146  virtual casacore::Bool isSolvable() {return false;};
147 
148  // Return the time interval over which this calibration is constant
149  inline virtual casacore::Double& interval() {return interval_;}
150 
151  // Set the application parameters
152  virtual void setApply();
153  virtual void setApply(const casacore::Record& apply);
154  virtual void setCallib(const casacore::Record& callib,const casacore::MeasurementSet& selms);
155 
156  // Apply info/params, suitable for logging
157  virtual casacore::String applyinfo();
158 
159  // simulation params - for a VC, sim is apply; for a SVC this will get
160  // overriden
161  inline virtual casacore::String siminfo() { return applyinfo(); };
162 
163  // Trigger calibration of weights
164  inline casacore::Bool& calWt() { return calWt_; };
165 
166  // Apply calibration to data in VisBuffer (correct casacore::Data or corrupt Model)
167  // (in-place versions)
168  virtual void correct(VisBuffer& vb, casacore::Bool trial=false);
169  virtual void correct2(vi::VisBuffer2& vb, casacore::Bool trial=false,
170  casacore::Bool doWtSp=false, casacore::Bool dosync=true);
171  virtual void corrupt(VisBuffer& vb);
172  virtual void corrupt2(vi::VisBuffer2& vb);
173 
174  // Apply calibration to data in VisBuffer;
175  // (alternate output versions)
176  virtual void correct(VisBuffer& vb, casacore::Cube<casacore::Complex>& Vout,casacore::Bool trial=false);
177  virtual void corrupt(VisBuffer& vb, casacore::Cube<casacore::Complex>& Mout);
179 
180  // Flag counting
181  virtual void initCalFlagCount();
182  virtual casacore::Record actionRec();
183 
184  // Report the state
185  virtual void state();
186 
187  virtual void currMetaNote();
188 
189  // Set the print level
190  inline void setPrtlev(const casacore::Int& prtlev) { prtlev_=prtlev; };
191 
192  // Baseline index from antenna indices: (assumes a1<=a2 !!)
193  inline casacore::Int blnidx(const casacore::Int& a1,
194  const casacore::Int& a2) { return a1*nAnt() - a1*(a1+1)/2 + a2; };
195 
196  inline casacore::String& extraTag() { return extratag_; };
197 
198 
199  // VI2-related refactor--------------------------------------
200 
201  // Set "current" meta info, so internals can be registered
202  virtual void setMeta(int obs, int scan, double time,
203  int spw, const casacore::Vector<double>& freq,
204  int fld);
205 
206  // Reshape solvePar* arrays for the currSpw()
207  // (sensitive to freqDepPar())
208  virtual void sizeApplyParCurrSpw(int nVisChan);
209 
210  // Set parameters to def values in the currSpw(),
211  // and optionally sync everything
212  virtual void setDefApplyParCurrSpw(bool sync=false, bool doInv=false);
213 
214  // Set parameters to specified values in the currSpw(),
215  // and optionally sync matrices
217  bool sync=false, bool doInv=false);
218 
219  virtual void setApplyParCurrSpw(const casacore::Cube<float> rpar,
220  bool sync=false, bool doInv=false);
221 
222  // Access (public) to current solution parameters and matrices
223  inline virtual casacore::Cube<casacore::Complex>& currCPar() {return (*currCPar_[currSpw()]);};
224  inline virtual casacore::Cube<casacore::Float>& currRPar() {return (*currRPar_[currSpw()]);};
225  inline virtual casacore::Cube<casacore::Bool>& currParOK() {return (*currParOK_[currSpw()]);};
226 
227 
228 protected:
229 
230  // Set applied state flag
231  inline void setApplied(const casacore::Bool& flag) {applied_=flag;};
232 
233  inline casacore::String& msName() { return msName_; };
234 
235  // General Shape Info
236  inline casacore::Int& nSpw() { return nSpw_; };
237  inline casacore::Int& nAnt() { return nAnt_; };
238  inline casacore::Int& nBln() { return nBln_; };
239 
240  // The number of sets of parameters under consideration
241  virtual casacore::Int& nElem()=0;
242 
243  // Number of Calibration matrices on ant/bln axis
244  virtual casacore::Int nCalMat()=0;
245 
246  // Current in-focus spw
247  inline casacore::Int& currSpw() { return currSpw_; };
248 
249  // Current coords
250  inline casacore::Double& lastTime() { return lastTime_(currSpw()); };
251  inline casacore::Double& currTime() { return currTime_(currSpw()); };
252  inline casacore::Int& currScan() { return currScan_(currSpw()); };
253  inline casacore::Int& currObs() { return currObs_(currSpw()); };
254  inline casacore::Int& currField() { return currField_(currSpw()); };
255  inline casacore::Int& currIntent() { return currIntent_(currSpw()); };
257 
258  inline casacore::Double& refTime() { return refTime_; };
259  inline casacore::Double& refFreq() { return refFreq_; };
260 
261  // Current spectral shapes
262  inline casacore::Int& nChanPar() { return nChanPar_[currSpw_]; };
263  inline casacore::Int& nChanMat() { return nChanMat_[currSpw_]; };
268 
269  // Access to matrix renderings of Visibilities
270  inline VisVector& V() { return (*V_[currSpw()]); };
271 
272  // Validation of calibration parameters
273  inline void invalidateP() {PValid_(currSpw())=false;};
274  inline void validateP() {PValid_(currSpw())=true;};
275  inline casacore::Bool PValid() {return PValid_(currSpw());};
276 
277  // Invalidate cal matrices generically
278  virtual void invalidateCalMat()=0;
279 
280  // Access to weight-scaling factors
282 
283  // Flag counting
284  virtual void countInFlag(const VisBuffer& vb);
285  virtual void countInFlag2(const vi::VisBuffer2& vb);
286  virtual void countOutFlag(const VisBuffer& vb);
287  virtual void countOutFlag2(const vi::VisBuffer2& vb);
288 
289  // Row-by-row apply to a casacore::Cube<casacore::Complex> (generic)
290  virtual void applyCal(VisBuffer& vb, casacore::Cube<casacore::Complex>& Vout,casacore::Bool trial=false)=0;
291  virtual void applyCal2(vi::VisBuffer2& vb,
293  casacore::Bool trial=false)=0;
294 
295  // Synchronize "gains" with a VisBuffer or another VisCal
296  virtual void syncCal(const VisBuffer& vb,
297  const casacore::Bool& doInv=false);
298  virtual void syncCal2(const vi::VisBuffer2& vb,
299  const casacore::Bool& doInv=false);
300  virtual void syncCal(VisCal& vc);
301 
302  // Set internal meta data from a VisBuffer or another VisCal
303  virtual void syncMeta(const VisBuffer& vb);
304  virtual void syncMeta2(const vi::VisBuffer2& vb);
305  void syncMeta(VisCal& vc);
306 
307  void syncMeta(const casacore::Int& spw,
308  const casacore::Double& time,
309  const casacore::Int& field,
311  const casacore::Int& nchan);
312 
313  // Set the calibration matrix channelization
314  void setCalChannelization(const casacore::Int& nChanDat);
315 
316  // Test for need of new calibration
317  void checkCurrCal();
318 
319  // Synchronize "gains" with current meta-data
320  virtual void syncCal(const casacore::Bool& doInv=false);
321 
322  // Sync parameters for current meta data
323  virtual void syncPar();
324 
325  // Calculate Mueller parameters by some means
326  virtual void calcPar();
327 
328  // Sync matrices generically for current meta data
329  virtual void syncCalMat(const casacore::Bool& doInv=false)=0;
330 
331  // Return print (cout) level
332  inline casacore::Int& prtlev() { return prtlev_; };
333 
334  // set current field index vector to given field id
335  void setCurrField(const casacore::Int& ifld);
336 
337  // Access to the MSMetaInfoForCal (throws if none)
338  const MSMetaInfoForCal& msmc() const
339  {
340  if (msmc_) return *msmc_;
341  else throw(casacore::AipsError("VisCal::msmc(): No MSMetaInfoForCal object!"));
342  };
343 
344 private:
345 
346  // Defalt ctor is private
347  VisCal();
348 
349  // Initialize pointers, etc.
350  void initVisCal();
351 
352  // Delete pointers
353  void deleteVisCal();
354 
355  // Associated casacore::MS name
357 
358  // The MSMetaInfoForCal pointer
360  const bool delmsmc_; // must delete _only_ if locally formed
361 
362  // Number of Spectral windows
364 
365  // Number of antennas
367 
368  // Number of baselines
370 
371  // Current synchronized spw
373 
374  // Current indices
384 
385  // Channel counts
388 
389  // Solution timescale (context-dependent)
391 
392  // Application flag
394 
395  // In-focus channel for single-chan solves on multi-chan data
397 
398  // VisVector wrapper (per Spw)
400 
401  // Current parameters
405 
406  // Paremeter validity
408 
409  // Trigger calibration of weights
411 
412  // Weight scale factors
414 
415  // Flag counting
417 
418  // Print level
420 
421  casacore::String extratag_; // e.g. to tag as noise scale
422 
423 
424 };
425 
426 
427 // **********************************************************
428 // VisMueller
429 //
430 
431 class VisMueller : virtual public VisCal {
432 
433 public:
434 
435  // Constructor
436  VisMueller(VisSet& vs);
437 
439 
441 
442  VisMueller(const casacore::Int& nAnt);
443 
444  virtual ~VisMueller();
445 
446  // Return casacore::Matrix type
448 
449  // Mueller matrix type (must be implemented in Mueller specializations!)
450  virtual Mueller::MuellerType muellerType()=0;
451 
452  // Report the state
453  virtual void state();
454 
455 protected:
456 
457  // Total number of parameter sets required
458  virtual casacore::Int& nElem() { return nBln(); };
459 
460  // Number of Cal Matrices to form on baseline axis
461  // (Mueller, apply context: nBln())
462  virtual casacore::Int nCalMat() { return nBln(); };
463 
464  // Are the parameters the matrix elements?
465  // (or is a non-trivial calculation required?)
466  // (Must be implemented in specializations!)
468 
469  // Are we applying via Mueller multiplication?
470  // (necessarily true for native Muellers)
471  virtual casacore::Bool applyByMueller() { return true; };
472 
473  // Access to matrix renderings of Muellers
474  inline Mueller& M() { return (*M_[currSpw()]); };
475 
476  // Access to current matrices
479 
480  // Invalidate cal matrices generically (at this level, just Mueller)
481  inline virtual void invalidateCalMat() { invalidateM(); };
482 
483  // Validation of Mueller matrices (for currSpw)
484  inline void invalidateM() {MValid_(currSpw())=false;};
485  inline void validateM() {MValid_(currSpw())=true;};
486  inline casacore::Bool MValid() {return MValid_(currSpw());};
487 
488  // Row-by-row apply to a casacore::Cube<casacore::Complex> (applyByMueller override)
489  virtual void applyCal(VisBuffer& vb, casacore::Cube<casacore::Complex>& Vout,casacore::Bool trial=false);
490  virtual void applyCal2(vi::VisBuffer2& vb,
492  casacore::Bool trial=false);
493  // { throw(casacore::AipsError("VisMueller::applyCal2 NYI!!!!!!!!!!!!!")); };
494 
495  // Sync matrices for current meta data (Mueller override)
496  virtual void syncCalMat(const casacore::Bool& doInv=false);
497 
498  // Sync Mueller matrix elements for current parameters
499  virtual void syncMueller(const casacore::Bool& doInv=false);
500 
501  // Calculate an ensemble of Mueller matrices (all baselines, channels)
502  virtual void calcAllMueller();
503 
504  // Calculate a single Mueller matrix by some means
507 
508  // Invert Mueller matrices
509  virtual void invMueller();
510 
511  // Set matrix elements according to their ok flags
512  // (e.g., makes a unit matrix if everything flagged,
513  // so we don't have to make atomic ok checks in apply)
514  virtual void setMatByOk();
515 
516  // Create Mueller matrix algebra interface
517  void createMueller();
518 
519  // Synchronize weight scale factors
520  virtual void syncWtScale();
521 
522  // Perform weight scale calculation (specializable)
523  virtual void calcWtScale();
524 
525  // Update the wt vector for a baseline
526  virtual void updateWt(casacore::Vector<casacore::Float>& wt,const casacore::Int& a1,const casacore::Int& a2);
527 
528 
529 private:
530 
531  // Default ctor is private
532  VisMueller();
533 
534  // Init VisMueller pointers, etc.
535  void initVisMueller();
536 
537  // Delete the this* caches
538  void deleteVisMueller();
539 
540  // Mueller algebra wrapper (per Spw)
542 
543  // Current Mueller matrix elements
546 
547  // Mueller validity
549 
550 };
551 
552 
553 // **********************************************************
554 // VisJones
555 //
556 
557 class VisJones : virtual public VisMueller {
558 
559  friend class SolvableVisJones;
560 
561 public:
562 
563  // Constructor
564  VisJones(VisSet& vs);
565 
567 
569 
570  VisJones(const casacore::Int& nAnt);
571 
572  virtual ~VisJones();
573 
574  // Return casacore::Matrix type
576 
577  // What kind of Mueller matrices should we use?
578  // (A function of the jonesType and target data shape)
580 
581  // What kind of Jones matrix are we?
582  // (Must be implemented in specializations!)
583  virtual Jones::JonesType jonesType()=0;
584 
585  // Report the state
586  virtual void state();
587 
588 protected:
589 
590  // Number of parameter sets is number of antennas
591  inline virtual casacore::Int& nElem() { return nAnt(); };
592 
593  // Number of Cal Matrices to form on antenna axis
594  // (Jones, apply context: nAnt())
595  virtual casacore::Int nCalMat() { return nAnt(); };
596 
597  // Jones matrices can never be trivial Muellers!
598  virtual casacore::Bool trivialMuellerElem() { return false; };
599 
600  // Are the parameters the Jones matrix elements?
601  // (or is a non-trivial calculation required?)
602  // (Must be implemented in specializations!)
603  virtual casacore::Bool trivialJonesElem()=0;
604 
605  // Are we applying via Mueller or Jones multiplication?
606  // (probably by Jones for native Jones?)
607  virtual casacore::Bool applyByMueller() { return false; };
608  virtual casacore::Bool applyByJones() { return true; };
609 
610  // Access to matrix renderings of Jones matrices
611  inline Jones& J1() { return *J1_[currSpw()]; };
612  inline Jones& J2() { return *J2_[currSpw()]; };
613 
614  // Access to Jones matrix element array
617 
618  // Invalidate cal matrices generically (at this level, both Mueller and Jones)
619  inline virtual void invalidateCalMat() { invalidateM(); invalidateJ(); };
620 
621  // Validation of Jones matrices
622  inline void invalidateJ() {JValid_(currSpw())=false;};
623  inline void validateJ() {JValid_(currSpw())=true;};
624  inline casacore::Bool JValid() {return JValid_(currSpw());};
625 
626  // Row-by-row apply to a casacore::Cube<casacore::Complex> (applyByJones override)
627  virtual void applyCal(VisBuffer& vb, casacore::Cube<casacore::Complex>& Vout,casacore::Bool trial=false);
628  virtual void applyCal2(vi::VisBuffer2& vb,
630  casacore::Bool trial=false);
631 
632  // Sync matrices for current meta data (VisJones override)
633  virtual void syncCalMat(const casacore::Bool& doInv=false);
634 
635  // Calculate an ensemble of Mueller matrices (all baselines, channels)
636  // (only meaningful if applyByMueller()=T)
637  virtual void calcAllMueller();
638 
639  // Synchronize current Jones matrices
640  virtual void syncJones(const casacore::Bool& doInv=false);
641 
642  // Calculate an ensemble of Jones matrices (all antennas, channels)
643  virtual void calcAllJones();
644 
645  // Calculate a single Jones matrix by some means from parameters
648 
649  // Invert Jones matrices
650  virtual void invJones();
651 
652  // Set matrix elements according to their ok flags
653  // (e.g., makes a unit matrix if everything flagged,
654  // so we don't have to make atomic ok checks in apply)
655  virtual void setMatByOk();
656 
657  // Create Jones interface
658  void createJones();
659 
660  // Synchronize weight scale factors
661  virtual void syncWtScale();
662 
663  // Perform weight scale calculation (specializable)
664  virtual void calcWtScale();
665 
666  // Update the wt vector for a baseline
667  virtual void updateWt(casacore::Vector<casacore::Float>& wt,const casacore::Int& a1,const casacore::Int& a2);
668  virtual void updateWt2(casacore::Matrix<casacore::Float>& wt,const casacore::Int& a1,const casacore::Int& a2);
669 
670 private:
671 
672  // Default ctor is private
673  VisJones();
674 
675  // Init VisJones pointers
676  void initVisJones();
677 
678  // Delete the this* caches
679  void deleteVisJones();
680 
681  // Jones algebra wrapper (per Spw)
684 
685  // Current Jones matrix-element arrays
688 
689  // Jones validity, per spw
691 
692 
693 };
694 
695 } //# NAMESPACE CASA - END
696 
697 #endif
virtual VisCalEnum::MatrixType matrixType()
Return casacore::Matrix type.
Definition: VisCal.h:575
void invalidateP()
Validation of calibration parameters.
Definition: VisCal.h:273
void setApplied(const casacore::Bool &flag)
Set applied state flag.
Definition: VisCal.h:231
virtual casacore::Bool freqDepCalWt()
Freq-dep Weight scaling? // almost always false.
Definition: VisCal.h:137
void validateP()
Definition: VisCal.h:274
virtual void invMueller()
Invert Mueller matrices.
virtual void updateWt(casacore::Vector< casacore::Float > &wt, const casacore::Int &a1, const casacore::Int &a2)
Update the wt vector for a baseline.
VisCal
Definition: VisCal.h:53
casacore::Int & prtlev()
Return print (cout) level.
Definition: VisCal.h:332
casacore::Int & currScan()
Definition: VisCal.h:252
virtual casacore::Bool trivialMuellerElem()=0
Are the parameters the matrix elements? (or is a non-trivial calculation required?) (Must be implemented in specializations!)
casacore::Vector< casacore::Int > currObs_
Definition: VisCal.h:377
casacore::Vector< casacore::Int > currField_
Definition: VisCal.h:378
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
Definition: aipsxtype.h:38
int Int
Definition: aipstype.h:50
virtual void invJones()
Invert Jones matrices.
virtual void setDefApplyParCurrSpw(bool sync=false, bool doInv=false)
Set parameters to def values in the currSpw(), and optionally sync everything.
virtual Mueller::MuellerType muellerType()=0
Mueller matrix type (must be implemented in Mueller specializations!)
virtual void syncWtScale()
Synchronize weight scale factors.
virtual VisCalEnum::MatrixType matrixType()
Return casacore::Matrix type.
Definition: VisCal.h:447
casacore::Vector< casacore::Bool > PValid_
Paremeter validity.
Definition: VisCal.h:407
VisMueller
Definition: VisCal.h:431
casacore::Int blnidx(const casacore::Int &a1, const casacore::Int &a2)
Baseline index from antenna indices: (assumes a1&lt;=a2 !!)
Definition: VisCal.h:193
casacore::Int & nSpw()
General Shape Info.
Definition: VisCal.h:236
casacore::Vector< casacore::Int > & nChanParList()
Definition: VisCal.h:265
Additive noise In practice, this is not really solvable, but it is a SVM because we need access to ge...
Definition: AMueller.h:161
casacore::PtrBlock< Jones * > J2_
Definition: VisCal.h:683
virtual void sizeApplyParCurrSpw(int nVisChan)
Reshape solvePar* arrays for the currSpw() (sensitive to freqDepPar())
virtual void setApplyParCurrSpw(const casacore::Cube< casacore::Complex > cpar, bool sync=false, bool doInv=false)
Set parameters to specified values in the currSpw(), and optionally sync matrices.
virtual void state()
Report the state.
virtual void calcAllMueller()
Calculate an ensemble of Mueller matrices (all baselines, channels) (only meaningful if applyByMuelle...
void initVisMueller()
Init VisMueller pointers, etc.
casacore::PtrBlock< casacore::Cube< casacore::Complex > * > currJElem_
Current Jones matrix-element arrays.
Definition: VisCal.h:686
virtual casacore::Bool freqDepPar()
Frequency-dependent Parameters? Nominally not.
Definition: VisCal.h:128
virtual void syncJones(const casacore::Bool &doInv=false)
Synchronize current Jones matrices.
casacore::Int64 nflagIn_
Definition: VisCal.h:416
void apply(const Jones &j1, VisVector &v, const Jones &j2)
Apply a pair of Jones to a VisVector:
virtual void calcAllJones()
Calculate an ensemble of Jones matrices (all antennas, channels)
void deleteVisCal()
Delete pointers.
virtual casacore::Bool freqDepMat()
Frequency-dependent Matrices? Nominally same as freqDepPar.
Definition: VisCal.h:134
casacore::String & msName()
Definition: VisCal.h:233
virtual VisCalEnum::VCParType parType()
Return the parameter type (nominally complex)
Definition: VisCal.h:108
virtual casacore::Int & nElem()
Total number of parameter sets required.
Definition: VisCal.h:458
casacore::Int nSpw_
Number of Spectral windows.
Definition: VisCal.h:363
virtual void currMetaNote()
virtual void syncCalMat(const casacore::Bool &doInv=false)=0
Sync matrices generically for current meta data.
virtual casacore::String typeName()
Return type name as string.
Definition: VisCal.h:101
virtual casacore::Int & nElem()=0
The number of sets of parameters under consideration.
void validateJ()
Definition: VisCal.h:623
VisCal()
Defalt ctor is private.
virtual void state()
Report the state.
virtual void syncWtScale()
Synchronize weight scale factors.
casacore::PtrBlock< Mueller * > M_
Mueller algebra wrapper (per Spw)
Definition: VisCal.h:541
void setCurrField(const casacore::Int &ifld)
set current field index vector to given field id
void initVisJones()
Init VisJones pointers.
ABSTRACT TOOL CLASSES A PlotTool is a higher level event handler for a PlotCanvas The idea is to take common tasks which may require multiple events and put them in one place PlotTools also provide additional functionality in that they can be active and blocking non blocking The PlotCanvas will only send events to active and will not send events to later tools or event handlers if the latest tool was blocking In this way a single tool can be used to handle ALL user interaction via the GUI at one time
Definition: PlotTool.h:43
casacore::Int64 nflagOut_
Definition: VisCal.h:416
virtual void calcOneMueller(casacore::Vector< casacore::Complex > &mat, casacore::Vector< casacore::Bool > &mOk, const casacore::Vector< casacore::Complex > &par, const casacore::Vector< casacore::Bool > &pOk)
Calculate a single Mueller matrix by some means.
virtual casacore::String siminfo()
simulation params - for a VC, sim is apply; for a SVC this will get overriden
Definition: VisCal.h:161
casacore::Bool applied_
Application flag.
Definition: VisCal.h:393
casacore::Int & currIntent()
Definition: VisCal.h:255
casacore::Vector< casacore::Int > currScan_
Definition: VisCal.h:376
virtual void applyCal2(vi::VisBuffer2 &vb, casacore::Cube< casacore::Complex > &Vout, casacore::Cube< casacore::Float > &Wout, casacore::Bool trial=false)
casacore::Vector< casacore::Int > nChanPar_
Channel counts.
Definition: VisCal.h:386
casacore::Int64 ndataIn_
Flag counting.
Definition: VisCal.h:416
casacore::Cube< casacore::Bool > & currJElemOK()
Definition: VisCal.h:616
virtual void countInFlag(const VisBuffer &vb)
Flag counting.
casacore::Vector< casacore::Int > & nChanMatList()
Definition: VisCal.h:266
virtual casacore::Bool applyByMueller()
Are we applying via Mueller or Jones multiplication? (probably by Jones for native Jones...
Definition: VisCal.h:607
Jones & J1()
Access to matrix renderings of Jones matrices.
Definition: VisCal.h:611
casacore::Double & refFreq()
Definition: VisCal.h:259
casacore::Bool PValid()
Definition: VisCal.h:275
casacore::Double & lastTime()
Current coords.
Definition: VisCal.h:250
void initVisCal()
Initialize pointers, etc.
casacore::Int & nAnt()
Definition: VisCal.h:237
VisVector & V()
Access to matrix renderings of Visibilities.
Definition: VisCal.h:270
virtual void syncCalMat(const casacore::Bool &doInv=false)
{ throw(casacore::AipsError(&quot;VisMueller::applyCal2 NYI!!!!!!!!!!!!!&quot;)); };
virtual casacore::Double & interval()
Return the time interval over which this calibration is constant.
Definition: VisCal.h:149
virtual void calcAllMueller()
Calculate an ensemble of Mueller matrices (all baselines, channels)
virtual void corrupt(VisBuffer &vb)
virtual void syncMeta2(const vi::VisBuffer2 &vb)
casacore::Vector< casacore::Int > startChan_
Definition: VisCal.h:387
const casacore::Int & nChanPar() const
Number of par channels in current spw.
Definition: VisCal.h:131
casacore::Int nAnt_
Number of antennas.
Definition: VisCal.h:366
casacore::String & extraTag()
Definition: VisCal.h:196
casacore::Int & startChan()
Definition: VisCal.h:264
casacore::PtrBlock< casacore::Cube< casacore::Float > * > currRPar_
Definition: VisCal.h:403
casacore::Int nBln_
Number of baselines.
Definition: VisCal.h:369
casacore::Vector< casacore::Double > currTime_
Current indices.
Definition: VisCal.h:375
casacore::Bool isApplied()
Is this calibration matrix to be applied?
Definition: VisCal.h:143
virtual void countInFlag2(const vi::VisBuffer2 &vb)
virtual casacore::Bool spwOK(casacore::Int)
Definition: VisCal.h:117
virtual casacore::Bool trivialJonesElem()=0
Are the parameters the Jones matrix elements? (or is a non-trivial calculation required?) (Must be implemented in specializations!)
virtual void countOutFlag2(const vi::VisBuffer2 &vb)
virtual void syncCalMat(const casacore::Bool &doInv=false)
Sync matrices for current meta data (VisJones override)
virtual void applyCal(VisBuffer &vb, casacore::Cube< casacore::Complex > &Vout, casacore::Bool trial=false)=0
Row-by-row apply to a casacore::Cube&lt;casacore::Complex&gt; (generic)
virtual casacore::Bool applyByJones()
Definition: VisCal.h:608
virtual void applyCal(VisBuffer &vb, casacore::Cube< casacore::Complex > &Vout, casacore::Bool trial=false)
Row-by-row apply to a casacore::Cube&lt;casacore::Complex&gt; (applyByJones override)
void createMueller()
Create Mueller matrix algebra interface.
virtual void setMatByOk()
Set matrix elements according to their ok flags (e.g., makes a unit matrix if everything flagged...
virtual void applyCal2(vi::VisBuffer2 &vb, casacore::Cube< casacore::Complex > &Vout, casacore::Cube< casacore::Float > &Wout, casacore::Bool trial=false)
casacore::Int & currField()
Definition: VisCal.h:254
casacore::Int & nChanPar()
Current spectral shapes.
Definition: VisCal.h:262
virtual void invalidateCalMat()
Invalidate cal matrices generically (at this level, both Mueller and Jones)
Definition: VisCal.h:619
virtual void state()
Report the state.
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 casacore::Int nPar()=0
Number of pars per ant/bln (Must be implemented in specializations!)
virtual casacore::Bool applyByMueller()
Are we applying via Mueller multiplication? (necessarily true for native Muellers) ...
Definition: VisCal.h:471
virtual void syncCal2(const vi::VisBuffer2 &vb, const casacore::Bool &doInv=false)
virtual void calcOneJones(casacore::Vector< casacore::Complex > &mat, casacore::Vector< casacore::Bool > &mOk, const casacore::Vector< casacore::Complex > &par, const casacore::Vector< casacore::Bool > &pOk)
Calculate a single Jones matrix by some means from parameters.
Mueller & M()
Access to matrix renderings of Muellers.
Definition: VisCal.h:474
casacore::PtrBlock< casacore::Cube< casacore::Complex > * > currMElem_
Current Mueller matrix elements.
Definition: VisCal.h:544
double Double
Definition: aipstype.h:55
casacore::Int focusChan_
In-focus channel for single-chan solves on multi-chan data.
Definition: VisCal.h:396
casacore::Bool MValid()
Definition: VisCal.h:486
virtual void applyCal2(vi::VisBuffer2 &vb, casacore::Cube< casacore::Complex > &Vout, casacore::Cube< casacore::Float > &Wout, casacore::Bool trial=false)=0
casacore::PtrBlock< casacore::Cube< casacore::Bool > * > currJElemOK_
Definition: VisCal.h:687
virtual void calcWtScale()
Perform weight scale calculation (specializable)
virtual Mueller::MuellerType muellerType()
What kind of Mueller matrices should we use? (A function of the jonesType and target data shape) ...
casacore::Double & currTime()
Definition: VisCal.h:251
casacore::Int & nBln()
Definition: VisCal.h:238
casacore::Vector< casacore::Int > & startChanList()
Definition: VisCal.h:267
casacore::Vector< casacore::Double > lastTime_
Definition: VisCal.h:381
void setCalChannelization(const casacore::Int &nChanDat)
Set the calibration matrix channelization.
casacore::Cube< casacore::Bool > & currMElemOK()
Definition: VisCal.h:478
virtual casacore::Vector< casacore::Bool > spwOK()
Report calibration availability per spw (always true for non-tabular?)
Definition: VisCal.h:116
void createJones()
Create Jones interface.
virtual void syncMeta(const VisBuffer &vb)
Set internal meta data from a VisBuffer or another VisCal.
virtual casacore::Bool VBOKforCalApply(vi::VisBuffer2 &)
Calibration expected AND available? (always assume true for non-tabular)
Definition: VisCal.h:125
virtual casacore::Bool calAvailable(vi::VisBuffer2 &)
Calibration available? (always true for non-tabular)
Definition: VisCal.h:121
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 Jones::JonesType jonesType()=0
What kind of Jones matrix are we? (Must be implemented in specializations!)
virtual void corrupt2(vi::VisBuffer2 &vb)
virtual void invalidateCalMat()
Invalidate cal matrices generically (at this level, just Mueller)
Definition: VisCal.h:481
VisMueller()
Default ctor is private.
casacore::PtrBlock< casacore::Cube< casacore::Bool > * > currMElemOK_
Definition: VisCal.h:545
casacore::PtrBlock< casacore::Cube< casacore::Complex > * > currCPar_
Current parameters.
Definition: VisCal.h:402
casacore::Bool calWt_
Trigger calibration of weights.
Definition: VisCal.h:410
virtual casacore::String applyinfo()
Apply info/params, suitable for logging.
casacore::Int & currSpw()
Current in-focus spw.
Definition: VisCal.h:247
casacore::Vector< casacore::Double > currFreq_
Definition: VisCal.h:380
casacore::PtrBlock< casacore::Cube< casacore::Bool > * > currParOK_
Definition: VisCal.h:404
VisJones()
Default ctor is private.
Jones & J2()
Definition: VisCal.h:612
casacore::Int & currObs()
Definition: VisCal.h:253
A drop-in replacement for Block&lt;T*&gt;.
Definition: WProjectFT.h:54
virtual casacore::Cube< casacore::Float > & currRPar()
Definition: VisCal.h:224
A Table intended to hold astronomical data (a set of Measurements).
virtual casacore::Cube< casacore::Bool > & currParOK()
Definition: VisCal.h:225
casacore::PtrBlock< casacore::Cube< casacore::Float > * > currWtScale_
Weight scale factors.
Definition: VisCal.h:413
virtual void syncPar()
Sync parameters for current meta data.
virtual casacore::Bool trivialMuellerElem()
Jones matrices can never be trivial Muellers!
Definition: VisCal.h:598
casacore::Int & nChanMat()
Definition: VisCal.h:263
virtual void updateWt(casacore::Vector< casacore::Float > &wt, const casacore::Int &a1, const casacore::Int &a2)
Update the wt vector for a baseline.
casacore::Bool & calWt()
Trigger calibration of weights.
Definition: VisCal.h:164
casacore::Cube< casacore::Complex > & currJElem()
Access to Jones matrix element array.
Definition: VisCal.h:615
virtual void setApply()
Set the application parameters.
virtual casacore::String longTypeName()
Definition: VisCal.h:102
const bool delmsmc_
Definition: VisCal.h:360
casacore::Vector< casacore::Double > & currFreq()
Definition: VisCal.h:256
virtual void invalidateCalMat()=0
Invalidate cal matrices generically.
virtual void calcWtScale()
Perform weight scale calculation (specializable)
casacore::Cube< casacore::Complex > & currMElem()
Access to current matrices.
Definition: VisCal.h:477
casacore::Double refFreq_
Definition: VisCal.h:383
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
virtual void correct2(vi::VisBuffer2 &vb, casacore::Bool trial=false, casacore::Bool doWtSp=false, casacore::Bool dosync=true)
Base class for all Casacore library errors.
Definition: Error.h:134
virtual casacore::Int & nElem()
Number of parameter sets is number of antennas.
Definition: VisCal.h:591
virtual casacore::Int nCalMat()
Number of Cal Matrices to form on baseline axis (Mueller, apply context: nBln())
Definition: VisCal.h:462
casacore::Int prtlev_
Print level.
Definition: VisCal.h:419
const MSMetaInfoForCal & msmc() const
Access to the MSMetaInfoForCal (throws if none)
Definition: VisCal.h:338
VisJones
Definition: VisCal.h:557
ParType
Enumeration of parameter types (casacore::Complex, Real, or Both)
Definition: VisCal.h:65
virtual ~VisJones()
casacore::Double interval_
Solution timescale (context-dependent)
Definition: VisCal.h:390
virtual casacore::Bool isSolvable()
Is this solveable? (never via this interface)
Definition: VisCal.h:146
void invalidateJ()
Validation of Jones matrices.
Definition: VisCal.h:622
SolvableVisJones
virtual casacore::Int nCalMat()=0
Number of Calibration matrices on ant/bln axis.
casacore::Double refTime_
Definition: VisCal.h:382
casacore::Int currSpw_
Current synchronized spw.
Definition: VisCal.h:372
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::PtrBlock< VisVector * > V_
VisVector wrapper (per Spw)
Definition: VisCal.h:399
casacore::PtrBlock< Jones * > J1_
Jones algebra wrapper (per Spw)
Definition: VisCal.h:682
virtual void setCallib(const casacore::Record &callib, const casacore::MeasurementSet &selms)
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
virtual void countOutFlag(const VisBuffer &vb)
casacore::String extratag_
Definition: VisCal.h:421
virtual casacore::Bool timeDepMat()
Matrices time-dependent per parameter set (nominally no)
Definition: VisCal.h:140
virtual Type type()=0
Return the type of this calibration matrix (actual type of derived class).
virtual void updateWt2(casacore::Matrix< casacore::Float > &wt, const casacore::Int &a1, const casacore::Int &a2)
virtual void syncMueller(const casacore::Bool &doInv=false)
Sync Mueller matrix elements for current parameters.
void invalidateM()
Validation of Mueller matrices (for currSpw)
Definition: VisCal.h:484
void deleteVisMueller()
Delete the this* caches.
virtual VisCalEnum::MatrixType matrixType()
Return casacore::Matrix type.
Definition: VisCal.h:105
virtual void setMeta(int obs, int scan, double time, int spw, const casacore::Vector< double > &freq, int fld)
VI2-related refactor-----------------------------------—.
virtual void syncCal(const VisBuffer &vb, const casacore::Bool &doInv=false)
Synchronize &quot;gains&quot; with a VisBuffer or another VisCal.
virtual casacore::Record actionRec()
virtual void applyCal(VisBuffer &vb, casacore::Cube< casacore::Complex > &Vout, casacore::Bool trial=false)
Row-by-row apply to a casacore::Cube&lt;casacore::Complex&gt; (applyByMueller override) ...
void checkCurrCal()
Test for need of new calibration.
casacore::Bool JValid()
Definition: VisCal.h:624
virtual ~VisMueller()
void validateM()
Definition: VisCal.h:485
void deleteVisJones()
Delete the this* caches.
void setPrtlev(const casacore::Int &prtlev)
Set the print level.
Definition: VisCal.h:190
virtual ~VisCal()
virtual void correct(VisBuffer &vb, casacore::Bool trial=false)
Apply calibration to data in VisBuffer (correct casacore::Data or corrupt Model) (in-place versions) ...
virtual void initCalFlagCount()
Flag counting.
casacore::Cube< casacore::Float > & currWtScale()
Access to weight-scaling factors.
Definition: VisCal.h:281
static casacore::String nameOfType(Type type)
Definition: VisCal.h:67
const MSMetaInfoForCal * msmc_
The MSMetaInfoForCal pointer.
Definition: VisCal.h:359
casacore::Vector< casacore::Bool > MValid_
Mueller validity.
Definition: VisCal.h:548
virtual casacore::Int nCalMat()
Number of Cal Matrices to form on antenna axis (Jones, apply context: nAnt())
Definition: VisCal.h:595
virtual void setMatByOk()
Set matrix elements according to their ok flags (e.g., makes a unit matrix if everything flagged...
casacore::Double & refTime()
Definition: VisCal.h:258
casacore::Vector< casacore::Int > currIntent_
Definition: VisCal.h:379
casacore::Vector< casacore::Int > nChanMat_
Definition: VisCal.h:386
virtual casacore::Cube< casacore::Complex > & currCPar()
Access (public) to current solution parameters and matrices.
Definition: VisCal.h:223
casacore::Vector< casacore::Bool > JValid_
Jones validity, per spw.
Definition: VisCal.h:690
casacore::String msName_
Associated casacore::MS name.
Definition: VisCal.h:356
virtual void calcPar()
Calculate Mueller parameters by some means.