cngi.image.stokes_to_corr

stokes_to_corr(ixds, basis='linear')[source]

Convert polarization data from Stokes parameters to the correlation basis.

To be used as a converter during image reconstruction, and also stand-alone.

The sign convention used here should be the same as what CASA uses, (XX^YY)/2

..todo:

Apply transformations to all data variables, not just IMAGE

..todo:

Drop the basis and code_name dimensions from the product

..todo:

Update pol dimension to match reassigned version across the rest of the xds when combining

..todo:

Ensure that math to calculate linear basis products matches the CASA convention

Parameters
  • ixds (xarray.core.dataset.Dataset) – Input image dataset (e.g., loaded from img.zarr file) with polarization data as Stokes (I,Q,U,V) parameters.

  • basis (string, default='linear') – Desired correlation basis ‘linear’ or ‘circular’

Returns

Output image dataset with polarization data in the linear (XX,XY,YX,YY) or circular (RR,RL,LR,LL) correlation basis.

Return type

xarray.core.dataset.Dataset

See also

corr_to_stokes

Notes

Polarization codes from the MeasurementSet are preserved in vis.zarr: #. I #. Q #. U #. V #. RR #. RL #. LR #. LL #. XX #. XY #. YX #. YY

Raises
  • UserWarning – If input pol dimension does not contain expected codes, or has the wrong shape.

  • NotImplementedError – If the input image has less than 4 Stokes parameters we still compute the possible results but cannot return them, so trap a ValueError with this until it is decided how to align pol dimension in the converted image with the pol dimension for all the other data variables of the input. Is it necessary to update the codes along the pol dimension for the whole dataset to match new basis?

  • . note:: – Support is presently limited for heterogeneous-feed arrays with elements expected to be missing in a given basis (e.g., very long baseline interferometry with the Event Horizon Telescope).