StokesCube

class stokespy.StokesCube(data, wcs=None, stokes_params=('I', 'Q', 'U', 'V'), normalize=False, **kwargs)[source]

Bases: ndcube.ndcube.NDCube

Class representing a 2D map of Stokes profiles with dimensions (stokes, wavelength, coord1, coord2).

Parameters
  • data (numpy.ndarray) – The array holding the actual data in this object. The array index order must be (stokes, wavelength, coord1, coord2).

  • wcs (astropy.wcs.wcsapi.BaseLowLevelWCS, astropy.wcs.wcsapi.BaseHighLevelWCS, optional) – The WCS object containing the axes’ information. If not provided, a WCS is constructed using wavelength_unit and coordinate_unit, which default to pixels.

  • stokes_params (tuple of str) – Tuple containing all or part of (‘I’, ‘Q’, ‘U’, ‘V’) defining the number and kind of Stokes parameters available.

  • normalize (bool) – Normalization for polarization parameters Q, U, V. If True, then polarization parameters are normalized by the intensity at each wavelength, e.g. Q => Q/I. If a non-zero scalar is provided then that will be used as the normalization, e.g. for a chosen continuum intensity.

  • class. (Additional kwargs are passed to the NDCube base) –

Attributes Summary

I

Intensity as a 3D NDCube (wavelength, coord1, coord2)

L

Linear polarization L = sqrt(Q**2 + U**2) a 3D NDCube (wavelength, coord1, coord2)

P

Total polarization P = sqrt(Q**2 + U**2 + V**2) a 3D NDCube (wavelength, coord1, coord2)

Q

Linear polarization Q as a 3D NDCube (wavelength, coord1, coord2)

U

Linear polarization U as a 3D NDCube (wavelength, coord1, coord2)

V

Circular polarization as a 3D NDCube (wavelength, coord1, coord2)

frame

The observed frame for the dat if it exists

spectral_axis

The spectral axis in physical units

stokes_axis

The available Stokes parameters

theta

Linear polarization angle theta = 0.5 arctan(U/Q) a 3D NDCube (wavelength, coord1, coord2)

Methods Summary

I_map(wavelength[, stop_wavelength])

Intensity as a 2D NDCube (coord1, coord2)

I_profile(coords)

Intensity profile at a specific coordinate

L_map(wavelength[, stop_wavelength])

Linear polarization L = sqrt(Q**2 + U**2) as a 2D NDCube (coord1, coord2)

L_profile(coords)

Linear polarization L = sqrt(Q**2 + U**2) profile at a specific coordinate

P_map(wavelength[, stop_wavelength])

Total polarization P = sqrt(Q**2 + U**2 + V**2) as a 2D NDCube (coord1, coord2)

P_profile(coords)

Total polarization P = sqrt(Q**2 + U**2 + V**2) profile at a specific coordinate

Q_map(wavelength[, stop_wavelength])

Linear polarization Q as a 2D NDCube (coord1, coord2)

Q_profile(coords)

Linear polarization Q profile at a specific coordinate

U_map(wavelength[, stop_wavelength])

Linear polarization U as a 2D NDCube (coord1, coord2)

U_profile(coords)

Linear polarization U profile at a specific coordinate

V_map(wavelength[, stop_wavelength])

Circular polarization as a 2D NDCube (coord1, coord2)

V_profile(coords)

Circular polarization profile at a specific coordinate

coord1_axis(coord2)

The physical axis across the first spatial dimension

coord2_axis(coord1)

The physical axis across the second spatial dimension

get_spatial_ind(coords)

Test if a set of coordinates fit inside the dimensions of the 2D images.

get_wav_ind(wavelength)

Test if a wavelength is inside the wavelength axis for the object and return the array index corresponding to that wavelength

plot([wavelength, coords, context, plot_u])

Create a four panel plot showing I,Q,U,V maps at a specific wavelength

theta_map(wavelength[, stop_wavelength])

Linear polarization angle theta = 0.5 arctan(U/Q) as a 2D NDCube (coord1, coord2)

theta_profile(coords)

Linear polarization angle theta = 0.5 arctan(U/Q) profile at a specific coordinate

Attributes Documentation

I

Intensity as a 3D NDCube (wavelength, coord1, coord2)

L

Linear polarization L = sqrt(Q**2 + U**2) a 3D NDCube (wavelength, coord1, coord2)

P

Total polarization P = sqrt(Q**2 + U**2 + V**2) a 3D NDCube (wavelength, coord1, coord2)

Q

Linear polarization Q as a 3D NDCube (wavelength, coord1, coord2)

U

Linear polarization U as a 3D NDCube (wavelength, coord1, coord2)

V

Circular polarization as a 3D NDCube (wavelength, coord1, coord2)

frame

The observed frame for the dat if it exists

spectral_axis

The spectral axis in physical units

stokes_axis

The available Stokes parameters

theta

Linear polarization angle theta = 0.5 arctan(U/Q) a 3D NDCube (wavelength, coord1, coord2)

Methods Documentation

I_map(wavelength, stop_wavelength=None)[source]

Intensity as a 2D NDCube (coord1, coord2)

I_profile(coords)[source]

Intensity profile at a specific coordinate

L_map(wavelength, stop_wavelength=None)[source]

Linear polarization L = sqrt(Q**2 + U**2) as a 2D NDCube (coord1, coord2)

L_profile(coords)[source]

Linear polarization L = sqrt(Q**2 + U**2) profile at a specific coordinate

P_map(wavelength, stop_wavelength=None)[source]

Total polarization P = sqrt(Q**2 + U**2 + V**2) as a 2D NDCube (coord1, coord2)

P_profile(coords)[source]

Total polarization P = sqrt(Q**2 + U**2 + V**2) profile at a specific coordinate

Q_map(wavelength, stop_wavelength=None)[source]

Linear polarization Q as a 2D NDCube (coord1, coord2)

Q_profile(coords)[source]

Linear polarization Q profile at a specific coordinate

U_map(wavelength, stop_wavelength=None)[source]

Linear polarization U as a 2D NDCube (coord1, coord2)

U_profile(coords)[source]

Linear polarization U profile at a specific coordinate

V_map(wavelength, stop_wavelength=None)[source]

Circular polarization as a 2D NDCube (coord1, coord2)

V_profile(coords)[source]

Circular polarization profile at a specific coordinate

coord1_axis(coord2)[source]

The physical axis across the first spatial dimension

coord2_axis(coord1)[source]

The physical axis across the second spatial dimension

get_spatial_ind(coords)[source]

Test if a set of coordinates fit inside the dimensions of the 2D images.

get_wav_ind(wavelength)[source]

Test if a wavelength is inside the wavelength axis for the object and return the array index corresponding to that wavelength

plot(wavelength=None, coords=None, context=None, plot_u=Unit('nm'), **kwargs)[source]

Create a four panel plot showing I,Q,U,V maps at a specific wavelength

theta_map(wavelength, stop_wavelength=None)[source]

Linear polarization angle theta = 0.5 arctan(U/Q) as a 2D NDCube (coord1, coord2)

theta_profile(coords)[source]

Linear polarization angle theta = 0.5 arctan(U/Q) profile at a specific coordinate