29 #ifndef SYNTHESIS_VISCAL_H
30 #define SYNTHESIS_VISCAL_H
47 class MSMetaInfoForCal;
62 enum Type{
Test=0,
ANoise,
M,
KAntPos,
B,
K,
G,
J,
D,
X,
C,
P,
E,
T,
F,
A,
ALL};
69 case ANoise:
return "ANoise";
185 virtual void state();
202 virtual void setMeta(
int obs,
int scan,
double time,
217 bool sync=
false,
bool doInv=
false);
220 bool sync=
false,
bool doInv=
false);
453 virtual void state();
586 virtual void state();
virtual VisCalEnum::MatrixType matrixType()
Return casacore::Matrix type.
void invalidateP()
Validation of calibration parameters.
void setApplied(const casacore::Bool &flag)
Set applied state flag.
virtual casacore::Bool freqDepCalWt()
Freq-dep Weight scaling? // almost always false.
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.
casacore::Int & prtlev()
Return print (cout) level.
casacore::Int & currScan()
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_
casacore::Vector< casacore::Int > currField_
long long Int64
Define the extra non-standard types used by Casacore (like proposed uSize, Size)
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.
casacore::Vector< casacore::Bool > PValid_
Paremeter validity.
casacore::Int blnidx(const casacore::Int &a1, const casacore::Int &a2)
Baseline index from antenna indices: (assumes a1<=a2 !!)
casacore::Int & nSpw()
General Shape Info.
casacore::Vector< casacore::Int > & nChanParList()
Additive noise In practice, this is not really solvable, but it is a SVM because we need access to ge...
casacore::PtrBlock< Jones * > J2_
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.
virtual casacore::Bool freqDepPar()
Frequency-dependent Parameters? Nominally not.
virtual void syncJones(const casacore::Bool &doInv=false)
Synchronize current Jones matrices.
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.
casacore::String & msName()
virtual VisCalEnum::VCParType parType()
Return the parameter type (nominally complex)
virtual casacore::Int & nElem()
Total number of parameter sets required.
casacore::Int nSpw_
Number of Spectral windows.
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.
virtual casacore::Int & nElem()=0
The number of sets of parameters under consideration.
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)
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
casacore::Int64 nflagOut_
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
casacore::Bool applied_
Application flag.
casacore::Int & currIntent()
casacore::Vector< casacore::Int > currScan_
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.
casacore::Int64 ndataIn_
Flag counting.
casacore::Cube< casacore::Bool > & currJElemOK()
virtual void countInFlag(const VisBuffer &vb)
Flag counting.
casacore::Vector< casacore::Int > & nChanMatList()
virtual casacore::Bool applyByMueller()
Are we applying via Mueller or Jones multiplication? (probably by Jones for native Jones...
Jones & J1()
Access to matrix renderings of Jones matrices.
casacore::Double & refFreq()
casacore::Double & lastTime()
Current coords.
void initVisCal()
Initialize pointers, etc.
VisVector & V()
Access to matrix renderings of Visibilities.
virtual void syncCalMat(const casacore::Bool &doInv=false)
{ throw(casacore::AipsError("VisMueller::applyCal2 NYI!!!!!!!!!!!!!")); };
virtual casacore::Double & interval()
Return the time interval over which this calibration is constant.
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_
const casacore::Int & nChanPar() const
Number of par channels in current spw.
casacore::Int nAnt_
Number of antennas.
casacore::String & extraTag()
casacore::Int & startChan()
casacore::PtrBlock< casacore::Cube< casacore::Float > * > currRPar_
casacore::Int nBln_
Number of baselines.
casacore::Vector< casacore::Double > currTime_
Current indices.
casacore::Bool isApplied()
Is this calibration matrix to be applied?
virtual void countInFlag2(const vi::VisBuffer2 &vb)
virtual casacore::Bool spwOK(casacore::Int)
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<casacore::Complex> (generic)
virtual casacore::Bool applyByJones()
virtual void applyCal(VisBuffer &vb, casacore::Cube< casacore::Complex > &Vout, casacore::Bool trial=false)
Row-by-row apply to a casacore::Cube<casacore::Complex> (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()
casacore::Int & nChanPar()
Current spectral shapes.
virtual void invalidateCalMat()
Invalidate cal matrices generically (at this level, both Mueller and Jones)
virtual void state()
Report the state.
Type
Allowed types of VisCal matrices - 'correct' 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};.
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) ...
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.
casacore::PtrBlock< casacore::Cube< casacore::Complex > * > currMElem_
Current Mueller matrix elements.
casacore::Int focusChan_
In-focus channel for single-chan solves on multi-chan data.
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_
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()
casacore::Vector< casacore::Int > & startChanList()
casacore::Vector< casacore::Double > lastTime_
void setCalChannelization(const casacore::Int &nChanDat)
Set the calibration matrix channelization.
casacore::Cube< casacore::Bool > & currMElemOK()
virtual casacore::Vector< casacore::Bool > spwOK()
Report calibration availability per spw (always true for non-tabular?)
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)
virtual casacore::Bool calAvailable(vi::VisBuffer2 &)
Calibration available? (always true for non-tabular)
A hierarchical collection of named fields of various types.
bool Bool
Define the standard types used by Casacore.
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)
VisMueller()
Default ctor is private.
casacore::PtrBlock< casacore::Cube< casacore::Bool > * > currMElemOK_
casacore::PtrBlock< casacore::Cube< casacore::Complex > * > currCPar_
Current parameters.
casacore::Bool calWt_
Trigger calibration of weights.
virtual casacore::String applyinfo()
Apply info/params, suitable for logging.
casacore::Int & currSpw()
Current in-focus spw.
casacore::Vector< casacore::Double > currFreq_
casacore::PtrBlock< casacore::Cube< casacore::Bool > * > currParOK_
VisJones()
Default ctor is private.
casacore::Int & currObs()
A drop-in replacement for Block<T*>.
virtual casacore::Cube< casacore::Float > & currRPar()
A Table intended to hold astronomical data (a set of Measurements).
virtual casacore::Cube< casacore::Bool > & currParOK()
casacore::PtrBlock< casacore::Cube< casacore::Float > * > currWtScale_
Weight scale factors.
virtual void syncPar()
Sync parameters for current meta data.
virtual casacore::Bool trivialMuellerElem()
Jones matrices can never be trivial Muellers!
casacore::Int & nChanMat()
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.
casacore::Cube< casacore::Complex > & currJElem()
Access to Jones matrix element array.
virtual void setApply()
Set the application parameters.
virtual casacore::String longTypeName()
casacore::Vector< casacore::Double > & currFreq()
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.
casacore::Double refFreq_
VisBuffer2s encapsulate one chunk of visibility data for processing.
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.
virtual casacore::Int & nElem()
Number of parameter sets is number of antennas.
virtual casacore::Int nCalMat()
Number of Cal Matrices to form on baseline axis (Mueller, apply context: nBln())
casacore::Int prtlev_
Print level.
const MSMetaInfoForCal & msmc() const
Access to the MSMetaInfoForCal (throws if none)
ParType
Enumeration of parameter types (casacore::Complex, Real, or Both)
casacore::Double interval_
Solution timescale (context-dependent)
virtual casacore::Bool isSolvable()
Is this solveable? (never via this interface)
void invalidateJ()
Validation of Jones matrices.
virtual casacore::Int nCalMat()=0
Number of Calibration matrices on ant/bln axis.
casacore::Double refTime_
casacore::Int currSpw_
Current synchronized spw.
String: the storage and methods of handling collections of characters.
casacore::PtrBlock< VisVector * > V_
VisVector wrapper (per Spw)
casacore::PtrBlock< Jones * > J1_
Jones algebra wrapper (per Spw)
virtual void setCallib(const casacore::Record &callib, const casacore::MeasurementSet &selms)
VisBuffers encapsulate one chunk of visibility data for processing.
virtual void countOutFlag(const VisBuffer &vb)
casacore::String extratag_
virtual casacore::Bool timeDepMat()
Matrices time-dependent per parameter set (nominally no)
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)
void deleteVisMueller()
Delete the this* caches.
virtual VisCalEnum::MatrixType matrixType()
Return casacore::Matrix type.
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 "gains" 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<casacore::Complex> (applyByMueller override) ...
void checkCurrCal()
Test for need of new calibration.
void deleteVisJones()
Delete the this* caches.
void setPrtlev(const casacore::Int &prtlev)
Set the print level.
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.
static casacore::String nameOfType(Type type)
const MSMetaInfoForCal * msmc_
The MSMetaInfoForCal pointer.
casacore::Vector< casacore::Bool > MValid_
Mueller validity.
virtual casacore::Int nCalMat()
Number of Cal Matrices to form on antenna axis (Jones, apply context: nAnt())
virtual void setMatByOk()
Set matrix elements according to their ok flags (e.g., makes a unit matrix if everything flagged...
casacore::Double & refTime()
casacore::Vector< casacore::Int > currIntent_
casacore::Vector< casacore::Int > nChanMat_
virtual casacore::Cube< casacore::Complex > & currCPar()
Access (public) to current solution parameters and matrices.
casacore::Vector< casacore::Bool > JValid_
Jones validity, per spw.
casacore::String msName_
Associated casacore::MS name.
virtual void calcPar()
Calculate Mueller parameters by some means.