ska_sdp_instrumental_calibration.data_managers.gaintable module

ska_sdp_instrumental_calibration.data_managers.gaintable.create_gaintable_from_visibility(vis, timeslice=None, jones_type='T', lower_precision=True, skip_default_chunk=False)[source]

Create a unity- or identity-initialised GainTable consistent with the given Visibility.

GainTable either represents:

  • a collection of complex-valued scalar gains, if Visibility carries only Stokes I data.

  • a collection of 2x2 complex-valued Jones matrices otherwise.

In the first case, gains are initialised to unity. In the second case, Jones matrices are initialised to the identity matrix.

Parameters:
  • vis (Visibility) -- Visibility to create gaintable from

  • timeslice (float | Literal['auto', 'full'] | None, default: None) --

    Defines the time scale over which each gain solution is valid. This is used to define the time axis of the GainTable. This parameter is interpreted as follows depending on its type:

    • float: this is a custom time interval in seconds. Input timestamps are grouped by intervals of this duration, and said groups are separately averaged to produce the output time axis.

    • "full": create a single solution across the entire visibility time

    • "auto" or None: match the time resolution of the input visibility, i.e. copy the time axis of the input Visibility

  • jones_type (Literal['T', 'G', 'B'], default: 'T') --

    Type of Jones term, one of {"T", "G", "B"}. The frequency axis of the output GainTable depends on the value provided:

    • "B": the output frequency axis is the same as that of the input Visibility.

    • "T" or "G": solution is assumed to be frequency-independent, and the frequency axis of the output contains a single value: the average frequency of the input Visibility's channels.

  • lower_precision (bool, default: True) -- Used to set up the float bit sizes while initialising the gaintable. If true, uses np.complex64 and np.float32 instead of higher precision np.complex128 and np.float64. Useful for memory optimization.

  • skip_default_chunk (bool, default: False) -- If set to true, skips Dask/Xarray chunking of data in alignment to the input visibility. Useful in cases of chunk alignment issues. Default: False

Return type:

GainTable

Returns:

Gaintable suitable for storing calibration solutions of given visibility

ska_sdp_instrumental_calibration.data_managers.gaintable.reset_gaintable(gaintable)[source]

Returns a new dask-backed gaintable with all data variables resetted to their initial sensible values.

Parameters:

gaintable (GainTable) -- Gaintable object to be reset

Return type:

GainTable

Returns:

Gaintable with data variables resetted to their intial sensible values.

ska_sdp_instrumental_calibration.data_managers.gaintable.divide_bandpass_by_ref_ant_preserve_phase(gaintable, ref_ant)[source]

Original code referred from https://github.com/flint-crew/flint.git Divide the bandpass complex gains (solved for initially by something like calibrate) by a nominated reference antenna. In the case of calibrate there is no implicit reference antenna. This is valid for cases where the xy-phase is set to 0 (true via the ASKAP on-dish calibrator).

This particular function is most appropriate for the calibrate style solutions, which solve for the Jones in one step. In HMS notation this are normally split into two separate 2x2 matrices, one for the gains with zero off-diagonal elements and a leakage matrix with ones on the diagonal.

This is the preferred function to use whena attempting to set a phase reference antenna to precomputed Jones bandpass solutions.

The input complex gains should be in the form: >> (ant, channel, pol)

Internally reference phasores are constructed for the G_x and G_y terms of the reference antenna. They are then applied: >> G_x = G_x / G_xref >> G_xyp = G_xy / G_yref >> G_yxp = G_yx / G_xref >> G_y = G_y / G_yref

which is applied to all antennas in complex_gains.

Parameters:
  • complex_gains (np.ndarray) -- The complex gains that will be normalised

  • ref_ant (int) -- The desired reference antenna to use

Returns:

The normalised bandpass solutions

Return type:

GainTable