Todo

  • Fix up linting

  • Time and frequency calibration intervals?

  • Add single-polarisation gain solvers for comparison?

  • Add pre-averaging for algorithm 1?

  • Use names rather than indices for algorithms?

  • Change name of the python package from jones_solvers to ska-sdp-jones-solvers?

Jones Solvers Documentation

Solvers

At present, a single set of matrices is found for all times and frequencies, as might be required for real-time calibration. For more general-purpose operation the solutions will need to be split into time and frequency intervals.

RTS-Style Solver

Algorithm 1 of solve_jones() iteratively updates the set of Jones matrices, but within each iteration performs an independent least-squares optimisation for each matrix without considering how the others are updating. This is equivalent to forming a normal matrix and setting the off-diagonal terms to zero. While it does not converge as fast as the normal-equation approach, it scales well in terms of operations and memory, and allows the free parameter for each antenna/station to be the 2x2 Jones matrix. It is based on the equivalent solver in the MWA RealTime System (Mitchell et at., 2008, IEEE JSTSP, 2, JSTSP.2008.2005327).

The equation to be minimised is similar to the scalar equation from RASCIL, but with 2x2 Jones matrices, J, instead of scalar gain terms and 2x2 coherency matrices, V instead of scalar visibilties:

\[S = \sum_{t,f}^{}{\sum_{i,j}^{}{w_{t,f,i,j}\left|\left| V_{t,f,i,j}^{\text{obs}} - J_{i}V_{t,f,i,j}^{\text{mod}}{J_{j}^{*}} \right|\right|}^{2}_{F}}\]

where \(||A||^{2}_{F}\) the squared Frobenius norm of a matrix A, equal to the trace of \(AA^H\).

Yandasoft-Style Solver

Algorithm 2 of solve_jones() is a full normal-equation based linear least-squares algorithm. It is based on the approach in Yandasoft. Normal equations can be generated via initial creation of a design matrix, which may be more efficient when calibrating on short time and frequency intervals, or normal-equation element products can be accumulated directly, allowing for an initial accumulation over time and frequency. In Yandasoft the latter was implemented by Max Voronkov using an automatic differentiation class for complex data and parameters. See Max’s CalIm presentation for details.

Public API Documentation

Functions

A collection of solvers for antenna-based Jones matrices

Algorithm 1 of solve_jones iteratively updates the set of Jones matrices, but within each iteration performs an independent least-squares optimisation for each matrix without considering how the others are updating. This is equivalent to forming a normal matrix and setting the off-diagonal terms to zero. While it does not converge as fast as the normal-equation approach, it scales well in terms of operations and memory, and allows the free parameter for each antenna/station to be the 2x2 Jones matrix. It is based on the equivalent solver in the MWA RealTime System (Mitchell et at., 2008, IEEE JSTSP, 2, JSTSP.2008.2005327).:

Accumulation option 0: easy to read
Accumulation option 1: a bit faster (default)

Algorithm 2 is a full normal-equation based linear least-squares algorithm. It is based on the approach in Yandasoft.:

Accumulation option 0: via design matrix (default)
Accumulation option 1: direct accumulation of normal matrix with pre-summing of normal equation products in time and frequency.

For example:

solve_jones(vis, modelvis, jones, niter=25)
jones_solvers.processing_components.solve_jones.solve_jones(vis: rascil.data_models.memory_data_models.BlockVisibility, modelvis: rascil.data_models.memory_data_models.BlockVisibility, jones: rascil.data_models.memory_data_models.GainTable, niter=30, nu=None, tol=1e-06, algorithm=1, accum_opt=None, lin_solver='lsmr', lin_solver_normal=None, lin_solver_rcond=1e-06, testvis: Optional[rascil.data_models.memory_data_models.BlockVisibility] = None)[source]

Solve Jones matrices by fitting observed visibilities to model visibilities

A single set of matrices is found for all times and frequencies.

Parameters
  • vis – BlockVisibility containing the observed visibility data

  • modelvis – BlockVisibility containing the predicted data_model (updated on exit)

  • jones – Existing GainTable containing the Jones matrices (updated on exit)

  • niter – Number of iterations (default 30)

  • nu – iterative adaptation update factor (default variable)

  • tol – Convergence fractional-change tolerance (default 1e-6)

  • algorithm – Solver algorithm used (default 1)

  • accum_opt – Accumulation option (1 for algorithm 1, 0 for algorithm 2)

  • lin_solver – linear solver used in each iteration of algorithm 2: “lsmr” (scipy, default), “lsqr” (scipy), “lstsq” (numpy) or “svd” (numpy)

  • lin_solver_normal – whether or not to form normal equations before calling lin_solver (default False where allowed: accum_opt 0 with lsmr or lsqr). Otherwise True

  • lin_solver_rcond – cutoff ratio used when lin_solver = “svd” or “lstsq” (default 1e-6)

  • testvis – Optional BlockVisibility for comparisons (e.g. noiseless simulated data). Generates matplotlib output

Returns

numpy array containing chisq values as a function of iteration