pyoptics.polarization

Polarization: Jones calculus (jones), Mueller calculus (mueller) and helpers for TE/TM bases, partially polarized light, DOP and IPS.

pyoptics.polarization.TE_TM_basis(sigma_x, sigma_y)[source]

Return the TE and TM Jones unit vectors for the direction (sigma_x, sigma_y).

Parameters:
sigma_x, sigma_ynumbers or arrays

Transverse direction (only its azimuth matters).

Returns:
e_TE, e_TMarrays

Shape (2,) + np.shape(sigma_x): e_TE = (-sin(phi), cos(phi)), e_TM = (cos(phi), sin(phi)).

pyoptics.polarization.lin_pol_to_TE_TM(field, sigma_x, sigma_y)[source]

Convert [E_x, E_y] data to [E_TE, E_TM].

Parameters:
fieldarray

Jones vector(s) with the components along the first axis, shape (2, …), or a field of shape (Ny, Nx, 2) when sigma_x, sigma_y have the shape (Ny, Nx).

sigma_x, sigma_ynumbers or arrays

Transverse direction of the plane wave(s), see TE_TM_basis().

Returns:
field_TE_TMarray

Same shape as field.

pyoptics.polarization.TE_TM_pol_to_lin(field, sigma_x, sigma_y)[source]

Convert [E_TE, E_TM] data to [E_x, E_y]; inverse of lin_pol_to_TE_TM().

Parameters:
fieldarray

TE/TM components along the first axis, shape (2, …), or a field of shape (Ny, Nx, 2) when sigma_x, sigma_y have the shape (Ny, Nx).

sigma_x, sigma_ynumbers or arrays

Transverse direction of the plane wave(s), see TE_TM_basis().

Returns:
field_xyarray

Same shape as field.

pyoptics.polarization.coherency_matrix(S)[source]

Return the 2x2 coherency matrix <E E^H> of a Stokes vector S.

pyoptics.polarization.jones_from_stokes(S)[source]

Decompose (partially polarized) light into two mutually incoherent, orthogonal Jones vectors.

The coherency matrix of S is diagonalized; its eigenvectors are the two polarization states and its eigenvalues their intensities. Unpolarized light S = [1, 0, 0, 0] gives two orthogonal states with weight 1/2 each (x and y), fully polarized light one state with weight S_0 and one with weight 0.

Parameters:
Sarray

Stokes vector [S_0, S_1, S_2, S_3].

Returns:
weightsarray

Intensities of the two states, shape (2,), largest first; they add up to S_0.

Jarray

Normalized Jones vectors, shape (2, 2): J[i] belongs to weights[i]. Summing weights[i]*mueller.stokes_from_complex_E(J[i]) gives S.

pyoptics.polarization.DOP(field)[source]

Degree of polarization of a field.

Parameters:
fieldarray

Jones vectors of shape (2, …) (e.g. a field [E_x, E_y] sampled on a grid, with the components along the first axis); the Stokes parameters are summed (incoherent average) over all other axes.

Returns:
DOPnumber
pyoptics.polarization.IPS(field, pref_state)[source]

Intensity in the preferred state: the fraction of the intensity that a perfect analyzer for the Jones vector pref_state transmits.

Parameters:
fieldarray

Jones vectors of shape (2, …), summed incoherently as in DOP(). A Stokes vector (shape (4,)) is accepted as well.

pref_statearray

Jones vector of the preferred state.

Returns:
IPSnumber

Between 0 and 1; 1/2 for unpolarized light.