nenupy.io.tf_utils.compute_stokes_parameters
- nenupy.io.tf_utils.compute_stokes_parameters(data_array, stokes)[source]
Compute the Stokes parameters from data organized in Jones matrices.
data_array’s last two dimensions are assumed to be:\[\begin{split}\mathbf{d} = \begin{pmatrix} X\overline{X} & X\overline{Y} \\ Y\overline{X} & Y\overline{Y} \end{pmatrix},\end{split}\]so that the Stokes parameters are computed such as:
\[\begin{split}\begin{align} I &= \Re(X\overline{X}) + \Re(Y\overline{Y})\\ Q &= \Re(X\overline{X}) - \Re(Y\overline{Y})\\ U &= 2\Re(X\overline{Y})\\ V &= -2\Im(X\overline{Y})\\ L &= \sqrt{U^2 + Q^2} \end{align}\end{split}\]- Parameters:
data_array (
ndarray) – The data array (a DaskArrayis also accepted), the first dimensions may corresponds with anything (for e.g., time, frequency, beam…) and are kept through the computation, the last two dimensions must be the \(2 \times 2\) Jones matrices.stokes (List[
str] orstr) – Stokes parameters to compute, if a list is given, the result will store them in the same order in the last result dimension, available values are “I”, “Q”, “U”, “V”, “L”, “Q/I”, “U/I”, “V/I”, “L/I”.
- Returns:
New data array transformed in Stokes parameters, the last two dimensions are replaced by a single dimension listing in order the requested stokes parameters. If the input data_array is a Dask
Array, the returned result is of the same type.- Return type:
- Raises:
Exception – Raised if the last two dimensions of data_array are different than (2, 2)
NotImplementedError – Raised if the requested Stokes parameter is not known
Example
>>> from nenupy.io.tf import Spectra >>> from nenupy.io.tf_utils import compute_stokes_parameters >>> sp = Spectra(".../my_file.spectra") >>> result = compute_stokes_parameters( data_array=sp.data[:1000, :100, :, :], # shape: (time, frequency, 2, 2) stokes=["I", "U/I", "V/I"] ) >>> result.shape (1000, 100, 3)