convert_polarization

ska_sdp_func_python.xradio.visibility.polarization.convert_polarization(xds: Dataset, output_pols: Iterable[str]) Dataset

Convert the polarization representation of an xradio Dataset to another, returning a new Dataset.

NOTE: Conversion of visibilities between polarization frames is invertible, but the conversion of associated weights and flags generally is not and results in loss of information. Always avoid chaining polarization conversions.

Parameters:
  • xds – Input xradio Dataset

  • output_pols – List of desired polarization codes, in the order they will appear in the output dataset polarization axis.

Returns:

A new xradio dataset where the visibilities, weights and flags have been converted to a new polarization representation.

Raises:

ValueError – if output_pols is invalid, or if the requested conversion is not possible.

Example usage

# Convert to full Stokes representation
xds_conv = convert_polarization(xds, ["I", "Q", "U", "V"])

# Partial pol frames are supported, order does not matter
xds_conv = convert_polarization(xds, ["Q", "I"])  # OK