Stokes Vector

Module: sasktran.stokesvector

class sasktran.StokesVector(stokes, basis)

Bases: object

Defines a stokes vector with its associated basis.

Parameters
  • stokes (numpy array shape (4,)) – The stokes vector [I, Q, U, V]

  • basis (numpy array shape (3,3)) – Coordinate basis the stokes vector is defined in. basis[0, :] is the propagation direction, basis[1, :] is the theta direction, and basis[2, :] is the phi direction. Directions are specified in ECEF coordinates. The basis must be constructed such that basis[1, :] cross basis[2, :] is equal to basis[0, :]

Raises

ValueError – If the basis is not correctly constructed

Examples

>>> from sasktran import StokesVector
>>> basis = np.eye(3, 3)
>>> stokes_rad = [1, 0.1, -0.1, 0]
>>> stokes_v = StokesVector(stokes_rad, basis)
>>> print(stokes_v)
Stokes Vector
I: 1 Q: 0.1 U: -0.1 V: 0
Propagation: [ 1.  0.  0.]
Theta: [ 0.  1.  0.]
Phi: [ 0.  0.  1.]
classmethod from_skif_object(iskstokesvector: sasktranif.sasktranif.ISKStokesVector)

Constructs the stokes vector from an already existing skif.ISKStokesVector object

Parameters

iskstokesvector (skif.ISKStokesVector) –

Returns

Return type

StokesVector

Examples

>>> import sasktranif.sasktranif as skif
>>> from sasktran import StokesVector
>>> basis = skif.ISKBasisDirection()
>>> basis.Assign([1, 0, 0], [0, 1, 0], [0, 0, 1])
>>> stokes_rad = [1, 0.1, -0.1, 0]
>>> skif_stokes = skif.ISKStokesVector()
>>> iquv = skif.IQUV()
>>> iquv.I, iquv.Q, iquv.U, iquv.V = stokes_rad
>>> skif_stokes.Assign(iquv, basis)
>>> stokes_v = StokesVector.from_skif_object(skif_stokes)
>>> print(stokes_v)
Stokes Vector
I: 1.0 Q: 0.1 U: -0.1 V: 0.0
Propagation: [ 1.  0.  0.]
Theta: [ 0.  1.  0.]
Phi: [ 0.  0.  1.]
to_new_basis(new_basis)

Converts the stokes vector to a new basis. A rotation matrix between the new basis and old basis is constructed and applied to the stokes vector. Note that this process overrides the old basis

Parameters

new_basis (numpy array shape (3,3)) – The new basis. See the class constructor documentation for the format

Examples

>>> from sasktran import StokesVector
>>> basis = np.eye(3, 3)
>>> stokes_rad = [1, 0.1, -0.1, 0]
>>> stokes_v = StokesVector(stokes_rad, basis)
>>> print(stokes_v)
Stokes Vector
I: 1 Q: 0.1 U: -0.1 V: 0
Propagation: [ 1.  0.  0.]
Theta: [ 0.  1.  0.]
Phi: [ 0.  0.  1.]
>>> new_basis = basis[[0,2,1]]
>>> new_basis[2] *= -1
>>> stokes_v.to_new_basis(new_basis)
>>> print(stokes_v)
Stokes Vector
I: 1.0 Q: -0.1 U: 0.1 V: 0.0
Propagation: [ 1.  0.  0.]
Theta: [ 0.  0.  1.]
Phi: [-0. -1. -0.]
phi_direction

Returns the phi direction of the current basis in ECEF coordinates

propagation_direction

Returns the propagation direction of the current basis in ECEF coordinates

theta_direction

Returns the theta direction of the current basis in ECEF coordinates