VisCal.h

Classes

VisCal -- (full description)
SolvableVisCal -- (full description)
VisMueller -- (full description)
SolvableVisMueller -- (full description)
VisJones2 -- (full description)
SolvableVisJones2 -- (full description)
MMueller -- (full description)
MfMueller -- (full description)
KMueller -- (full description)
UVpMod -- (full description)
newTJones -- (full description)

class VisCal

Types

enum Type

UVMOD
Mf
M
K
B
G
D
C
E
P
T
EP
F

Interface

Public Members
VisCal()
VisCal(VisSet& vs)
virtual ~VisCal()
virtual Type type() = 0
inline virtual String typeName()
inline virtual Bool freqDepPar()
inline virtual Bool freqDepMat()
inline virtual Bool& timeDepMat()
virtual void setApply(const Record& apply)
inline void setApplied(const Bool& flag)
inline Bool isApplied()
inline virtual Bool isSolvable()
inline virtual Double& interval()
virtual VisBuffer& apply(VisBuffer& vb) = 0
virtual VisBuffer& applyInv(VisBuffer& vb) = 0
Protected Members
inline Int& nSpw()
inline Int& nPar()
inline Int& nAnt()
inline Int& nBln()
virtual Int& nElem()
inline Int& currSpw()
inline Vector<Int>& nChanDat()
inline Vector<Int>& nChanPar()
inline Vector<Int>& nChanMat()
inline Vector<Int>& startChan()
inline VisSet& vs()

Description

********************************************************** VisCal

Member Description

enum Type

Allowed types of VisCal matrices

VisCal()

VisCal(VisSet& vs)

virtual ~VisCal()

virtual Type type() = 0

Return the type of this calibration matrix (actual type of derived class).

inline virtual String typeName()

Return type name as string

inline virtual Bool freqDepPar()

Frequency-dependent Parameters? Nominally not.

inline virtual Bool freqDepMat()

Frequency-dependent Matrices? Nominally same as freqDepPar.

inline virtual Bool& timeDepMat()

Time-dependent Matrices (for a given set of parameters)

virtual void setApply(const Record& apply)

Set the application parameters

inline void setApplied(const Bool& flag)

Is this calibration matrix to be applied?

inline Bool isApplied()

inline virtual Bool isSolvable()

Is this solveable? (never via this interface)

inline virtual Double& interval()

Return the time interval over which this calibration is constant

virtual VisBuffer& apply(VisBuffer& vb) = 0

Apply Mueller matrix to data (implemented in VisMueller)

virtual VisBuffer& applyInv(VisBuffer& vb) = 0

inline Int& nSpw()

Info

inline Int& nPar()

inline Int& nAnt()

inline Int& nBln()

virtual Int& nElem()

inline Int& currSpw()

Current indices

inline Vector<Int>& nChanDat()

inline Vector<Int>& nChanPar()

inline Vector<Int>& nChanMat()

inline Vector<Int>& startChan()

inline VisSet& vs()

Access to VisSet


class SolvableVisCal : virtual public VisCal

Interface

Public Members
SolvableVisCal(VisSet& vs)
inline virtual Bool freqDepDat()
virtual void setApply(const Record& apply)
virtual void setSolve(const Record& solve)
virtual Bool solve (VisEquation& ve) = 0
inline Bool isSolvable()
inline void setSolved(const Bool& flag)
inline Bool isSolved()
inline void setMode(const String m)
inline const String mode()
inline Double& preavg()
Protected Members
inline String& calTableName()
inline String& calTableSelect()
inline String& tInterpType()
inline String& fInterpType()
inline Vector<Int>& spwMap()
inline Int& refant()

Description

********************************************************** SolvableVisCal

Member Description

SolvableVisCal(VisSet& vs)

inline virtual Bool freqDepDat()

Frequency-dependent Data required for solve? Nominally same as freqDepMat.

virtual void setApply(const Record& apply)

Set the application parameters (apply from table)

virtual void setSolve(const Record& solve)

Set the solver parameters

virtual Bool solve (VisEquation& ve) = 0

Solve (pure virtual here)

inline Bool isSolvable()

Is this solveable? (always, via this interface)

inline void setSolved(const Bool& flag)

Is this to be solved for?

inline Bool isSolved()

inline void setMode(const String m)

Mode

inline const String mode()

inline Double& preavg()

inline String& calTableName()

Access to private data

inline String& calTableSelect()

inline String& tInterpType()

inline String& fInterpType()

inline Vector<Int>& spwMap()

inline Int& refant()


class VisMueller : virtual public VisCal

Interface

Public Members
VisMueller(VisSet& vs)
virtual ~VisMueller()
virtual VisBuffer& apply(VisBuffer& vb)
virtual VisBuffer& applyInv(VisBuffer& vb)
virtual VisBuffer& applyCal(VisBuffer& vb, const Bool& doInv)
virtual void syncGain(const VisBuffer& vb, const Bool& doInv=False)
virtual void syncGain(const Int& spw, const Double& time, const Int& field=-1, const Bool& doInv=False)
virtual void syncPar(const Int& spw, const Double& time, const Int& field=-1)
virtual void syncMueller(const Int& spw, const Double& time, const Int& field=-1, const Bool& doInv=False)
inline virtual Cube<Complex>& thisPar(const Int& spw)
inline virtual Matrix<Bool>& thisParOK(const Int& spw)
inline Matrix<mMat>& thisMueller(const Int& spw)
inline Matrix<Bool>& thisMuellerOK(const Int& spw)
inline mMat& thisMueller(const Int& spw, const Int& chn, const Int& bln)
inline mMat& thisMueller(const Int& spw, const Int& chn, const Int& a1, const Int& a2)
inline Bool& thisMuellerOK(const Int& spw, const Int& chn, const Int& bln)
inline Bool& thisMuellerOK(const Int& spw, const Int& chn, const Int& a1, const Int& a2)
Protected Members
inline virtual CalSet<Complex>& cs()
inline virtual CalInterp& ci()
inline virtual Int& nElem()
inline Double& lastTime(const Int& spw)
inline Double& lastTime()
inline Double& currTime(const Int& spw)
inline Double& currTime()
inline Int& currField(const Int& spw)
inline Int& currField()
inline Vector<Double>& currFreq()
inline Double& refTime()
inline Double& refFreq()
inline Int blnidx(const Int& a1, const Int& a2)
inline void invalidateMM(const Int& spw)
inline void validateMM(const Int& spw)
inline Bool MMValid(const Int& spw)
virtual void calcPar(const Int& spw, const Double& time, const Int& field)
virtual void calcMueller(mMat& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )
virtual void calcMueller(mMat& mmat, jMat& jmat1, jMat& jmat2)
virtual void invMueller(const Int& spw)
virtual Bool polznSwitch(const VisBuffer& vb)
virtual void polznMap(CStokesVector& vis)
virtual void polznUnmap(CStokesVector& vis)
Private Members
void deleteMuellerCache()

Description

********************************************************** VisMueller

Member Description

VisMueller(VisSet& vs)

Constructor

virtual ~VisMueller()

virtual VisBuffer& apply(VisBuffer& vb)

Apply Mueller matrix

virtual VisBuffer& applyInv(VisBuffer& vb)

Apply inverse of Mueller matrix

virtual VisBuffer& applyCal(VisBuffer& vb, const Bool& doInv)

Apply to VB

virtual void syncGain(const VisBuffer& vb, const Bool& doInv=False)

Synchronize "gains" with VisBuffer

virtual void syncGain(const Int& spw, const Double& time, const Int& field=-1, const Bool& doInv=False)

Synchronize "gains" with data

virtual void syncPar(const Int& spw, const Double& time, const Int& field=-1)

Sync parameters for this spw by time/field, return reference to them

virtual void syncMueller(const Int& spw, const Double& time, const Int& field=-1, const Bool& doInv=False)

Sync Mueller matrices for this spw by time/field, return reference to them

inline virtual Cube<Complex>& thisPar(const Int& spw)

Access to solution parameters and matrices

inline virtual Matrix<Bool>& thisParOK(const Int& spw)

inline Matrix<mMat>& thisMueller(const Int& spw)

inline Matrix<Bool>& thisMuellerOK(const Int& spw)

inline mMat& thisMueller(const Int& spw, const Int& chn, const Int& bln)

Access to current Mueller by baseline index

inline mMat& thisMueller(const Int& spw, const Int& chn, const Int& a1, const Int& a2)

Access to current Mueller by antenna indices

inline Bool& thisMuellerOK(const Int& spw, const Int& chn, const Int& bln)

Access to current MuellerOK by baseline index

inline Bool& thisMuellerOK(const Int& spw, const Int& chn, const Int& a1, const Int& a2)

Access to current MuellerOK by antenna indices

inline virtual CalSet<Complex>& cs()

Access to CalSet and CalInterp

inline virtual CalInterp& ci()

inline virtual Int& nElem()

Number of elements is nominally number of baselines for native Muellers

inline Double& lastTime(const Int& spw)

Current coords

inline Double& lastTime()

inline Double& currTime(const Int& spw)

inline Double& currTime()

inline Int& currField(const Int& spw)

inline Int& currField()

inline Vector<Double>& currFreq()

inline Double& refTime()

inline Double& refFreq()

inline Int blnidx(const Int& a1, const Int& a2)

Baseline index from antenna indices: (assumes a1<=a2 !!)

inline void invalidateMM(const Int& spw)

Validation of Mueller matrices

inline void validateMM(const Int& spw)

inline Bool MMValid(const Int& spw)

virtual void calcPar(const Int& spw, const Double& time, const Int& field)

Calculate a single Mueller parameters

virtual void calcMueller(mMat& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )

Calculate a single Mueller matrix by some means

virtual void calcMueller(mMat& mmat, jMat& jmat1, jMat& jmat2)

Calculate a single Mueller matrix from Jones matrix

virtual void invMueller(const Int& spw)

Invert Mueller matrices

virtual Bool polznSwitch(const VisBuffer& vb)

Return true if polarization re-sequencing required

virtual void polznMap(CStokesVector& vis)

Re-sequence to (XX,XY,YX,YY) or (RR,RL,LR,LL)

virtual void polznUnmap(CStokesVector& vis)

Re-sequence to (XX,YY,XY,YX) or (RR,LL,RL,LR)

void deleteMuellerCache()

Delete the this* caches

class SolvableVisMueller : public SolvableVisCal, virtual public VisMueller

Interface

Public Members
SolvableVisMueller(VisSet& vs)
virtual ~SolvableVisMueller()
virtual void setApply(const Record& apply)
virtual void setSolve(const Record& solve)
virtual Bool solve (VisEquation& ve)
virtual Bool solvevb(const Int& slot)=0
Protected Members
inline virtual CalSet<Complex>& cs()
inline virtual CalInterp& ci()
inline virtual VisBuffer& svb()
inline Matrix<CStokesVector>& R()
inline Cube<CStokesVector>& dR()
inline Vector<Double>& chiSq()
inline Vector<Double>& lastChiSq()
inline Vector<Double>& sumWt()
inline virtual Int& nHess()
inline Matrix<Complex>& grad()
inline Cube<Complex>& hess()
inline Matrix<Complex>& dg()
virtual void residual()
void calcGradHess()
void solveGradHess()
virtual void updgain()
Bool converged(const Int& iter)
Bool& almostconverged()
Float& tolerance()
Cube<mMat>& diffMueller()
virtual void syncDiffMueller(const Int& row)
virtual void calcDiffMueller(Vector<mMat>& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )
void initSolve()
void chiSquare()
inline void invalidateDM()
inline void validateDM()
inline Bool DMValid()

Description

********************************************************** SolvableVisMueller

Member Description

SolvableVisMueller(VisSet& vs)

virtual ~SolvableVisMueller()

virtual void setApply(const Record& apply)

Set the application parameters (apply from table)

virtual void setSolve(const Record& solve)

Set the solver parameters and create empty CalSet

virtual Bool solve (VisEquation& ve)

Solve (loops over solution intervals, calls type-specific per-vb solve mechanism)

virtual Bool solvevb(const Int& slot)=0

Type-specific per-vb solve mechanism (pure virtual here) (shouldn't need slot, eventually)

inline virtual CalSet<Complex>& cs()

inline virtual CalInterp& ci()

inline virtual VisBuffer& svb()

inline Matrix<CStokesVector>& R()

Accessors to (differentiated) Residuals

inline Cube<CStokesVector>& dR()

inline Vector<Double>& chiSq()

Access to chi2

inline Vector<Double>& lastChiSq()

inline Vector<Double>& sumWt()

inline virtual Int& nHess()

Access to grad,hess,dg

inline Matrix<Complex>& grad()

inline Cube<Complex>& hess()

inline Matrix& hess() { return hess_; };

inline Matrix<Complex>& dg()

virtual void residual()

Calculate residuals

void calcGradHess()

Solving methods

void solveGradHess()

virtual void updgain()

Bool converged(const Int& iter)

Bool& almostconverged()

Float& tolerance()

Cube<mMat>& diffMueller()

Access to differentiated Muellers

virtual void syncDiffMueller(const Int& row)

Synchronize the Muellers AND diffMuellers

virtual void calcDiffMueller(Vector<mMat>& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )

Calculate a diffMueller

void initSolve()

Initialize chi2, grad, hess

void chiSquare()

Calculate chi2

inline void invalidateDM()

Validation of diffMueller matrices

inline void validateDM()

inline Bool DMValid()


class VisJones2 : virtual public VisMueller

Interface

Public Members
VisJones2(VisSet& vs)
virtual ~VisJones2()
virtual void syncMueller(const Int& spw, const Double& time, const Int& field=-1, const Bool& doInv=False)
virtual void syncJones(const Int& spw, const Double& time, const Int& field=-1, const Bool& doInv=False)
inline virtual Int& nElem()
inline virtual Cube<Complex>& thisPar(const Int& spw)
inline virtual Matrix<Bool>& thisParOK(const Int& spw)
inline Matrix<jMat>& thisJones(const Int& spw)
inline Matrix<jMat>& thisJonesConj(const Int& spw)
inline Matrix<Bool>& thisJonesOK(const Int& spw)
inline jMat& thisJones(const Int& spw, const Int& chn, const Int& ant)
inline jMat& thisJonesConj(const Int& spw, const Int& chn, const Int& ant)
inline Bool& thisJonesOK(const Int& spw, const Int& chn, const Int& ant)
Protected Members
inline void invalidateJM(const Int& spw)
inline void validateJM(const Int& spw)
inline Bool JMValid(const Int& spw)
virtual void calcPar(const Int& spw, const Double& time, const Int& field)
virtual void calcJones(jMat& mat, Vector<Complex>& par )
virtual void invJones(const Int& spw)
virtual void conjJones(const Int& spw)
virtual void calcMueller(mMat& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )
virtual void calcMueller(mMat& mmat, jMat& jmat1, jMat& jmat2)
Private Members
void deleteJonesCache()

Description

********************************************************** VisJones2

Member Description

VisJones2(VisSet& vs)

Constructor

virtual ~VisJones2()

virtual void syncMueller(const Int& spw, const Double& time, const Int& field=-1, const Bool& doInv=False)

Synchronize current Mueller matrices via Jones matrices

virtual void syncJones(const Int& spw, const Double& time, const Int& field=-1, const Bool& doInv=False)

Synchronize current Jones matrices

inline virtual Int& nElem()

Number of elements is number of antennas

inline virtual Cube<Complex>& thisPar(const Int& spw)

Access to solution parameters and matrices

inline virtual Matrix<Bool>& thisParOK(const Int& spw)

inline Matrix<jMat>& thisJones(const Int& spw)

inline Matrix<jMat>& thisJonesConj(const Int& spw)

inline Matrix<Bool>& thisJonesOK(const Int& spw)

inline jMat& thisJones(const Int& spw, const Int& chn, const Int& ant)

Access to current Jones by antenna index

inline jMat& thisJonesConj(const Int& spw, const Int& chn, const Int& ant)

Access to current Jones by antenna index

inline Bool& thisJonesOK(const Int& spw, const Int& chn, const Int& ant)

Access to current JonesOK by antenna index

inline void invalidateJM(const Int& spw)

Validation of Jones matrices

inline void validateJM(const Int& spw)

inline Bool JMValid(const Int& spw)

virtual void calcPar(const Int& spw, const Double& time, const Int& field)

Calculate a single Jones parameters

virtual void calcJones(jMat& mat, Vector<Complex>& par )

Calculate a single Jones matrix by some means from parameters

virtual void invJones(const Int& spw)

Invert Jones matrices

virtual void conjJones(const Int& spw)

Form conjugated Jones matrices

virtual void calcMueller(mMat& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )

Calculate a single Mueller matrix by some means

virtual void calcMueller(mMat& mmat, jMat& jmat1, jMat& jmat2)

Calculate a single Mueller matrix from Jones matrix

void deleteJonesCache()

Delete the this* caches

class SolvableVisJones2 : public SolvableVisMueller, public VisJones2

Interface

Public Members
SolvableVisJones2(VisSet& vs)
virtual ~SolvableVisJones2()
virtual Bool solve (VisEquation& ve)=0
virtual void differentiate(VisBuffer& vb)
virtual jMat& dJ(const Int& par, const Int& chan, const Int& ant)
virtual void addGain(const Cube<Complex> gaininc)
Protected Members
inline void invalidateDJ(const Int& spw)
inline void validateDJ(const Int& spw)
inline Bool DJValid(const Int& spw)

Description

********************************************************** SolvableVisJones2

Member Description

SolvableVisJones2(VisSet& vs)

virtual ~SolvableVisJones2()

virtual Bool solve (VisEquation& ve)=0

Solve (nominal antenna-based implementation here)

virtual void differentiate(VisBuffer& vb)

Synchronize derivatives w.r.t. parameters (here, no-op in generic version)

virtual jMat& dJ(const Int& par, const Int& chan, const Int& ant)

Return reference to per-ant, per-chan derivatives w.r.t. parameters (here, in generic version, just return array/chan-constant matrix)

virtual void addGain(const Cube<Complex> gaininc)

Calculate the residual visibilities w.r.t. the current calibration params virtual void residual(VisBuffer& vb, Matrix& R) ;

Form derivatives of the residuals w.r.t. the parameters virtual void applyDerivative(VisBuffer& vb, PtrBlock*>& dR) ;

inline void invalidateDJ(const Int& spw)

Validation of Jones matrix derivatives

inline void validateDJ(const Int& spw)

inline Bool DJValid(const Int& spw)


class MMueller : public SolvableVisMueller

Interface

Public Members
MMueller(VisSet& vs)
virtual void setSolve(const Record& solve)
inline virtual Type type()
inline virtual String typeName()
virtual Bool solvevb(const Int& slot)

Description

********************************************************** MMueller

Member Description

MMueller(VisSet& vs)

virtual void setSolve(const Record& solve)

Set the solver parameters (enforce full preavg)

inline virtual Type type()

inline virtual String typeName()

Return type name as string

virtual Bool solvevb(const Int& slot)

MMueller-specific per-vb solve mechanism (copy data to soln)

class MfMueller : public MMueller

Interface

MfMueller(VisSet& vs)
virtual Bool freqDepPar()
virtual Type type()
inline virtual String typeName()

Description

********************************************************** MfMueller

Member Description

MfMueller(VisSet& vs)

virtual Bool freqDepPar()

virtual Type type()

inline virtual String typeName()

Return type name as string

class KMueller : public SolvableVisMueller

Interface

KMueller(VisSet& vs)
virtual void setSolve(const Record& solve)
inline virtual Type type()
inline virtual String typeName()
inline virtual Bool freqDepMat()
virtual Bool solvevb(const Int& slot)
Protected Members
virtual void calcMueller(mMat& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )
virtual void calcDiffMueller(Vector<mMat>& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )
virtual void updgain()

Description

********************************************************** KMueller

Member Description

KMueller(VisSet& vs)

virtual void setSolve(const Record& solve)

Set the solver parameters (enforce no preavg)

inline virtual Type type()

inline virtual String typeName()

Return type name as string

inline virtual Bool freqDepMat()

Frequency-dependent Matrices (parameters are NOT)

virtual Bool solvevb(const Int& slot)

KMueller-specific per-vb solve mechanism

virtual void calcMueller(mMat& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )

virtual void calcDiffMueller(Vector<mMat>& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )

virtual void updgain()


class UVpMod : public SolvableVisMueller

Interface

Public Members
UVpMod(VisSet& vs)
virtual void setSolve(const Record& solve)
inline virtual Type type()
inline virtual String typeName()
virtual Bool solvevb(const Int& slot)
Protected Members
inline virtual Int& nElem()
Matrix<Double>& thisUV()
virtual void syncDiffMueller(const Int& row)
virtual void syncUVW(const Int& row)
virtual void calcMueller(mMat& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )
virtual void calcDiffMueller(Vector<mMat>& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )

Description

********************************************************** UVpmod

Member Description

UVpMod(VisSet& vs)

virtual void setSolve(const Record& solve)

Set the solver parameters (enforce no preavg)

inline virtual Type type()

inline virtual String typeName()

Return type name as string

virtual Bool solvevb(const Int& slot)

MMueller-specific per-vb solve mechanism (copy data to soln)

inline virtual Int& nElem()

Matrix<Double>& thisUV()

virtual void syncDiffMueller(const Int& row)

Synchronize the Muellers AND diffMuellers

virtual void syncUVW(const Int& row)

Synchronize the UVW

virtual void calcMueller(mMat& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )

virtual void calcDiffMueller(Vector<mMat>& mat, Vector<Complex>& par, const Int& baseline=-1, const Int& channel=-1 )


class newTJones : public SolvableVisJones2

Interface

Public Members
newTJones(VisSet& vs)
inline virtual Type type()
inline virtual String typeName()

Description

********************************************************** TJones (new)

Member Description

newTJones(VisSet& vs)

inline virtual Type type()

inline virtual String typeName()

Return type name as string