ska_sdp_instrumental_calibration.numpy_processors.solvers.alternative_solvers module

class ska_sdp_instrumental_calibration.numpy_processors.solvers.alternative_solvers.AlternativeSolver(niter=50, tol=1e-06, **_)[source]

Bases: Solver

Base class for alternative antenna gain solvers using different algorithms.

This class extends Solver to provide a flexible interface for alternative calibration algorithms, such as Jones substitution or normal equations. The specific algorithm is set via the _solver_fn property, which should return a callable implementing the desired method.

solve(vis_vis, vis_flags, vis_weight, model_vis, model_flags, gain_gain, gain_weight, gain_residual, ant1, ant2)[source]

Run the alternative gain solver algorithm.

Fits observed visibilities to model visibilities using the selected algorithm (defined in _solver_fn). It handles reshaping of visibilities into Jones matrices, flag application, and model corruption by existing gains before invoking the specific solver.

Parameters:
  • vis_vis (np.ndarray) -- Complex observed visibilities. Shape: (ntime, nbl, nchan, npol).

  • vis_flags (np.ndarray) -- Boolean flags for observed visibilities (True indicates flagged). Shape: (ntime, nbl, nchan, npol).

  • vis_weight (np.ndarray) -- Weights for observed visibilities. Shape: (ntime, nbl, nchan, npol).

  • model_vis (np.ndarray) -- Complex model visibilities. Shape: (ntime, nbl, nchan, npol).

  • model_flags (np.ndarray) -- Boolean flags for model visibilities. Shape: (ntime, nbl, nchan, npol).

  • gain_gain (np.ndarray) -- Complex gain solutions (Jones matrices). Acts as both the initial guess and the output buffer. Shape: (ntime_sol, nchan_sol, nant, nrec, nrec).

  • gain_weight (np.ndarray) -- Weights associated with the gain solutions. Shape: matches gain_gain.

  • gain_residual (np.ndarray) -- Residuals of the gain solutions. Shape: matches gain_gain.

  • ant1 (np.ndarray) -- Index of the first antenna for each baseline. Shape: (nbl,).

  • ant2 (np.ndarray) -- Index of the second antenna for each baseline. Shape: (nbl,).

Returns:

A tuple containing:

  • gain_gain: Updated complex gain solutions.

  • gain_weight: Weights of the solutions.

  • gain_residual: Residuals of the fit.

Return type:

tuple of np.ndarray

class ska_sdp_instrumental_calibration.numpy_processors.solvers.alternative_solvers.JonesSubtitution(niter=50, tol=1e-06, **_)[source]

Bases: AlternativeSolver

Solver for antenna gains using the Jones substitution algorithm.

This class configures the AlternativeSolver to use the Jones matrix substitution method for calibration. It sets the internal solver function to an implementation that iteratively solves for antenna-based Jones matrices.

_SOLVER_NAME_

The unique identifier for this solver strategy ("jones_substitution").

Type:

str

Notes

This class is typically used for full-polarization calibration where antenna-based Jones matrices are solved iteratively.

class ska_sdp_instrumental_calibration.numpy_processors.solvers.alternative_solvers.NormalEquation(niter=50, tol=1e-06, **_)[source]

Bases: AlternativeSolver

Solver for antenna gains using Normal Equations.

This class configures the AlternativeSolver to use a Normal Equations approach (Linear Least Squares) to determine antenna gains. It provides a robust method for solving complex gain matrices by minimizing the difference between model and observed visibilities.

_SOLVER_NAME_

The unique identifier for this solver strategy ("normal_equations").

Type:

str

class ska_sdp_instrumental_calibration.numpy_processors.solvers.alternative_solvers.NormalEquationsPreSum(niter=50, tol=1e-06, **_)[source]

Bases: AlternativeSolver

Solver using Normal Equations with data pre-summing.

This class extends the Normal Equations approach by applying a pre-summing optimization. Visibility data is averaged (pre-summed) before the iterative solving steps to reduce computational overhead on large datasets while maintaining solution accuracy.

_SOLVER_NAME_

The unique identifier for this solver strategy ("normal_equations_presum").

Type:

str