apply_antenna_gains_to_visibility

ska_sdp_func_python.calibration.operations.apply_antenna_gains_to_visibility(vis: ndarray, gains: ndarray, antenna1: ndarray, antenna2: ndarray, inverse=False) ndarray

Apply antenna gains (Jones matrices) to a visibility array.

This function modifies the visibility data by applying complex antenna gains. Depending on the inverse parameter, it can be used to simulate signal corruption (applying gains directly) or to calibrate the data (applying the inverse of the gains).

Parameters

visnumpy.ndarray

The visibility data array. Shape: (n_times, n_baselines, n_freqs, n_pols). The polarization axis is expected to be flattened (e.g., length 4 for XX, XY, YX, YY, corresponding to a 2x2 matrix).

gainsnumpy.ndarray

The complex antenna gains (Jones matrices). Shape: (n_times, n_antennas, n_freqs, n_rec, n_rec). Where n_rec is the number of receptors (typically 2).

antenna1numpy.ndarray

Indices of the first antenna in each baseline pair. Shape: (n_baselines,).

antenna2numpy.ndarray

Indices of the second antenna in each baseline pair. Shape: (n_baselines,).

inversebool, optional

If True, apply the pseudo-inverse of the gains (calibration). If False, apply the gains directly (corruption/simulation). Default is False.

Returns

numpy.ndarray

The modified visibilities. Shape: (n_times, n_baselines, n_freqs, n_pols).

Notes

The operation implements the standard radio interferometry measurement equation (or its inverse):

\[V_{out} = G_1 \cdot V_{in} \cdot G_2^H\]

where $G_1$ and $G_2$ are the Jones matrices for antenna 1 and antenna 2 respectively, and $^H$ denotes the Hermitian transpose. To perform this multiplication efficiently, the visibility polarization dimension is temporarily reshaped into a (2, 2) matrix.