casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SolvableVisCal.h
Go to the documentation of this file.
1 //# SolvableVisCal.h: Definitions of interface for SolvableVisCal
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 
28 #ifndef SYNTHESIS_SOLVABLEVISCAL_H
29 #define SYNTHESIS_SOLVABLEVISCAL_H
30 
31 #include <casa/aips.h>
32 #include <casa/Containers/Record.h>
33 #include <casa/BasicSL/Complex.h>
34 #include <casa/BasicSL/Constants.h>
46 #include <msvis/MSVis/VisSet.h>
49 
51 #include <casa/Logging/LogSink.h>
52 #include <casa/Logging/LogIO.h>
53 #include <casa/OS/Timer.h>
54 #if ! defined(WITHOUT_DBUS)
58 #endif
59 
60 #include <iostream>
61 #include <fstream>
62 
63 namespace casa { //# NAMESPACE CASA - BEGIN
64 
65 
66 // **********************************************************
67 // SolvableVisCal
68 //
69 
70 // Forward
71 class VisEquation;
72 class SolveDataBuffer;
73 class SDBList;
74 
75 
76 class SolNorm {
77 
78 public:
79 
80  enum Type { MEAN, MEDIAN, UNKNOWN };
81 
83  SolNorm(const SolNorm& other);
84 
85  inline casacore::Bool donorm() const { return donorm_; };
86  inline Type normtype() const { return normtype_; };
88 
89  void report();
90 
91 private:
92 
93  // data
96 
99 
100 
101 };
102 
103 class SolvableVisCal : virtual public VisCal {
104 public:
105 
106  typedef struct fluxScaleStruct {
116  //casacore::Matrix<casacore::Double> covarmat;
117  //casacore::PtrBlock<casacore::Matrix<casacore::Double>* > covarmat;
119  } fluxScaleStruct;
120 
121 
122  SolvableVisCal(VisSet& vs);
123 
125 
127 
129 
130  virtual ~SolvableVisCal();
131 
132  // Access to user-supplied parameters
135  inline casacore::Bool& append() { return append_; };
139  inline casacore::String& refantmode() { return refantmode_; };
140  inline casacore::Int& refant() { return refantlist()(0); };
142  inline casacore::Int& minblperant() { return minblperant_; };
143  inline casacore::String& apmode() { return apmode_; };
144  inline casacore::String& solmode() { return solmode_; };
146  inline casacore::String& solint() { return solint_; };
147  inline casacore::String& fsolint() { return fsolint_; };
148  inline casacore::Double& preavg() { return preavg_; };
149  inline const SolNorm& solNorm() { return solnorm_;};
150  inline casacore::Bool solnorm() { return solnorm_.donorm();};
151  inline casacore::Float& minSNR() { return minSNR_; };
152 
153  inline casacore::String& combine() { return combine_; };
154  inline casacore::Bool combspw() { return upcase(combine_).contains("SPW"); };
155  inline casacore::Bool combfld() { return upcase(combine_).contains("FIELD"); };
156  inline casacore::Bool combscan() { return upcase(combine_).contains("SCAN"); };
157  inline casacore::Bool combobs() { return upcase(combine_).contains("OBS"); };
158 
159  // Total number of (complex) parameters per solve
160  // (specialize to jive with ant- or bln-basedness, etc.)
161  virtual casacore::Int nTotalPar()=0;
162 
163  // Report if calibration available for specified spw
164  // (if no CalInterp available, assume true)
165 
166  // Use generic data gathering mechanism for solve
167  virtual casacore::Bool useGenericGatherForSolve() { return true; };
168 
169  // Use generic solution engine for a single solve
170  // (usually inside the generic gathering mechanism)
172 
173  // Solve for point-source X or Q,U?
174  // nominally no (0)
175  virtual casacore::Int solvePol() { return 0; };
176 
177  // Does normalization by MODEL_DATA commute with this VisCal?
178  // (if so, permits pre-solve time-averaging)
179  virtual casacore::Bool normalizable()=0;
180 
181  // Should data and model be divided by Stokes I model before average+solve?
182  // (Nominally false, for now)
183  virtual casacore::Bool divideByStokesIModelForSolve() { return false; };
184 
185  // Is this type capable of accumulation? (nominally no)
186  virtual casacore::Bool accumulatable() { return false; };
187 
188  // Is this type capable of smoothing? (nominally no)
189  virtual casacore::Bool smoothable() { return false; };
190 
191  // Should only parallel-hands be used in solving?
192  // (generally no (default=false), but GJones and related
193  // will override, and eventually this will be a user-set-able
194  // parameter)
195  virtual casacore::Bool phandonly() { return false; }
196 
197  // Access to focus channel
198  inline casacore::Int& focusChan() { return focusChan_; };
199 
200  // Is this ready to solve?
201  inline casacore::Bool isSolved() {return solved_;};
202 
203  // Is this solveable? (via this interface, nominally yes)
204  virtual casacore::Bool isSolvable() {return true;};
205 
206  // Set the application parameters
207  virtual void setApply();
208  virtual void setApply(const casacore::Record& apply);
209  virtual void setCallib(const casacore::Record& callib,const casacore::MeasurementSet& selms);
210 
211  virtual void setModel(const casacore::String& )
212  {throw(SynthesisError("Internal error: setModel() not yet supported for non EPJones type."));};
213 
214  // Report apply info/params, e.g. for logging
215  virtual casacore::String applyinfo();
216 
217  // Set the solving parameters
218  virtual void setSolve();
219  virtual void setSolve(const casacore::Record& solve);
220 
221  // Report solve info/params, e.g., for logging
222  virtual casacore::String solveinfo();
223 
224  // Arrange for accumulation
225  virtual void setAccumulate(VisSet& vs,
226  const casacore::String& table,
227  const casacore::String& select,
228  const casacore::Double& t,
229  const casacore::Int& refAnt=-1);
230 
231  // Default value for parameters
232  virtual casacore::Complex defaultPar() { return casacore::Complex(1.0); };
233  virtual casacore::Float defaultRPar() { return casacore::Float(0.0); };
234  virtual casacore::Complex defaultCPar() { return casacore::Complex(1.0); };
235 
236  // Arrange to build a cal table from specified values
237  virtual void setSpecify(const casacore::Record& specify);
238 
239  // Fill a caltable with specified values
240  virtual void specify(const casacore::Record& specify);
241 
242  // Size up the solving arrays, etc. (supports combine)
244 
245  // These inflate methods soon to deprecate (gmoellen, 20121212)
246  // Inflate the pristine CalSet (from VisSet info)
247  void inflate(VisSet& vs, const casacore::Bool& fillMeta=false);
248  // Inflate the pristine CalSet (generically)
249  virtual void inflate(const casacore::Vector<casacore::Int>& nChanDat,
250  const casacore::Vector<casacore::Int>& startChanDat,
251  const casacore::Vector<casacore::Int>& nSlot);
252 
253 
254  // Hazard a guess at the parameters (solveCPar) given the data
255  virtual void guessPar(VisBuffer& vb)=0;
256  virtual void guessPar(SDBList&) { throw(casacore::AipsError("SVC::guessPar(SDBList&) NYI!!")); }; // VI2
257 
258  // Time-dep solution interval (VI2)
259  inline double solTimeInterval() const { return solTimeInterval_; };
260 
261  // Freq-dep solint values (const?!)
263  inline casacore::Double& fintervalCh() { return fintervalCh_(currSpw()); }; // for current Spw
264  const inline casacore::Vector<casacore::Double>& fintervalChV() { return fintervalCh_; }; // all spws
267 
268  // Access to current solution parameters and matrices
270  inline virtual casacore::Cube<casacore::Float>& solveRPar() {return (*solveRPar_[currSpw()]);};
274 
280 
281  // Access to per-spw solution parameters and matrices
283  { if (spw<nSpw()) cparSpw = (*solveAllCPar_[spw]);}
284  inline virtual void solveAllRPar(casacore::Int spw, casacore::Cube<casacore::Float>& rparSpw)
285  { if (spw<nSpw()) rparSpw = (*solveAllRPar_[spw]);}
286  inline virtual void solveAllParOK(casacore::Int spw, casacore::Cube<casacore::Bool>& parokSpw)
287  { if (spw<nSpw()) parokSpw = (*solveAllParOK_[spw]);}
288  inline virtual void solveAllParErr(casacore::Int spw, casacore::Cube<casacore::Float>& parerrSpw)
289  { if (spw<nSpw()) parerrSpw = (*solveAllParErr_[spw]);}
290  inline virtual void solveAllParSNR(casacore::Int spw, casacore::Cube<casacore::Float>& parsnrSpw)
291  { if (spw<nSpw()) parsnrSpw = (*solveAllParSNR_[spw]);}
292 
293  // Access to source pol parameters
295 
296  // Synchronize the meta data with a solvable VisBuffer
297  // (returns false if VisBuffer has no valid data)
300  void syncSolveMeta(SDBList& sdbs); // VI2 (valid data now checked elsewhere)
301  // Provide for override of currScan and currObs
303 
304  // If apmode() is "A", convert vb's visibilities to amp + 0i.
305  // If it is "P", convert them to phase + 0i.
306  // Otherwise (i.e. "AP"), leave them alone.
307  virtual void enforceAPonData(VisBuffer& vb);
308 
309  // Verify VisBuffer data sufficient for solving (wts, etc.)
311  virtual casacore::Bool verifyConstraints(SDBList& sdbs); // VI2
313 
314  // Self- gather and/or solve prototypes
315  // (triggered by useGenericGatherForSolve=F or useGenericSolveOne=F;
316  // must be overridden in derived specializations)
317  virtual void selfGatherAndSolve(VisSet& vs, VisEquation& ve);
318  virtual void selfSolveOne(VisBuffGroupAcc& vs);
319  virtual void selfSolveOne(SDBList&) { throw(casacore::AipsError("selfSolveOne for VI2/SDB usage NYI for "+typeName())); };
320 
321  // Set up data and model for pol solve
322  void setUpForPolSolve(VisBuffer& vb);
323  // A VB2-specific version which depends on local specialization
324  // (this may be further refined later)
326  throw(casacore::AipsError("setUpForPolSolve(VB2) not specialized in "+typeName()+" as required.")); };
327 
328  // Differentiate VB model w.r.t. Cal parameters (no 2nd derivative yet)
329  virtual void differentiate(CalVisBuffer& cvb)=0;
330  virtual void differentiate(SolveDataBuffer&) { throw(casacore::AipsError("SVC::differentiate(SDB) NYI!")); }; // VI2
331  virtual void differentiate(VisBuffer& vb,
335  virtual void differentiate(VisBuffer& , // vb.visCube() has the obs. data. vb.modelVisCube() will receive the residuals
336  VisBuffer& , // 1st. Derivative w.r.t. first parameter
337  VisBuffer& , // 1st. Derivative w.r.t. second parameter
338  casacore::Matrix<casacore::Bool>& ){ throw(casacore::AipsError("Invalid use of differentiate(vb,dV0,dv1)")); };
339 
340 
341  // Differentiate VB model w.r.t. Source parameters
342  virtual void diffSrc(VisBuffer& vb,
344 
345  // Update solve parameters incrementally (additive)
347  virtual void updatePar(const casacore::Vector<casacore::Complex> dCalPar); // (VI2)
348 
349  // Form solution SNR
350  virtual void formSolveSNR();
351 
352  // Apply SNR threshold
353  virtual void applySNRThreshold();
354 
355  // Apply refant (implemented in SVJ)
356  virtual void reReference()=0;
357 
358  // Retrieve the cal flag info as a record
359  virtual casacore::Record actionRec();
360 
361  // Retrieve solve-related info via Record
363 
364  // Accumulate another VisCal onto this one
365  virtual void accumulate(SolvableVisCal* incr,
366  const casacore::Vector<casacore::Int>& fields)=0;
367 
368  virtual void smooth(casacore::Vector<casacore::Int>& fields,
369  const casacore::String& smtype,
370  const casacore::Double& smtime);
371 
372  // Report solved-for QU
373  virtual void reportSolvedQU();
374 
375 
376  // New CalTable handling
377  virtual void createMemCalTable();
378  virtual void keep1(casacore::Int ichan);
379  virtual void keepNCT();
380  virtual void storeNCT();
381  void storeNCT(const casacore::String& tableName,const casacore::Bool& append);
382 
383  virtual void loadMemCalTable(casacore::String ctname,casacore::String field="");
384 
385  // New spwOK
386  virtual casacore::Bool spwOK(casacore::Int ispw);
387 
388  //Is VB OK for calibration?
390 
391  // Calibration available?
393 
394  // Post solve tinkering (generic version)
395  virtual void globalPostSolveTinker();
396 
397  // Divide all solutions by their amplitudes
398  virtual void enforceAPonSoln();
399 
400  // Normalize a solution (generic implementation)
401  virtual void normalize();
402 
403  // Determine and apply flux density scaling
404  virtual void fluxscale(const casacore::String& outfile,
405  const casacore::Vector<casacore::Int>& refFieldIn,
406  const casacore::Vector<casacore::Int>& tranFieldIn,
407  const casacore::Vector<casacore::Int>& inRefSpwMap,
408  const casacore::Vector<casacore::String>& fldNames,
409  const casacore::Float& inGainThres,
410  const casacore::String& antSel,
411  const casacore::String& timerangeSel,
412  const casacore::String& scanSel,
413  fluxScaleStruct& oFluxScaleStruct,
414  const casacore::String& oListFile,
415  const casacore::Bool& incremental,
416  const casacore::Int& fitorder,
417  const casacore::Bool& display)=0;
418 
419  // Report state:
420  inline virtual void state() { stateSVC(true); };
421 
424  virtual void currMetaNote();
425 
426  virtual void listCal(const casacore::Vector<casacore::Int> ufldids, const casacore::Vector<casacore::Int> uantids,
427  const casacore::Matrix<casacore::Int> uchanids, //const casacore::Int& spw, const casacore::Int& chan,
428  const casacore::String& listfile="",const casacore::Int& pagerows=50)=0;
429 
430  // Handle external channel mask
432  inline void clearChanMask() { chanmask_=NULL; };
433  void applyChanMask(VisBuffer& vb);
434  // Log periodic solver activity
435  virtual void printActivity(const casacore::Int nSlots, const casacore::Int slotNo,
436  const casacore::Int fieldId, const casacore::Int spw,
437  const casacore::Int nSolutions);
438  virtual void markTimer() {timer_p.mark();};
439 
440 
441  // -------------
442  // Set the simulation parameters
443  virtual void setSimulate(VisSet& vs, casacore::Record& simpar, casacore::Vector<casacore::Double>& solTimes);
444 
445  // make a corruptor in a VC-specific way
446  virtual void createCorruptor(const VisIter& vi,const casacore::Record& simpar, const int nSim);
447 
448  // access to simulation variables that are general to all VisCals
449  inline casacore::String& simint() { return simint_; };
450 
451  // Simulation info/params, suitable for logging
452  virtual casacore::String siminfo();
453 
454  // Is this calibration simulated?
456 
457  // object that can simulate the corruption terms
459 
460  // calculate # required slots to simulate this SVC
462 
463 
464  // VI2-related refactor--------------------------------------
465 
466  // Set "current" meta info, so internals are registered
467  // (VI2: replaces meta-inf part of syncSolveMeta;
468  // NB: does _NOT_ check sum(wt)>0 older syncSolveMeta!)
469  virtual void setMeta(int obs, int scan, double time,
470  int spw, const casacore::Vector<double>& freq,
471  int fld);
472 
473  // Reshape solvePar* arrays for the currSpw()
474  // (ensitive to freqDepPar())
475  // (VI2: replaces initSolvePar part of sizeUpSolve)
476  virtual int sizeSolveParCurrSpw(int nVisChan);
477 
478  // Set parameters to def values in the currSpw(),
479  // and optionally sync everything
480  virtual void setDefSolveParCurrSpw(bool sync=false);
481 
482  // Parse solint in VI2 context
483  void reParseSolintForVI2();
484 
485  // Generate the in-memory caltable (empty)
486  // NB: no subtable revisions
487  virtual void createMemCalTable2();
488 
489  // Set (or verify) freq info in output cal table for specified spw
490  virtual void setOrVerifyCTFrequencies(int spw);
491 
492 
493 protected:
494 
495  // Set to-be-solved-for flag
496  inline void setSolved(const casacore::Bool& flag) {solved_=flag;};
497 
498  // Initialize solve parameters (shape)
499  virtual void initSolvePar()=0;
500 
501  // Invalidate diff cal matrices generically
502  inline virtual void invalidateDiffCalMat()=0;
503 
504  // Explicitly synchronize pars with a CalSet slot
505  using VisCal::syncPar;
506 
507  // Set matrix channelization according to a VisSet
508  virtual void setSolveChannelization(VisSet& vs);
509 
510  // Convert Hz to Ch in fsolint
511  virtual void convertHzToCh();
512 
513  // Calculate chan averaging bounds
514  virtual void setFracChanAve();
515 
516  // Inflate an NCT w/ meta-data according to a VisSet
517  // (for accum)
518  void inflateNCTwithMetaData(VisSet& vs);
519 
520  // Synchronize calibration for solve context
521  void syncSolveCal();
522 
523  // Synchronize parameters for solve context
524  void syncSolvePar();
525 
526  // Calculate parameters by some means (e.g., interpolation from a CalSet)
527  virtual void calcPar();
528  virtual void calcParByCLPP();
529 
530  // Synchronize the differentiated calibration
531  virtual void syncDiffMat()=0;
532 
533  // Report the SVC-specific state, w/ option for VC::state()
534  virtual void stateSVC(const casacore::Bool& doVC);
535 
536  // Normalize a (complex) solution array (generic)
538  const casacore::Array<casacore::Bool>& solOK,
539  const casacore::Bool doPhase=false);
540 
542 
543  // Logger
545 
546  // Check if a cal table is appropriate
547  void verifyCalTable(const casacore::String& caltablename);
548 
549  void sortVisSet(VisSet& vs, const casacore::Bool verbose=false);
550 
552 
553  // New CalTable
558 
563 
564  // Set state flag to simulate cal terms
565  inline void setSimulated(const casacore::Bool& flag) {simulated_=flag;};
566 
567  // RI todo implement calcOneJones like calcAllMueller
568  // calculate terms during apply, or up front during setSim?
570  // cout << "simOTF=" << onthefly_ << endl;
571  return onthefly_; };
572 
573 
574 
575 private:
576 
577  // Default ctor is private
578  SolvableVisCal();
579 
580  // Initialize pointers, etc.
581  void initSVC();
582 
583  // Delete pointers
584  void deleteSVC();
585 
586  // Pointer to CTTimeInterp1 factory method (generic)
587  // SVC specializations may choose to specialize CTTimeInterp1, as needed,
588  // and override this method accordingly (e.g., see FringeJones.h)
590 
591  // Cal table name
595 
596  // Interpolation types
599 
600  // Spw mapping
602 
603  // Refant mode
605 
606  // Refant
608 
609  // Min baselines per ant for solve
611 
612  // Solved-for flag
614 
615  // Signal apply by callib
617 
618  // Solving mode
620 
621  // Solver iteration mode
624 
625  // User-specified full solint string
627 
628  // User-specified time-dep solint (string)
630 
631  // Derived time-dep solution interval (s) (VI2)
633 
634  // User-specified freq-dep solint info
636 
637  // Derived frequency intervals
640 
641 
642  // Channel averaging bounds
644 
645  // Preavering interval
647 
648  // Do solution normalization after a solve
650 
651  // SNR threshold
653 
654  // axes to combine for solve
656 
657  // In-focus channel for single-chan solves on multi-chan data
659 
660  // Solving meta-data
664 
665 
666  // Current parameters
672 
678 
680 
681  // A _pointer_ to the external channel mask
683 
684  // LogIO
686 
687  // Simulation flag
689 
690  // simulation interval
692 
694 
695 };
696 
697 
698 
699 // **********************************************************
700 // SolvableVisMueller
701 //
702 
703 class SolvableVisMueller : public SolvableVisCal, virtual public VisMueller
704 {
705 
706 public:
707 
709 
711 
713 
715 
716  virtual ~SolvableVisMueller();
717 
718  // Total number of (complex) parameters per solve
719  // Mueller version: just return number of per-Bln parameters
720  virtual casacore::Int nTotalPar() { return nPar(); };
721 
722  // Does normalization by MODEL_DATA commute with this VisCal?
723  virtual casacore::Bool normalizable() { return (this->muellerType() < Mueller::General); };
724 
725  // Hazard a guess at the parameters (solvePar) given the data
726  virtual void guessPar(VisBuffer& ) { throw(casacore::AipsError("NYI")); };
727 
728  // Differentiate VB model w.r.t. Mueller parameters (no 2nd derivative yet)
729  virtual void differentiate(CalVisBuffer& ) {throw(casacore::AipsError("SVM::differentiate(CVB): NYI")); };
730  virtual void differentiate(SolveDataBuffer& ) {throw(casacore::AipsError("SVM::differentiate(SDB): NYI")); }; // VI2
731  virtual void differentiate(VisBuffer& , // input data
732  casacore::Cube<casacore::Complex>& , // trial apply (nCorr,nChan,nRow)
733  casacore::Array<casacore::Complex>& , // 1st deriv (nCorr,nPar,nChan,nRow)
736 
737  // Differentiate VB model w.r.t. Source parameters
738  virtual void diffSrc(VisBuffer& ,
740 
741  // Apply refant (no-op for Muellers)
742  virtual void reReference() {};
743 
744  // Accumulate another VisCal onto this one
745  virtual void accumulate(SolvableVisCal* ,
746  const casacore::Vector<casacore::Int>& ) { throw(casacore::AipsError("NYI")); };
747 
748  // Scale solutions
749  virtual void fluxscale(const casacore::String&,
754  const casacore::Float& ,
755  const casacore::String& ,
756  const casacore::String& ,
757  const casacore::String& ,
759  const casacore::String&,
760  const casacore::Bool&,
761  const casacore::Int&,
762  const casacore::Bool&)
763  { throw(casacore::AipsError("NYI")); };
764 
765  // SVM-specific write to caltable
766  virtual void keepNCT();
767 
768  // Report state:
769  inline virtual void state() { stateSVM(true); };
770 
771  // casacore::List calibration solutions in tabular form.
775  const casacore::String& ,
776  const casacore::Int& )
777  { throw(casacore::AipsError(casacore::String("Calibration listing not supported for "+typeName()))); };
778 
779 protected:
780 
781  // Number of Cal Matrices to form on baseline axis
782  // (Mueller, solve context: 1)
783  virtual casacore::Int nCalMat() { return isSolved() ? 1 : nBln(); };
784 
785  // Are differentiated M matrices constant in chan & bln?
786  virtual casacore::Bool trivialDM() { return false; };
787 
788  // Initialize solve parameter shape
789  // Mueller version: (nPar(),1,1) (one chan, one baseline)
790  virtual void initSolvePar();
791 
792  // Access to matrix rendering of dM (per par)
793  inline Mueller& dM() { return *dM_; };
794 
795  // Access to differentiated Mueller elements
797 
798  // Invalidate diff cal matrices generically (at this level, just M, dM)
799  inline virtual void invalidateDiffCalMat() { invalidateM(); invalidateDM(); };
800 
801  // Validation of diffMueller matrices
802  inline void invalidateDM() {DMValid_=false;};
803  inline void validateDM() {DMValid_=true;};
804  inline casacore::Bool DMValid() {return DMValid_;};
805 
806  // Synchronize the differentiated calibration (specialization for Mueller);
807  virtual void syncDiffMat();
808 
809  // Synchronize the Muellers AND diffMuellers
810  virtual void syncDiffMueller();
811 
812  // Calculate the ensemble of diff'd Mueller Elements
813  virtual void calcAllDiffMueller();
814 
815  // Calculate one diffMElem
817 
818  // Create matrix renderers for dMs
819  void createDiffMueller();
820 
821  // Override VM::setMatByOk in solve context
823 
824  // Initialize trivial diff'd Muellers
825  virtual void initTrivDM();
826 
827  // SVM-specific state
828  virtual void stateSVM(const casacore::Bool& doVC);
829 
830  // atomic power normalization calculation
831  // Mueller version assumes amp in power units
833 
834 private:
835 
836  // Default ctor is private
838 
839  // Mueller wrapper for diffMElem_;
841 
842  // Differentiated Mueller matrix elements
843  casacore::Array<casacore::Complex> diffMElem_; // (nDMEl,nPar,nChanMat,nBln)
844 
845  // diffMueller validation
847 
848 
849 };
850 
851 // **********************************************************
852 // SolvableVisJones
853 //
854 
856 
857 public:
858 
860 
862 
864 
866 
867  virtual ~SolvableVisJones();
868 
869  // Total number of (complex) parameters per solve
870  // Jones version: nPar()*nAnt()
871  virtual casacore::Int nTotalPar() { return nPar()*nAnt(); };
872 
873  // Does normalization by MODEL_DATA commute with this VisCal?
874  virtual casacore::Bool normalizable() { return (this->jonesType() < Jones::GenLinear); };
875 
876  // Differentiate VB model w.r.t. Jones parameters
877  virtual void differentiate(CalVisBuffer& cvb);
878  virtual void differentiate(SolveDataBuffer& sdb); // VI2
879  virtual void differentiate(VisBuffer& vb, // input data
880  casacore::Cube<casacore::Complex>& V, // trial apply (nCorr,nChan,nRow)
881  casacore::Array<casacore::Complex>& dV, // 1st deriv (nCorr,nPar,nChan,nRow,2)
884 
885  // Differentiate VB model w.r.t. Source parameters
886  virtual void diffSrc(VisBuffer& vb,
888 
889  // Apply refant
890  virtual void reReference();
891 
892  // Accumulate another VisCal onto this one
893  virtual void accumulate(SolvableVisCal* incr,
894  const casacore::Vector<casacore::Int>& fields);
895 
896  // Post solve tinkering (Jones version: includes refant application)
897  virtual void globalPostSolveTinker();
898 
899  // Apply reference antenna (generic Jones version)
900  virtual void applyRefAnt();
901 
902  // Fluxscale is implemented here
903  void fluxscale(const casacore::String& outfile,
904  const casacore::Vector<casacore::Int>& refFieldIn,
905  const casacore::Vector<casacore::Int>& tranFieldIn,
906  const casacore::Vector<casacore::Int>& inRefSpwMap,
907  const casacore::Vector<casacore::String>& fldNames,
908  const casacore::Float& inGainThres,
909  const casacore::String& antSel,
910  const casacore::String& timerangeSel,
911  const casacore::String& scanSel,
912  SolvableVisCal::fluxScaleStruct& oFluxScaleStruct,
913  const casacore::String& oListFile,
914  const casacore::Bool& incremental=false,
915  const casacore::Int& fitorder=1,
916  const casacore::Bool& display=false);
917 
918  // SVJ-specific write to caltable
919  virtual void keepNCT();
920 
921  // Report state:
922  inline virtual void state() { stateSVJ(true); };
923 
924  // Write calibration solutions to the terminal
925  virtual void listCal(const casacore::Vector<casacore::Int> ufldids, const casacore::Vector<casacore::Int> uantids,
926  const casacore::Matrix<casacore::Int> uchanids,
927  const casacore::String& listfile="",const casacore::Int& pagerows=50);
928 
929  // Write header for listCal output
930  int writeHeader(const casacore::uInt numAntCols,
931  const casacore::uInt numAnts,
932  const casacore::uInt iElem);
933 
936 
937  //plotting historgram
938  void setupPlotter();
939  void plotHistogram(const casacore::String& title, const casacore::Int index,
941 
942 protected:
943 
944  // Number of Cal Matrices to form on baseline axis
945  // (Jones, all contexts: nAnt())
946  virtual casacore::Int nCalMat() { return nAnt(); };
947 
948  // DM never trivial for SVJ
949  virtual casacore::Bool trivialDM() { return false; };
950 
951  // Are differentiated J matrices constant in chan & ant?
952  inline virtual casacore::Bool trivialDJ() { return false; };
953 
954  // Initialize solve parameter shape
955  // Jones version: (nPar(),1,nAnt()) (one chan, all antennas)
956  virtual void initSolvePar();
957 
958  // Access to matrix rendering of dJ1, dJ2
959  inline Jones& dJ1() { return *dJ1_; };
960  inline Jones& dJ2() { return *dJ2_; };
961 
962  // Access to differentiated Joness
964 
965  // Invalidate diff cal matrices generically (at this level, M, dM, J, dJ)
966  inline virtual void invalidateDiffCalMat() {
968 
969  // Validation of Jones matrix derivatives
970  inline void invalidateDJ() {DJValid_=false;};
971  inline void validateDJ() {DJValid_=true;};
972  inline casacore::Bool DJValid() {return DJValid_;};
973 
974  // Synchronize the differentiated calibration (specialization for Jones)
975  virtual void syncDiffMat();
976 
977  // Synchronize the Jones AND diffJones matrices
978  virtual void syncDiffJones();
979 
980  // Calculate the ensemble of diff'd Jones Elements
981  virtual void calcAllDiffJones();
982 
983  // Calculate one ant/chan's diffJElem w.r.t. each par
985 
986  // Create matrix renderers for dJs
987  void createDiffJones();
988 
989  // Override VJ::setMatByOk in solve context
990  void setMatByOk() { if (!isSolved()) VisJones::setMatByOk(); };
991 
992  // Initialize trivial diff'd Jones
993  virtual void initTrivDJ();
994 
995  virtual void stateSVJ(const casacore::Bool& doVC);
996 
997  // atomic power normalization calculation
998  // SVJ version assumes amp in voltage units
1000 
1001 private:
1002 
1003  // Default ctor is private
1004  SolvableVisJones();
1005 
1006  // Jones wrappers for diffJElem_;
1009 
1010  // Differentiated Jones matrix elements
1011  casacore::Array<casacore::Complex> diffJElem_; // (nJME,nPar,nChanMat,nAnt,2)
1012 
1013  // Validity of Jones matrix derivatives
1015 
1016  // Column widths for listing
1020 
1021  //for plotting
1022 #if ! defined(WITHOUT_DBUS)
1025 #endif
1026 
1027 };
1028 
1029 // Global methods
1030 
1031 // Discern cal table type from the table itself
1033 
1034 } //# NAMESPACE CASA - END
1035 
1036 #endif
casacore::Vector< casacore::Float > & rmsthresh()
virtual void selfSolveOne(VisBuffGroupAcc &vs)
Mueller * dM_
Mueller wrapper for diffMElem_;.
virtual casacore::Cube< casacore::Float > & solveRPar()
virtual void selfGatherAndSolve(VisSet &vs, VisEquation &ve)
Self- gather and/or solve prototypes (triggered by useGenericGatherForSolve=F or useGenericSolveOne=F...
casacore::Bool combfld()
void createDiffJones()
Create matrix renderers for dJs.
casacore::Vector< casacore::Float > rmsthresh_
virtual void setDefSolveParCurrSpw(bool sync=false)
Set parameters to def values in the currSpw(), and optionally sync everything.
virtual casacore::Bool trivialDM()
DM never trivial for SVJ.
VisCal
Definition: VisCal.h:53
casacore::String combine_
axes to combine for solve
casacore::Vector< casacore::Complex > & srcPolPar()
Access to source pol parameters.
casacore::Vector< casacore::Matrix< casacore::Double > > covarmat
casacore::Matrix&lt;casacore::Double&gt; covarmat; casacore::PtrBlock&lt;casacore::Matrix&lt;casacore::Double&gt;* &gt;...
virtual casacore::Int nTotalPar()
Total number of (complex) parameters per solve Mueller version: just return number of per-Bln paramet...
SolNorm(casacore::Bool donorm=false, casacore::String normtype=casacore::String("mean"))
virtual casacore::Bool VBOKforCalApply(vi::VisBuffer2 &vb)
Is VB OK for calibration?
int Int
Definition: aipstype.h:50
CalCorruptor * corruptor_p
object that can simulate the corruption terms
virtual casacore::Bool normalizable()
Does normalization by MODEL_DATA commute with this VisCal?
virtual void createCorruptor(const VisIter &vi, const casacore::Record &simpar, const int nSim)
make a corruptor in a VC-specific way
Jones & dJ1()
Access to matrix rendering of dJ1, dJ2.
Jones * dJ1_
Jones wrappers for diffJElem_;.
virtual Mueller::MuellerType muellerType()=0
Mueller matrix type (must be implemented in Mueller specializations!)
casacore::String & tInterpType()
virtual void updatePar(const casacore::Vector< casacore::Complex > dCalPar, const casacore::Vector< casacore::Complex > dSrcPar)
Update solve parameters incrementally (additive)
void setChanMask(casacore::PtrBlock< casacore::Vector< casacore::Bool > * > &chanmask)
Handle external channel mask.
casacore::String simint_
simulation interval
casacore::Vector< casacore::Double > fitreffreq
virtual void keepNCT()
SVM-specific write to caltable.
SolvableVisMueller
casacore::Float minSNR_
SNR threshold.
virtual casacore::Float calcPowerNorm(casacore::Array< casacore::Float > &amp, const casacore::Array< casacore::Bool > &ok)=0
VisMueller
Definition: VisCal.h:431
virtual void reportSolvedQU()
Report solved-for QU.
virtual casacore::Cube< casacore::Bool > & solveAllParOK()
casacore::Int & nSpw()
General Shape Info.
Definition: VisCal.h:236
void sortVisSet(VisSet &vs, const casacore::Bool verbose=false)
virtual void normalize()
Normalize a solution (generic implementation)
virtual void specify(const casacore::Record &specify)
Fill a caltable with specified values.
casacore::Vector< casacore::Bool > spwOK_
CTTimeInterp1 *(* CTTIFactoryPtr)(NewCalTable &, const casacore::String &, casacore::Array< casacore::Float > &, casacore::Array< casacore::Bool > &)
Pointer to static factory methods for CTTimeInterp1.
casacore::Matrix< casacore::Int > numSol
virtual void guessPar(VisBuffer &vb)=0
Hazard a guess at the parameters (solveCPar) given the data.
virtual casacore::Complex defaultCPar()
casacore::Bool combspw()
virtual void fluxscale(const casacore::String &outfile, const casacore::Vector< casacore::Int > &refFieldIn, const casacore::Vector< casacore::Int > &tranFieldIn, const casacore::Vector< casacore::Int > &inRefSpwMap, const casacore::Vector< casacore::String > &fldNames, const casacore::Float &inGainThres, const casacore::String &antSel, const casacore::String &timerangeSel, const casacore::String &scanSel, fluxScaleStruct &oFluxScaleStruct, const casacore::String &oListFile, const casacore::Bool &incremental, const casacore::Int &fitorder, const casacore::Bool &display)=0
Determine and apply flux density scaling.
Type normtype() const
const SolNorm & solNorm()
casacore::Matrix< casacore::Int > chanAveBounds(casacore::Int spw)
virtual void solveAllRPar(casacore::Int spw, casacore::Cube< casacore::Float > &rparSpw)
casacore::String & apmode()
void initSVC()
Initialize pointers, etc.
void apply(const Jones &j1, VisVector &v, const Jones &j2)
Apply a pair of Jones to a VisVector:
virtual void differentiate(VisBuffer &, VisBuffer &, VisBuffer &, casacore::Matrix< casacore::Bool > &)
virtual casacore::Bool smoothable()
Is this type capable of smoothing? (nominally no)
virtual void convertHzToCh()
Convert Hz to Ch in fsolint.
casacore::Int parType_
virtual void differentiate(CalVisBuffer &cvb)
Differentiate VB model w.r.t.
double solTimeInterval() const
Time-dep solution interval (VI2)
void setMatByOk()
Override VJ::setMatByOk in solve context.
virtual void enforceAPonSoln()
Divide all solutions by their amplitudes.
NewCalTable * ct_
New CalTable.
casacore::Vector< dbus::variant > panels_id_
SolvableVisJones()
Default ctor is private.
virtual casacore::Record solveActionRec()
Retrieve solve-related info via Record.
virtual void setSpecify(const casacore::Record &specify)
Arrange to build a cal table from specified values.
virtual Type type()
Return the type enum.
virtual void solveAllCPar(casacore::Int spw, casacore::Cube< casacore::Complex > &cparSpw)
Access to per-spw solution parameters and matrices.
casacore::Bool DJValid()
virtual void invalidateDiffCalMat()=0
Invalidate diff cal matrices generically.
virtual casacore::Cube< casacore::Complex > & solveCPar()
Access to current solution parameters and matrices.
virtual int sizeSolveParCurrSpw(int nVisChan)
Reshape solvePar* arrays for the currSpw() (ensitive to freqDepPar()) (VI2: replaces initSolvePar par...
casacore::String calTableType(const casacore::String &tablename)
Global methods.
casacore::Array< casacore::Complex > & diffJElem()
Access to differentiated Joness.
casacore::Double minTimePerSolution_p
virtual casacore::Bool useGenericSolveOne()
Use generic solution engine for a single solve (usually inside the generic gathering mechanism) ...
CalVisBuffer extends VisBuffer to support storage and recall of associated residual and differentiate...
Definition: CalVisBuffer.h:65
virtual casacore::String typeName()
Return type name as string.
Definition: VisCal.h:101
virtual void differentiate(SolveDataBuffer &)
virtual void reReference()
Apply refant.
casacore::String apmode_
Solving mode.
casacore::PtrBlock< casacore::Cube< casacore::Float > * > solveRPar_
casacore::PtrBlock< casacore::Cube< casacore::Bool > * > solveParOK_
virtual void setAccumulate(VisSet &vs, const casacore::String &table, const casacore::String &select, const casacore::Double &t, const casacore::Int &refAnt=-1)
Arrange for accumulation.
virtual void syncDiffJones()
Synchronize the Jones AND diffJones matrices.
virtual void state()
Report state:
virtual void differentiate(CalVisBuffer &)
Differentiate VB model w.r.t.
casacore::String fsolint_
User-specified freq-dep solint info.
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::String calTableSelect_
void fluxscale(const casacore::String &outfile, const casacore::Vector< casacore::Int > &refFieldIn, const casacore::Vector< casacore::Int > &tranFieldIn, const casacore::Vector< casacore::Int > &inRefSpwMap, const casacore::Vector< casacore::String > &fldNames, const casacore::Float &inGainThres, const casacore::String &antSel, const casacore::String &timerangeSel, const casacore::String &scanSel, SolvableVisCal::fluxScaleStruct &oFluxScaleStruct, const casacore::String &oListFile, const casacore::Bool &incremental=false, const casacore::Int &fitorder=1, const casacore::Bool &display=false)
Fluxscale is implemented here.
casacore::String & refantmode()
virtual casacore::Bool phandonly()
Should only parallel-hands be used in solving? (generally no (default=false), but GJones and related ...
virtual void nearest(const casacore::Double, casacore::Array< casacore::Float > &)
casacore::Matrix< casacore::Double > fd
casacore::Float userPrintActivityInterval_p
void deleteSVC()
Delete pointers.
int writeHeader(const casacore::uInt numAntCols, const casacore::uInt numAnts, const casacore::uInt iElem)
Write header for listCal output.
casacore::Vector< casacore::Double > fitfderr
virtual void smooth(casacore::Vector< casacore::Int > &fields, const casacore::String &smtype, const casacore::Double &smtime)
void setUpForPolSolve(VisBuffer &vb)
Set up data and model for pol solve.
void invalidateDJ()
Validation of Jones matrix derivatives.
ostream-like interface to creating log messages.
Definition: LogIO.h:167
virtual void loadMemCalTable(casacore::String ctname, casacore::String field="")
casacore::String calTableName_
Cal table name.
casacore::Bool isSimulated()
Is this calibration simulated?
virtual void differentiate(SolveDataBuffer &)
casacore::PtrBlock< casacore::Cube< casacore::Float > * > solveAllParErr_
virtual void selfSolveOne(SDBList &)
casacore::Double avgTimePerSolution_p
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
Mueller & dM()
Access to matrix rendering of dM (per par)
casacore::PtrBlock< casacore::Vector< casacore::Bool > * > * chanmask_
A pointer to the external channel mask.
virtual void solveAllParSNR(casacore::Int spw, casacore::Cube< casacore::Float > &parsnrSpw)
casacore::Vector< casacore::Int > spwMap_
Spw mapping.
virtual void setApply()
Set the application parameters.
virtual casacore::String solveinfo()
Report solve info/params, e.g., for logging.
casacore::Double maxTimePerSolution_p
casacore::Int & nAnt()
Definition: VisCal.h:237
VisVector & V()
Access to matrix renderings of Visibilities.
Definition: VisCal.h:270
casacore::String & calTableName()
Access to user-supplied parameters.
casacore::String & calTableSelect()
CTPatchedInterp * ci_
casacore::uInt wTime_p
Column widths for listing.
virtual void solveAllParErr(casacore::Int spw, casacore::Cube< casacore::Float > &parerrSpw)
virtual void initSolvePar()
Initialize solve parameter shape Mueller version: (nPar(),1,1) (one chan, one baseline) ...
virtual void calcAllDiffMueller()
Calculate the ensemble of diff&#39;d Mueller Elements.
virtual void initSolvePar()
Initialize solve parameter shape Jones version: (nPar(),1,nAnt()) (one chan, all antennas) ...
virtual CTTIFactoryPtr cttifactoryptr()
Pointer to CTTimeInterp1 factory method (generic) SVC specializations may choose to specialize CTTime...
casacore::Array< casacore::Complex > diffJElem_
Differentiated Jones matrix elements.
ABSTRACT CLASSES Deliberately vague to be general enough to allow for many different types of data
Definition: PlotData.h:48
casacore::String & solmode()
casacore::String & solint()
virtual void nearest(const casacore::Double, casacore::Array< casacore::Complex > &)
casacore::Vector< casacore::Int > & spwMap()
casacore::Bool DMValid()
virtual void setFracChanAve()
Calculate chan averaging bounds.
virtual casacore::Int nTotalPar()=0
Total number of (complex) parameters per solve (specialize to jive with ant- or bln-basedness, etc.)
void applyChanMask(VisBuffer &vb)
virtual casacore::String applyinfo()
Report apply info/params, e.g.
virtual void enforceAPonData(VisBuffer &vb)
If apmode() is &quot;A&quot;, convert vb&#39;s visibilities to amp + 0i.
casacore::Bool donorm() const
casacore::Bool DJValid_
Validity of Jones matrix derivatives.
casacore::PtrBlock< casacore::Cube< casacore::Float > * > solveParErr_
virtual casacore::Cube< casacore::Complex > & solveAllCPar()
casacore::Int focusChan_
In-focus channel for single-chan solves on multi-chan data.
virtual casacore::Cube< casacore::Float > & solveAllParSNR()
SolveDataBuffer is a container for VisBuffer2 data and related residual and differentiation results r...
virtual void createMemCalTable()
New CalTable handling.
void invalidateDM()
Validation of diffMueller matrices.
casacore::String solint_
User-specified time-dep solint (string)
virtual void initSolvePar()=0
Initialize solve parameters (shape)
virtual void guessPar(SDBList &)
virtual void globalPostSolveTinker()
Post solve tinkering (generic version)
casacore::Int & focusChan()
Access to focus channel.
virtual VisCalEnum::VCParType setParType(VisCalEnum::VCParType type)
CLPatchPanel * cpp_
casacore::PtrBlock< casacore::Cube< casacore::Float > * > solveAllParSNR_
casacore::Double preavg_
Preavering interval.
virtual void createMemCalTable2()
Generate the in-memory caltable (empty) NB: no subtable revisions.
virtual void setMatByOk()
Set matrix elements according to their ok flags (e.g., makes a unit matrix if everything flagged...
casacore::PtrBlock< casacore::Cube< casacore::Complex > * > solveAllCPar_
void overrideObsScan(casacore::Int obs, casacore::Int scan)
Provide for override of currScan and currObs.
virtual void stateSVM(const casacore::Bool &doVC)
SVM-specific state.
SolvableVisCal()
Default ctor is private.
struct casa::SolvableVisCal::fluxScaleStruct fluxScaleStruct
casacore::Bool & append()
void setupPlotter()
plotting historgram
casacore::Double fitWt_
casacore::Vector< casacore::Double > fitfd
virtual casacore::Int nPar()=0
Number of pars per ant/bln (Must be implemented in specializations!)
casacore::Double dataInterval_
Solving meta-data.
void createDiffMueller()
Create matrix renderers for dMs.
virtual casacore::Float calcPowerNorm(casacore::Array< casacore::Float > &amp, const casacore::Array< casacore::Bool > &ok)
atomic power normalization calculation Mueller version assumes amp in power units ...
double Double
Definition: aipstype.h:55
casacore::String & fsolint()
virtual void solveAllParOK(casacore::Int spw, casacore::Cube< casacore::Bool > &parokSpw)
virtual void applyRefAnt()
Apply reference antenna (generic Jones version)
virtual ~SolvableVisCal()
virtual casacore::Record actionRec()
Retrieve the cal flag info as a record.
virtual casacore::String siminfo()
Simulation info/params, suitable for logging.
static CTTimeInterp1 * factory(NewCalTable &ct, const casacore::String &timetype, casacore::Array< casacore::Float > &result, casacore::Array< casacore::Bool > &rflag)
static factory method to make CTTimeInterp1
Definition: CTTimeInterp1.h:73
casacore::Vector< casacore::Int > & refantlist()
virtual casacore::Int sizeUpSolve(VisSet &vs, casacore::Vector< casacore::Int > &nChunkPerSol)
Size up the solving arrays, etc.
casacore::String & simint()
access to simulation variables that are general to all VisCals
virtual casacore::Cube< casacore::Float > & solveParSNR()
void syncSolveCal()
Synchronize calibration for solve context.
virtual void currMetaNote()
virtual void setSimulate(VisSet &vs, casacore::Record &simpar, casacore::Vector< casacore::Double > &solTimes)
Set the simulation parameters
virtual void syncDiffMueller()
Synchronize the Muellers AND diffMuellers.
casacore::uInt wPreAnt_p
LatticeExprNode amp(const LatticeExprNode &left, const LatticeExprNode &right)
This function finds sqrt(left^2+right^2).
virtual casacore::Complex defaultPar()
Default value for parameters.
casacore::uInt wAntCol_p
casacore::Float & minSNR()
casacore::Int & nBln()
Definition: VisCal.h:238
virtual void keep1(casacore::Int ichan)
casacore::Bool DMValid_
diffMueller validation
casacore::Bool append_
virtual void stateSVC(const casacore::Bool &doVC)
Report the SVC-specific state, w/ option for VC::state()
casacore::PtrBlock< casacore::Cube< casacore::Float > * > solveAllRPar_
virtual void initTrivDJ()
Initialize trivial diff&#39;d Jones.
virtual casacore::Bool normalizable()
Does normalization by MODEL_DATA commute with this VisCal?
virtual casacore::Vector< casacore::Bool > spwOK()
Report calibration availability per spw (always true for non-tabular?)
Definition: VisCal.h:116
virtual void markTimer()
virtual casacore::Float calcPowerNorm(casacore::Array< casacore::Float > &amp, const casacore::Array< casacore::Bool > &ok)
atomic power normalization calculation SVJ version assumes amp in voltage units
casacore::uInt caiRC_p
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
casacore::Array< casacore::Complex > & diffMElem()
Access to differentiated Mueller elements.
casacore::Matrix< casacore::Int > chanAveBounds()
virtual void keepNCT()
SVJ-specific write to caltable.
const casacore::Vector< casacore::Double > & fintervalChV()
TableExprNode upcase(const TableExprNode &node)
Definition: ExprNode.h:1425
virtual Jones::JonesType jonesType()=0
What kind of Jones matrix are we? (Must be implemented in specializations!)
virtual void state()
Report state:
casacore::PtrBlock< casacore::Cube< casacore::Complex > * > solveCPar_
Current parameters.
virtual void accumulate(SolvableVisCal *, const casacore::Vector< casacore::Int > &)
Accumulate another VisCal onto this one.
casacore::Double fit_
casacore::Vector< casacore::Double > freq
void setMatByOk()
Override VM::setMatByOk in solve context.
casacore::Int minblperant_
Min baselines per ant for solve.
virtual void fluxscale(const casacore::String &, const casacore::Vector< casacore::Int > &, const casacore::Vector< casacore::Int > &, const casacore::Vector< casacore::Int > &, const casacore::Vector< casacore::String > &, const casacore::Float &, const casacore::String &, const casacore::String &, const casacore::String &, SolvableVisCal::fluxScaleStruct &, const casacore::String &, const casacore::Bool &, const casacore::Int &, const casacore::Bool &)
Scale solutions.
casacore::String normtypeString() const
virtual void diffSrc(VisBuffer &vb, casacore::Array< casacore::Complex > &dV)=0
Differentiate VB model w.r.t.
SolNorm solnorm_
Do solution normalization after a solve.
measure the time it takes to execute parts of a program
Definition: Timer.h:127
virtual void guessPar(VisBuffer &)
Hazard a guess at the parameters (solvePar) given the data.
casacore::Int & currSpw()
Current in-focus spw.
Definition: VisCal.h:247
float Float
Definition: aipstype.h:54
static casacore::String normTypeAsString(Type type)
virtual casacore::Bool trivialDJ()
Are differentiated J matrices constant in chan &amp; ant?
virtual casacore::Float defaultRPar()
virtual void calcPar()
Calculate parameters by some means (e.g., interpolation from a CalSet)
void mark()
Set the timer mark – i.e., start the clock ticking.
virtual void calcOneDiffMueller(casacore::Matrix< casacore::Complex > &mat, const casacore::Vector< casacore::Complex > &par)
Calculate one diffMElem.
A class to group separately averaged VisBuffers.
virtual void calcOneDiffJones(casacore::Matrix< casacore::Complex > &mat, const casacore::Vector< casacore::Complex > &par)
Calculate one ant/chan&#39;s diffJElem w.r.t.
A drop-in replacement for Block&lt;T*&gt;.
Definition: WProjectFT.h:54
virtual void invalidateDiffCalMat()
Invalidate diff cal matrices generically (at this level, M, dM, J, dJ)
casacore::LogIO & logSink()
Logger.
virtual void printActivity(const casacore::Int nSlots, const casacore::Int slotNo, const casacore::Int fieldId, const casacore::Int spw, const casacore::Int nSolutions)
Log periodic solver activity.
casacore::Vector< casacore::Complex > srcPolPar_
casacore::Double fintervalHz_
Derived frequency intervals.
casacore::Bool donorm_
data
virtual casacore::Bool accumulatable()
Is this type capable of accumulation? (nominally no)
A Table intended to hold astronomical data (a set of Measurements).
virtual void invalidateDiffCalMat()
Invalidate diff cal matrices generically (at this level, just M, dM)
static Type normTypeFromString(casacore::String name)
virtual void stateSVJ(const casacore::Bool &doVC)
virtual void syncPar()
Sync parameters for current meta data.
casacore::Vector< casacore::Double > fintervalCh_
virtual void setMeta(int obs, int scan, double time, int spw, const casacore::Vector< double > &freq, int fld)
VI2-related refactor-----------------------------------—.
virtual casacore::Bool verifyForSolve(VisBuffer &vb)
PlotServerProxy * plotter_
for plotting
casacore::Matrix< casacore::Double > spidxerr
virtual casacore::Bool trivialDM()
Are differentiated M matrices constant in chan &amp; bln?
casacore::LogIO logsink_p
LogIO.
virtual casacore::Cube< casacore::Float > & solveAllParErr()
virtual void setSolveChannelization(VisSet &vs)
Set matrix channelization according to a VisSet.
virtual casacore::Bool divideByStokesIModelForSolve()
Should data and model be divided by Stokes I model before average+solve? (Nominally false...
virtual casacore::Cube< casacore::Bool > & solveParOK()
virtual casacore::Bool isSolvable()
Is this solveable? (via this interface, nominally yes)
virtual casacore::Bool calAvailable(vi::VisBuffer2 &)
Calibration available?
casacore::uInt cafRC_p
void verifyCalTable(const casacore::String &caltablename)
Check if a cal table is appropriate.
casacore::String solmode_
Solver iteration mode.
casacore::Bool onthefly_
VisBuffer2s encapsulate one chunk of visibility data for processing.
Definition: VisBuffer2.h:141
Base class for all Casacore library errors.
Definition: Error.h:134
virtual void formSolveSNR()
Form solution SNR.
virtual void globalPostSolveTinker()
Post solve tinkering (Jones version: includes refant application)
const MSMetaInfoForCal & msmc() const
Access to the MSMetaInfoForCal (throws if none)
Definition: VisCal.h:338
casacore::Vector< casacore::Matrix< casacore::Int > > chanAveBounds_
Channel averaging bounds.
virtual casacore::Int solvePol()
Solve for point-source X or Q,U? nominally no (0)
VisJones
Definition: VisCal.h:557
casacore::Bool combobs()
casacore::Bool simulated_
Simulation flag.
casacore::Matrix< casacore::Double > fderr
virtual casacore::Bool useGenericGatherForSolve()
Report if calibration available for specified spw (if no CalInterp available, assume true) ...
virtual void setUpForPolSolve(vi::VisBuffer2 &)
A VB2-specific version which depends on local specialization (this may be further refined later) ...
casacore::Matrix< casacore::Double > spidx
void setSimulated(const casacore::Bool &flag)
Set state flag to simulate cal terms.
virtual void initTrivDM()
Initialize trivial diff&#39;d Muellers.
virtual void applySNRThreshold()
Apply SNR threshold.
virtual void setModel(const casacore::String &)
casacore::String usolint_
User-specified full solint string.
void invalidateJ()
Validation of Jones matrices.
Definition: VisCal.h:622
SolvableVisJones
virtual void syncDiffMat()=0
Synchronize the differentiated calibration.
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;...
virtual void storeNCT()
String: the storage and methods of handling collections of characters.
Definition: String.h:223
SolvableVisMueller()
Default ctor is private.
virtual casacore::Int nTotalPar()
Total number of (complex) parameters per solve Jones version: nPar()*nAnt()
void plotHistogram(const casacore::String &title, const casacore::Int index, const casacore::Vector< casacore::Double > &data, const casacore::Int nbin)
virtual casacore::Int nCalMat()
Number of Cal Matrices to form on baseline axis (Jones, all contexts: nAnt())
casacore::Bool byCallib_
Signal apply by callib.
casacore::Vector< casacore::Int > urefantlist_
Refant.
virtual void listCal(const casacore::Vector< casacore::Int >, const casacore::Vector< casacore::Int >, const casacore::Matrix< casacore::Int >, const casacore::String &, const casacore::Int &)
casacore::List calibration solutions in tabular form.
VisBuffers encapsulate one chunk of visibility data for processing.
Definition: VisBuffer.h:153
casacore::Array< casacore::Complex > diffMElem_
Differentiated Mueller matrix elements.
casacore::Int & refant()
VisibilityIterator iterates through one or more writable MeasurementSets.
casacore::Float userPrintActivityFraction_p
virtual Type type()=0
Return the type of this calibration matrix (actual type of derived class).
void invalidateM()
Validation of Mueller matrices (for currSpw)
Definition: VisCal.h:484
casacore::String & combine()
virtual void reReference()
Apply refant (no-op for Muellers)
casacore::Double & fintervalCh()
for simulating corruptions
Definition: CalCorruptor.h:85
virtual casacore::Cube< casacore::Float > & solveParErr()
virtual void calcParByCLPP()
void setSolved(const casacore::Bool &flag)
Set to-be-solved-for flag.
virtual void accumulate(SolvableVisCal *incr, const casacore::Vector< casacore::Int > &fields)=0
Accumulate another VisCal onto this one.
double solTimeInterval_
Derived time-dep solution interval (s) (VI2)
casacore::String refantmode_
Refant mode.
casacore::Timer timer_p
virtual void setCallib(const casacore::Record &callib, const casacore::MeasurementSet &selms)
casacore::Complex normSolnArray(casacore::Array< casacore::Complex > &sol, const casacore::Array< casacore::Bool > &solOK, const casacore::Bool doPhase=false)
Normalize a (complex) solution array (generic)
virtual casacore::Cube< casacore::Float > & solveAllRPar()
virtual void setSolve()
Set the solving parameters.
casacore::Bool solved_
Solved-for flag.
casacore::Double & preavg()
casacore::Bool combscan()
virtual void diffSrc(VisBuffer &vb, casacore::Array< casacore::Complex > &dV)
Differentiate VB model w.r.t.
virtual void differentiate(VisBuffer &, casacore::Cube< casacore::Complex > &, casacore::Array< casacore::Complex > &, casacore::Matrix< casacore::Bool > &)
casacore::Bool solnorm()
void reParseSolintForVI2()
Parse solint in VI2 context.
void syncSolvePar()
Synchronize parameters for solve context.
virtual casacore::Int nCalMat()
Number of Cal Matrices to form on baseline axis (Mueller, solve context: 1)
virtual void keepNCT()
virtual void accumulate(SolvableVisCal *incr, const casacore::Vector< casacore::Int > &fields)
Accumulate another VisCal onto this one.
void inflate(VisSet &vs, const casacore::Bool &fillMeta=false)
These inflate methods soon to deprecate (gmoellen, 20121212) Inflate the pristine CalSet (from VisSet...
casacore::Int sizeUpSim(VisSet &vs, casacore::Vector< casacore::Int > &nChunkPerSol, casacore::Vector< casacore::Double > &solTimes)
calculate # required slots to simulate this SVC
casacore::PtrBlock< casacore::Cube< casacore::Bool > * > solveAllParOK_
casacore::String fInterpType_
virtual void syncDiffMat()
Synchronize the differentiated calibration (specialization for Mueller);.
casacore::Double & fintervalHz()
Freq-dep solint values (const?!)
casacore::String & fInterpType()
virtual void setOrVerifyCTFrequencies(int spw)
Set (or verify) freq info in output cal table for specified spw.
casacore::String tInterpType_
Interpolation types.
casacore::PtrBlock< casacore::Cube< casacore::Float > * > solveParSNR_
virtual void syncDiffMat()
Synchronize the differentiated calibration (specialization for Jones)
virtual void diffSrc(VisBuffer &, casacore::Array< casacore::Complex > &)
Differentiate VB model w.r.t.
virtual void setMatByOk()
Set matrix elements according to their ok flags (e.g., makes a unit matrix if everything flagged...
unsigned int uInt
Definition: aipstype.h:51
virtual void state()
Report state:
void inflateNCTwithMetaData(VisSet &vs)
Inflate an NCT w/ meta-data according to a VisSet (for accum)
virtual void listCal(const casacore::Vector< casacore::Int > ufldids, const casacore::Vector< casacore::Int > uantids, const casacore::Matrix< casacore::Int > uchanids, const casacore::String &listfile="", const casacore::Int &pagerows=50)
Write calibration solutions to the terminal.
casacore::Bool isSolved()
Is this ready to solve?
virtual casacore::Bool normalizable()=0
Does normalization by MODEL_DATA commute with this VisCal? (if so, permits pre-solve time-averaging) ...
virtual void calcAllDiffJones()
Calculate the ensemble of diff&#39;d Jones Elements.
casacore::Bool & simOnTheFly()
RI todo implement calcOneJones like calcAllMueller calculate terms during apply, or up front during s...
virtual casacore::Bool verifyConstraints(VisBuffGroupAcc &vbag)
Verify VisBuffer data sufficient for solving (wts, etc.)
virtual void differentiate(CalVisBuffer &cvb)=0
Differentiate VB model w.r.t.
virtual void listCal(const casacore::Vector< casacore::Int > ufldids, const casacore::Vector< casacore::Int > uantids, const casacore::Matrix< casacore::Int > uchanids, const casacore::String &listfile="", const casacore::Int &pagerows=50)=0
casacore::Bool syncSolveMeta(VisBuffer &vb, const casacore::Int &fieldId)
Synchronize the meta data with a solvable VisBuffer (returns false if VisBuffer has no valid data) ...
casacore::Int & minblperant()
virtual void reReference()=0
Apply refant (implemented in SVJ)