1.5. py_pol.mueller module

Mueller objects describe optical polarization elements in the Mueller-Stokes formalism.

Class fields:
  • M: 4x4xN array containing all the Mueller matrices.

  • name: Name of the object for print purposes.

  • shape: Shape desired for the outputs.

  • size: Number of stored Mueller matrices.

  • ndim: Number of dimensions for representation purposes.

  • no_rotation: If True, rotation method do not act upon the object. Useful for objects that shouldn’t be rotated as mirrors.

  • type: Type of the object (‘Mueller’). This is used for determining the object class as using isinstance may throw unexpected results in .ipynb files.

  • parameters: parameters of the Mueller matrices.

  • checks: checks of the Mueller matrices.

  • analysis: analysis of the Mueller matrices.

Parent methods
  • clear: Removes data and name form Jones vector.

  • copy: Creates a copy of the Jones_vector object.

  • stretch: Stretches a Jones vector of size 1.

  • shape_like: Takes the shape of another object to use as its own.

  • reshape: Changes the shape of the object.

  • flatten: Transforms N-D objects into 1-D objects (0-D if only 1 element).

  • flip: Flips the object along some dimensions.

  • get_list: Creates a list with single elements.

  • from_list: Creates the object from a list of single elements.

  • concatenate: Canocatenates several objects into a single one.

  • draw: Draws the components of the object.

  • clear: Clears the information of the object.

Generation methods
  • from_components: Creates a Mueller matrix directly from the 16 $M_{ij}$ elements.

  • from_matrix: Creates a Mueller object directly from a 4x4xN matrix.

  • from_normalized: Creates a Mueller matrix directly from a normalized 4x4 matrix ($M_{norm} = M/M_{00}$).

  • from_Jones: Creates a Mueller Matrix equivalent to a Jones matrix.

  • from_blocks: Creates a Mueller matrix from the blocks of its decomposition.

  • from_covariance: Creates a Mueller matrix from the equivalent covariant matrix.

  • from_inverse: Creates a Mueller matrix from the inverse matrix.

  • from_list: Creates a Jones_matrix object directly from a list of 4x4 numpy arrays.

  • vacuum: Creates the matrix for vacuum.

  • mirror: Creates the matrix for a mirror. NOTE: This matrix mus not be rotated.

  • filter_amplifier: Creates the matrix for a neutral filter or amplifier element.

  • depolarizer_perfect: Creates a perfect depolarizer.

  • depolarizer_diagonal: Creates a depolarizer with elements just in the diagonal.

  • depolarizer_states: Creates a general depolarizer from the diattenuation, polarizance and eigenstate vectors.

  • diattenuator_perfect: Creates a perfect linear polarizer.

  • diattenuator_linear: Creates a real diattenuator with perpendicular axes.

  • diattenuator_charac_angles: Creates the most general homogeneous diattenuator with orthogonal eigenstates from the characteristic angles of the main eigenstate.

  • diattenuator_azimuth_ellipticity: Creates the most general homogenous diattenuator from the characteristic angles of the main eigenstate.

  • diattenuator_vector: Creates the most general homogenous diattenuator from the diattenuation vector.

  • quarter_waveplate: Creates a perfect retarder with 90º retardance.

  • half_waveplate: Creates a perfect retarder with 180º retardance.

  • retarder_linear: Creates a linear retarder.

  • retarder_charac_angles: Creates the most general homogeneous retarder from the characteristic angles of the fast eigenstate.

  • retarder_azimuth_ellipticity: Creates the most general homogeneous retarder from the characteristic angles of the fast eigenstate.

  • retarder_from_vector: Creates the most general homogeneous retarder from the retardance vector.

  • diattenuator_retarder_linear: Creates an homogeneous linear diattenuator retarder with the same axes for diattenuation and retardance.

  • diattenuator_retarder_azimuth_ellipticity: Creates the most general homogeneous diattenuator retarder with the same axes for diattenuation and retardance from the azimuth and ellipticity angle.

  • diattenuator_retarder_charac_angles: Creates the most general homogeneous diattenuator retarder with the same axes for diattenuation and retardance from the characteristic angles.

  • general_eigenstates: Generates the most general pure optical element from its eigenstates.

Manipulation methods
  • rotate: Rotates the Mueller matrix.

  • sum: Calculates the summatory of the Jones matrices in the object.

  • prod: Calculates the product of the Jones matrices in the object.

  • remove_global_phase: Removes the phase introduced by the optical element.

  • add_global_phase: Increases the phase introduced by the optical element.

  • set_global_phase: Sets the phase introduced by the optical element.

  • reciprocal: Flips the optical element so the light transverses it in the opposite direction.

  • transpose: Transposes the Mueller matrix of the element.

  • inverse: Calculates the inverse matrix of the Mueller matrix.

  • covariant_matrix: This method calculates the covariant matrix of the Mueller matrix of the object.

Parameters subclass methods
  • matrix: Gets a numpy array with all the matrices.

  • components: Extracts the four components of the Mueller matrix.

  • global_phase: Extracts the global phase introduced by the object.

  • blocks: Method that divides a mueller matrix in their blocks: mean transmission ($M_{00}$), diattenuation and polarizance vectors and small matrix m.

  • diattenuation_vector: Extracts the 3xN array of diattenuation vectors.

  • polarizance_vector: Extracts the 3xN array of polarizance vectors.

  • small_matrix: Extracts the 3x3xN array of small matrix m.

  • retardance_vector: Extracts the 3xN array of retardance vectors (if exists).

  • mean_transmission: Calculates the mean transmission coefficient.

  • transmissions: Calculates the maximum and minimum transmissions.

  • inhomogeneity: Calculates the inhomogeneity parameter.

  • diattenuation: Calculates the diattenuation of a Mueller matrix.

  • diattenuation_linear: Calculates the linear diattenuation of a Mueller matrix.

  • diattenuation_circular: Calculates the circular diattenuation of a Mueller matrix.

  • polarizance: Calculates the polarizance of a Mueller matrix.

  • polarizance_linear: Calculates the linear polarizance of a Mueller matrix.

  • polarizance_circular: Calculates the delay of the matrix.

  • degree_polarizance: Calculates the degree of polarizance.

  • spheric_purity: Calculates the spheric purity grade.

  • retardance: Calculates the retardance (also refered as delay) of the Mueller matrix of a pure retarder.

  • polarimetric_purity: Calculates the degree of polarimetric purity of a Mueller matrix.

  • depolarization_index: Calculates the depolarization_index of a Mueller matrix.

  • polarimetric_purity_indices: Calculates the polarimetric purity indices of a Mueller matrix.

  • eig: Calculates the eigenvalues and eigenstates (eigenvectors) of the Mueller matrices.

  • eigenvalues: Calculates the eigenvalues and of the Mueller matrices.

  • eigenvectors: Calculates the eigenvectors of the Mueller matrices.

  • eigenstates: Calculates the eigenstates (Stokes vectors of the eigenvectors) of the Mueller matrices.

  • det: Calculates the determinant and of the Mueller matrices.

  • trace: Calculates the trace of the Mueller matrices.

  • norm: Calculates the norm of the Mueller matrices.

  • get_all: Returns a dictionary with all the parameters of the object.

Checks subclass methods
  • is_physical: Conditions of physical realizability.

  • is_non_depolarizing / is_pure: Checks if matrix is non-depolarizing.

  • is_homogeneous: Checks if the matrix is homogeneous (eigenstates are orthogonal). It is implemented in two different ways.

  • is_retarder: Checks if the matrix M corresponds to a pure retarder.

  • is_diattenuator / is_polarizer: Checks if the matrix M corresponds to a pure homogeneous diattenuator.

  • is_depolarizer: Checks if the object corresponds to a depolarizer.

  • is_singular: Checks if the matrix is singular (at least one of its eigenvalues is 0).

  • is_symmetric: Checks if the Mueller matrices are symmetric.

  • is_eigenstate: Checks if a given light state is an eigenstate of the objct.

  • get_all: Returns a dictionary with all the checks of the object.

Analysis subclass methods
  • diattenuator: Calculates all the parameters from the Mueller Matrix of a diattenuator.

  • polarizer: Calculates all the parameters from the Mueller Matrix of a diattenuator using the polarizance vector. If the polarizer is homogeneous, this is equivalent to the previous method.

  • retarder: Calculates all the parameters from the Mueller Matrix of a retarder.

  • depolarizer: Calculates some of the parameters from the Mueller matrix of a diattenuator.

  • filter_physical_conditions: Method that filters experimental errors by forcing the Mueller matrix M to fulfill the conditions necessary for a matrix to be physicall.

  • filter_purify_number: Purifies a Mueller matrix by choosing the number of eigenvalues of the covariant matrix that will be made 0.

  • filter_purify_threshold: Purifies a Mueller matrix by making 0 the eigenvalues of the covariant matrix lower than a certain threshold.

  • decompose_pure: Polar decomposition of a pure Mueller matrix in a retarder and a diattenuator.

  • decompose_polar: Polar decomposition of a general Mueller matrix in a depolarizer, retarder and a diattenuator.

py_pol.mueller.create_Mueller(name='M', N=1, out_object=True)[source]

Method that creates several Mueller_matrix objects at the same time from a list of names or a number.

Parameters:
  • name (string or list) – Name of the object for print purposes. Default: ‘M’.

  • N (int) – Number of created elements. Default: 1.

  • out_object (bool) – If N=1 and out_object is True the output is a Jones_matrix instead of a list. Default: True.

self.parameters

Class containing the measurable parameters of the Mueller matrices.

Type:

class

self.checks

Class containing the methods that check something about the Mueller matrices.

Type:

class

Returns:

Result.

Return type:

J (list or Mueller_matrix)

py_pol.mueller.set_printoptions(N_list=None, list_spaces=None)[source]

Method that modifies the global print options parameters.

Parameters:
  • N_print_list (int) – Number of matrices that will be printed as a list if the shape of the object is 1D. Default: None

  • print_list_spaces (int) – Number of spaces between matrices if they are printed as a list. Default: None

class py_pol.mueller.Mueller(name='M')[source]

Bases: Py_pol

Class for Mueller matrices

Parameters:

name (str) – name of Mueller matrix, for string representation

M

4x4xN array of floats containing all the Mueller matrices.

Type:

np.ndarray

m00

1xN array containing the $M_{00}$ element of all Mueller matrices.

Type:

np.ndarray

D

3xN array containing the diattenuation vectors of the Mueller matrices.

Type:

np.ndarray

P

3xN array containing the polarizance vectors of the Mueller matrices.

Type:

np.ndarray

m

3xN array containing the rest of the Mueller matrices.

Type:

np.ndarray

global_phase

1xN array storing the global phase introduced by the optical objects.

Type:

np.ndarray

name

Name of the object for print purposes.

Type:

string

shape

Shape desired for the outputs.

Type:

tuple or list

size

Number of stored Mueller matrices.

Type:

int

ndim

Number of dimensions for representation purposes.

Type:

int

no_rotation

If True, rotation method do not act upon the object. Useful for objects that shouldn’t be rotated as mirrors.

Type:

bool

type

Type of the object (‘Jones_matrix’). This is used for determining the object class as using isinstance may throw unexpected results in .ipynb files.

Type:

string

self.parameters

parameters of the Mueller matrices.

Type:

class

self.checks

checks of the Mueller matrices.

Type:

class

self.analysis

analysis of the Mueller matrices.

Type:

class

property global_phase
add_global_phase(phase=0, unknown_as_zero=False, keep=False)[source]

Method that adds a phase to the Mueller object.

Parameters:
  • phase (float or np.ndarray) – Phase to be added to the Mueller object. Default: 0.

  • unknown_as_zero (bool) – If True, takes unknown phase as zero. Default: False.

  • keep (bool) – If True, self is not updated. Default: False.

Returns:

Recalculated Mueller object.

Return type:

(Mueller)

set_global_phase(phase=0, keep=False, shape_like=None, shape=None)[source]

Method that sets the phase to the Mueller object.

Parameters:
  • phase (float or np.ndarray) – Phase to be added to the Mueller object. Default: 0.

  • keep (bool) – If True, self is not updated. Default: False.

  • shape_like (float or numpy.ndarray) – Use the shape of this array. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Recalculated Mueller object.

Return type:

(Mueller)

remove_global_phase(keep=False)[source]

Method that removes the phase to the Mueller object.

Parameters:

keep (bool) – If True, self is not updated. Default: False.

Returns:

Recalculated Mueller object.

Return type:

(Mueller)

rotate(angle=0, keep=False, change_name=True)[source]

Rotates a Mueller matrix a certain angle

M_rotated = R(-angle) * self.M * R(angle)

Parameters:
  • angle (float) – angle of rotation in radians. Default: 0

  • keep (bool) – If True, the original element is not updated. Default: False.

  • change_name (bool) – If True and angle is of size 1, changes the object name adding @ XX deg, being XX the total rotation angle. Default: True.

Returns:

Mueller object rotated

Return type:

(Mueller)

covariance_matrix(keep=False, shape_like=None, shape=None, change_name=True)[source]

Calculates the covariance matrix of a Mueller matrix.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016) pp 171.

Notes

The base of matrices S is used in an uncommon order. In order to obtain the same result as in the book, the formula must be:

\[H=0.25\sum(m[i,j]\,kron([S(i),S^{*}(j))].\]
Parameters:
  • keep (bool) – If True, the original element is not updated. Default: False.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • change_name (bool) – If True, changes the object name adding Recip. of at the beggining of the name. Default: True.

Returns:

Modified object.

Return type:

(Mueller)

inverse(keep=False, shape_like=None, shape=None, change_name=True)[source]

Calculates the inverse matrix of the Mueller matrix.

Parameters:
  • keep (bool) – If True, the original element is not updated. Default: False.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • change_name (bool) – If True, changes the object name adding Recip. of at the beggining of the name. Default: True.

Returns:

Modified object.

Return type:

(Mueller)

reciprocal(keep=False, shape_like=None, shape=None, change_name=True)[source]

Calculates the reciprocal of the optical element, so the light tranverses it in the opposite direction. In Mueller formalism, it is calculated as:

\[M^{r}=\left[egin{array}{cccc} 1 & 0 & 0 & 0\ 0 & 1 & 0 & 0\ 0 & 0 & -1 & 0\ 0 & 0 & 0 & 1 \end{array}\]
ight]M^{T}left[egin{array}{cccc}

1 & 0 & 0 & 00 & 1 & 0 & 00 & 0 & -1 & 00 & 0 & 0 & 1 end{array}

ight]

References:

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 111.

Parameters:

keep (bool): If True, the original element is not updated. Default: False. shape_like (numpy.ndarray or py_pol object): Use the shape of this object. Default: None. shape (tuple or list): If no shape_like array is given, use this shape instead. Default: None. change_name (bool): If True, changes the object name adding Recip. of at the beggining of the name. Default: True.

Returns:

(Mueller): Result.

transpose(keep=False, shape_like=None, shape=None, change_name=True)[source]

Calculates the transposed matrices of the Mueller matrices.

Parameters:
  • keep (bool) – If True, the original element is not updated. Default: False.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • change_name (bool) – If True, changes the object name adding Recip. of at the beggining of the name. Default: True.

Returns:

Modified object.

Return type:

(Jones_matrix)

sum(axis=None, keep=False, change_name=True)[source]

Calculates the sum of Mueller matrices stored in the object.

Parameters:
  • axis (int, list or tuple) – Axes along which the summatory is performed. If None, all matrices are summed. Default: None

  • keep (bool) – If True, the original element is not updated. Default: False.

  • change_name (bool) – If True, changes the object name adding Recip. of at the beggining of the name. Default: True.

Returns:

Modified object.

Return type:

(Mueller)

prod(axis=None, keep=False, change_name=True)[source]

Calculates the product of Mueller matrices stored in the object.

Parameters:
  • axis (int, list or tuple) – Axes along which the product is performed. If None, all matrices are multiplied. Default: None

  • keep (bool) – If True, the original element is not updated. Default: False.

  • change_name (bool) – If True, changes the object name adding Recip. of at the beggining of the name. Default: True.

Returns:

Modified object.

Return type:

(Mueller)

from_components(components, global_phase=0, length=1, shape_like=None, shape=None)[source]

Creates the Mueller matrix object form the arrays of its 16 components components.

Parameters:
  • components (tuple or list) – A 4 element tuple containing the 6 components of the Mueller matrices (M00, M01, …, M32, M33).

  • global_phase (float or numpy.ndarray) – Adds a global phase to the object. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller_matrix)

from_matrix(M, global_phase=0, length=1, shape_like=None, shape=None)[source]

Create a Mueller object from an external array.

Parameters:
  • M (numpy.ndarray) – New matrix. At least two dimensions must be of size 4.

  • global_phase (numpy.ndarray) – Adds a global phase to the Stokes object. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

from_normalized(m, M00=None, global_phase=0, shape_like=None, shape=None)[source]

Creates a Mueller object directly from the normalized matrix $m = M/M_{00}$, and $M_{00}$.

Parameters:
  • m (4x4 numpy.matrix) – Mueller matrix

  • M00 (float) – [0, 1] Mean transmission coefficient. Default: maximum possible (None).

  • global_phase (numpy.ndarray) – Adds a global phase to the Stokes object. Default: 0.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

from_blocks(Dv=array([0., 0., 0.]), Pv=array([0., 0., 0.]), m=array([[0., 0., 0.], [0., 0., 0.], [0., 0., 0.]]), M00=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Method that creates a Mueller object from the block components of its matrix.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • Dv (numpy.ndarray) – Diattenuation vector 3xN array.

  • Pv (numpy.ndarray) – Polarizance vector 3xN array.

  • m (numpy.ndarray) – Small matrix m 3x3xN array.

  • M00 (numpy.ndarray) – Parameter of average intensity array of size N. Default: 1

  • global_phase (numpy.ndarray) – Adds a global phase to the Stokes object. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

from_Jones(J, length=1, shape_like=None, shape=None)[source]

Takes a Jones Matrix and converts into Mueller Matrix

\[M(J)=\left[egin{array}{cccc} 1 & 0 & 0 & 1\ 1 & 0 & 0 & -1\ 0 & 1 & 1 & 0\ 0 & i & -i & 0 \end{array}\]

ight]left(Jotimes J^{*} ight)left[egin{array}{cccc}

1 & 0 & 0 & 11 & 0 & 0 & -10 & 1 & 1 & 00 & i & -i & 0 end{array}

ight]^{-1}

References:

“Polarized light and the Mueller Matrix approach”, 2nd Ed., J. J. Gil and E. Ossikowski, pp 107.

Parameters:

J (Jones_matrix): Jones matrix object. length (int): If final object is of size 1, it is stretched to match this size. Default: 1. shape_like (float or numpy.ndarray): Use the shape of this array. Default: None. shape (tuple or list): If no shape_like array is given, use this shape instead. Default: None.

Returns:

(Mueller): Created object.

from_covariance(H, global_phase=0, length=1, shape_like=None, shape=None)[source]

Calculates the Mueller matrix from the covariance matrix:

$M_{ij}=Traceleft[left(sigma_{i}otimessigma_{j}^{*}

ight)H ight]$

References:

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:

H (Mueller or numpy.ndarray): Covariance matrix. global_phase (numpy.ndarray): Adds a global phase to the Stokes object. Default: 0. shape_like (numpy.ndarray or py_pol object): Use the shape of this object. Default: None. shape (tuple or list): If no shape_like array is given, use this shape instead. Default: None.

Returns:

(Mueller): Created object.

vacuum(global_phase=0, length=1, shape_like=None, shape=None)[source]

Creates the matrix for vacuum i.e., an optically neutral element.

Parameters:
  • global_phase (float or numpy.ndarray) – Adds a global phase to the Jones matrix. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

filter_amplifier(D=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Creates the Mueller object of neutral filters or amplifiers.

Parameters:
  • D (float or numpy.ndarray) – Attenuation (gain if > 1). Default: 1.

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

mirror(ref=1, ref_field=None, global_phase=0, length=1, shape_like=None, shape=None)[source]

Mueller matrix of a mirror.

Parameters:
  • ref (float or numpy.ndarray) – Intensity reflectivity of the mirror. Default: 1.

  • ref_field (float or numpy.ndarray) – Electric field reflectivity coefficient. If not None, it overrides REF. Default: None.

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

depolarizer_perfect(M00=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Creates a perfect depolarizer:

\[M_{p}=\left[egin{array}{cccc} M_{00} & 0 & 0 & 0\ 0 & d_{1} & 0 & 0\ 0 & 0 & d_{2} & 0\ 0 & 0 & 0 & d_{3} \end{array}\]

ight]

Parameters:

M00 (float, default 1): Parameter of average intensity. Default: 1. global_phase (float or numpy.ndarray): Global phase introduced by the optical element. Default: 0. length (int): If final object is of size 1, it is stretched to match this size. Default: 1. shape_like (numpy.ndarray or py_pol object): Use the shape of this object. Default: None. shape (tuple or list): If no shape_like array is given, use this shape instead. Default: None.

Returns:

(Mueller): Created object.

depolarizer_diagonal(d, M00=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Creates a diagonal depolarizer:

\[M_{p}=\left[egin{array}{cccc} M_{00} & 0 & 0 & 0\ 0 & d_{1} & 0 & 0\ 0 & 0 & d_{2} & 0\ 0 & 0 & 0 & d_{3} \end{array}\]

ight]

Parameters:

d (list, float or numpy.ndarray): Absorption coefficients. If list, it must contain three float or numpy arrays, one for each diagonal value. If float or numpy.ndarray, $d_1 = d_2 = d_3$. M00 (float, default 1): Parameter of average intensity. Default: 1. global_phase (float or numpy.ndarray): Global phase introduced by the optical element. Default: 0. length (int): If final object is of size 1, it is stretched to match this size. Default: 1. shape_like (numpy.ndarray or py_pol object): Use the shape of this object. Default: None. shape (tuple or list): If no shape_like array is given, use this shape instead. Default: None.

Returns:

(Mueller): Created object.

depolarizer_states(d, S, Dv=array([0., 0., 0.]), Pv=array([0., 0., 0.]), M00=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Creates a general depolarizer form its three eigenstates and their depolarization factors (eigenvalues), plus its polarization or polarizance vector.

Parameters:
  • d (list, float or numpy.ndarray) – Depolarization factors (eigenvalues of m). If list, it must contain three float or numpy arrays, one for each diagonal value. If float or numpy.ndarray, $d_1 = d_2 = d_3$.

  • S (list or Stokes) – Principal states. If list, it must contain three Stokes objects. If Stokes, at least one dimension must have dimension 3.

  • Dv (numpy.ndarray) – Diattenuation vector. If None, the polarizance vector is used instead. Default: None.

  • Pv (numpy.ndarray) – Polarizance vector. Used only if Dv is None. If None, the depolarizer will have zero diattenuation and polarizance. Default: None.

  • M00 (float, default 1) – Parameter of average intensity. Default: 1.

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

diattenuator_perfect(azimuth=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Mueller 4x4 matrix for a perfect diattenuator (polarizer).

Parameters:
  • azimuth (float or numpy.ndarray) – Rotation angle of the high transmission polarizer axis. Default: 0.

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

diattenuator_linear(p1=1, p2=0, Tmax=None, Tmin=None, azimuth=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Mueller matrices of pure linear homogeneous diattenuators.

\[M\left( heta=0\]

ight)= rac{1}{2}left[egin{array}{cccc}

p_{1}^{2}+p_{2}^{2} & p_{1}^{2}-p_{2}^{2} & 0 & 0p_{1}^{2}-p_{2}^{2} & p_{1}^{2}+p_{2}^{2} & 0 & 00 & 0 & 2p_{1}p_{2} & 00 & 0 & 0 & 2p_{1}p_{2} end{array}

ight]

References:

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), (4.79) - p. 143. Handbook of Optics vol 2. 22.16 (Table 1).

Parameters:

p1 (float or numpy.ndarray): Field transmission of the transmission axis. Default: 1. p2 (float or numpy.ndarray): Field transmission of the attenuation axis. Default: 0. Tmax (float or numpy.ndarray): Maximum transmission. If not None, overrides p1. Default: None. Tmin (float or numpy.ndarray): Minimum transmission. If not None, overrides p2. Default: None. azimuth (float or numpy.ndarray): Rotation angle of the high transmission polarizer axis. Default: 0. global_phase (float or numpy.ndarray): Global phase introduced by the optical element. Default: 0. length (int): If final object is of size 1, it is stretched to match this size. Default: 1. shape_like (numpy.ndarray or py_pol object): Use the shape of this object. Default: None. shape (tuple or list): If no shape_like array is given, use this shape instead. Default: None.

Returns:

(Mueller): Created object.

diattenuator_charac_angles(p1=1, p2=0, Tmax=None, Tmin=None, alpha=0, delay=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Method that calculates the most general homogenous diattenuator from diattenuator parameters with the intermediate step of calculating the diattenuation vector.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 142.

Parameters:
  • p1 (float or numpy.ndarray) – Electric field transmission coefficient of the transmission eigenstate Default: 1

  • p2 (float or numpy.ndarray) – Electric field transmission coefficient of the extinction eigenstate. Default: 0.

  • Tmax (float or numpy.ndarray) – Maximum transmission. If not None, overrides p1. Default: None.

  • Tmin (float or numpy.ndarray) – Minimum transmission. If not None, overrides p2. Default: None.

  • alpha (float or numpy.ndarray) – [0, pi/2]: tan(alpha) is the ratio between field amplitudes of X and Y components. Default: 0.

  • delay (float or numpy.ndarray) – [0, 2*pi]: phase difference between X and Y field components. Default: 0.

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

diattenuator_azimuth_ellipticity(p1=1, p2=0, Tmax=None, Tmin=None, azimuth=0, ellipticity=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Method that calculates the most general homogenous diattenuator from diattenuator parameters with the intermediate step of calculating the diattenuation vector.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 142.

Parameters:
  • p1 (float or numpy.ndarray) – Electric field transmission coefficient of the transmission eigenstate. Default: 1.

  • p2 (float or numpy.ndarray) – Electric field transmission coefficient of the extinction eigenstate. Default: 0.

  • Tmax (float or numpy.ndarray) – Maximum transmission. If not None, overrides p1. Default: None.

  • Tmin (float or numpy.ndarray) – Minimum transmission. If not None, overrides p2. Default: None.

  • azimuth (float) – [0, pi]: Azimuth. Defaut: 0

  • ellipticity (float) – [-pi/4, pi/4]: Ellipticity angle. Default: 0

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

diattenuator_vector(Dv, M00=None, global_phase=0, length=1, shape_like=None, shape=None)[source]

Method that calculates the most general homogenous diattenuator from the Diattenuation or Polarizance vector.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 142.

Parameters:
  • Dv (3xN numpy.ndarray) – Diattenuation or Polarizance vectors.

  • M00 (float or numpy.ndarray) – Parameter of average intensity. If None, the maximum possible value is used. Default: None.

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

retarder_linear(R, azimuth=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Mueller matrix of homogeneous linear retarders.

\[M\left( heta=0\]
ight)=left[egin{array}{cccc}

1 & 0 & 0 & 00 & 1 & 0 & 00 & 0 & cos(Delta) & sin(Delta)0 & 0 & -sin(Delta) & cos(Delta) end{array}

ight]

References:

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), (4.31) - p. 132 Handbook of Optics vol 2. 22.16 (Table 1).

Parameters:

R (float or numpy.ndarray): [0, pi] Retardance introduced to the slow eigenstate respect to the fast eigenstate. azimuth (float or numpy.ndarray): rotation angle of the high transmission polarizer axis. Default: 0. global_phase (float or numpy.ndarray): Global phase introduced by the optical element. Default: 0. length (int): If final object is of size 1, it is stretched to match this size. Default: 1. shape_like (numpy.ndarray or py_pol object): Use the shape of this object. Default: None. shape (tuple or list): If no shape_like array is given, use this shape instead. Default: None.

Returns:

(Mueller): Created object.

quarter_waveplate(azimuth=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Mueller matrices of ideal quarter-wave retarder.

\[M\left( heta=0\]
ight)=left[egin{array}{cccc}

1 & 0 & 0 & 00 & 1 & 0 & 00 & 0 & 0 & 10 & 0 & -1 & 0 end{array}

ight]

References:

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), (4.32) - p. 132 Handbook of Optics vol 2. 22.16 (Table 1).

Parameters:

azimuth (float or numpy.ndarray): rotation angle of the high transmission polarizer axis. Default: 0. global_phase (float or numpy.ndarray): Global phase introduced by the optical element. Default: 0. length (int): If final object is of size 1, it is stretched to match this size. Default: 1. shape_like (numpy.ndarray or py_pol object): Use the shape of this object. Default: None. shape (tuple or list): If no shape_like array is given, use this shape instead. Default: None.

Returns:

(Mueller): Created object.

half_waveplate(azimuth=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Mueller matrices of ideal half-wave retarders.

\[M\left( heta=0\]
ight)=left[egin{array}{cccc}

1 & 0 & 0 & 00 & 1 & 0 & 00 & 0 & -1 & 00 & 0 & 0 & -1 end{array}

ight]

References:

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), (4.32) - p. 132 Handbook of Optics vol 2. 22.16 (Table 1).

Parameters:

azimuth (float or numpy.ndarray): rotation angle of the high transmission polarizer axis. Default: 0. global_phase (float or numpy.ndarray): Global phase introduced by the optical element. Default: 0. length (int): If final object is of size 1, it is stretched to match this size. Default: 1. shape_like (numpy.ndarray or py_pol object): Use the shape of this object. Default: None. shape (tuple or list): If no shape_like array is given, use this shape instead. Default: None.

Returns:

(Mueller): Created object.

retarder_charac_angles(R, alpha, delay, M00=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Method that calculates the most general homogeneous retarder from the characteristic angles of the fast eigenstate. The method calculates first the retardance vector, and uses it to calculate the Mueler matrix.

References

“Polarized light and the Mueller Matrix approach”, J. J. Gil, pp 125.

Parameters:
  • R (float or numpy.ndarray) – [0, pi] Retardance introduced to the slow eigenstate respect to the fast eigenstate.

  • alpha (float or numpy.ndarray) – [0, pi]: tan(alpha) is the ratio between amplitudes of the electric field of the fast eigenstate.

  • delay (float or numpy.ndarray) – [0, 2*pi]: phase difference between both components of the electric field of the fast eigenstate.

  • M00 (float or numpy.ndarray) – Parameter of average intensity. Default: 1

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

retarder_azimuth_ellipticity(R, azimuth, ellipticity, M00=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Method that calculates the most general homogeneous retarder from azimuth and ellipticity of the fast eigenstate. The method calculates first the retardance vector, and uses it to calculate the Mueler matrix.

References

“Polarized light and the Mueller Matrix approach”, J. J. Gil, pp 125.

Parameters:
  • R (float or numpy.ndarray) – [0, pi] Retardance introduced to the slow eigenstate respect to the fast eigenstate.

  • azimuth (float or numpy.ndarray) – [0, pi]: Azimuth.

  • ellipticity (float or numpy.ndarray) – [-pi/4, pi/4]: Ellipticity angle.

  • M00 (float or numpy.ndarray) – Parameter of average intensity. Default: 1.

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

retarder_vector(Rv, R=1.5707963267948966, kind='normalized', M00=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Method that calculates the most general homogeneous retarder from the retardance vector.

References

“Polarized light and the Mueller Matrix approach”, J. J. Gil, pp 125.

Parameters:
  • Rv (3xN numpy.ndarray) – Retardance vector.

  • R (float or numpy.ndarray) – [0, pi] Retardance introduced to the slow eigenstate respect to the fast eigenstate. Default: 90 degrees.

  • kind (string) – Identifies the type of retardance vector. There are three possibilities: NORMALIZED (also called Pauli vector), STRAIGHT or COMPLETE. Default: ‘normalized’.

  • M00 (float or numpy.ndarray) – Mean transmission coefficient. If different than 1, the object won’t be a pure retarder. Default: 1.

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

diattenuator_retarder_linear(p1=1, p2=0, Tmax=None, Tmin=None, R=1.5707963267948966, azimuth=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Creates the Mueller matrices of linear diattenuator retarders with the same eigenstates for diattenuation and retardance.

\[M\left( heta=0\]

ight)= rac{1}{2}left[egin{array}{cccc}

p_{1}^{2}+p_{2}^{2} & p_{1}^{2}-p_{2}^{2} & 0 & 0p_{1}^{2}-p_{2}^{2} & p_{1}^{2}+p_{2}^{2} & 0 & 00 & 0 & 2p_{1}p_{2}cos(

arDelta) & 2p_{1}p_{2}sin( arDelta)

0 & 0 & -2p_{1}p_{2}sin(

arDelta) & 2p_{1}p_{2}cos( arDelta)

end{array}

ight]

References:

Handbook of Optics vol 2. 22.16 (Table 1).

Parameters:

p1 (float or numpy.ndarray): Field transmission of the transmission axis. Default: 1. p2 (float or numpy.ndarray): Field transmission of the attenuation axis. Default: 0. Tmax (float or numpy.ndarray): Maximum transmission. If not None, overrides p1. Default: None. Tmin (float or numpy.ndarray): Minimum transmission. If not None, overrides p2. Default: None. R (float or numpy.ndarray): [0, pi] Retardance introduced to the slow eigenstate respect to the fast eigenstate. Default: 90 degrees. azimuth (float or numpy.ndarray): rotation angle of the high transmission polarizer axis. Default: 0. global_phase (float or numpy.ndarray): Global phase introduced by the optical element. Default: 0. length (int): If final object is of size 1, it is stretched to match this size. Default: 1. shape_like (numpy.ndarray or py_pol object): Use the shape of this object. Default: None. shape (tuple or list): If no shape_like array is given, use this shape instead. Default: None.

Returns:

(Mueller): Created object.

diattenuator_retarder_azimuth_ellipticity(p1=1, p2=0, Tmax=None, Tmin=None, R=0, azimuth=0, ellipticity=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Creates the most general homogenous diattenuator retarder from the azimuth and ellipticity of the fast eigenstate.

Parameters:
  • p1 (float or numpy.ndarray) – Field transmission of the fast axis. Default: 1.

  • p2 (float or numpy.ndarray) – Electric field transmission coefficient of the extinction eigenstate. Default: 0.

  • Tmax (float or numpy.ndarray) – Maximum transmission. If not None, overrides p1. Default: None.

  • Tmin (float or numpy.ndarray) – Minimum transmission. If not None, overrides p2. Default: None.

  • R (float or numpy.ndarray) – Retardance. Default: 0.

  • azimuth (float or numpy.ndarray) – rotation angle of the high transmission polarizer axis. Default: 0.

  • ellipticity (float) – [-pi/4, pi/]: Ellipticity angle. Default: 0.

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

diattenuator_retarder_charac_angles(p1=1, p2=0, Tmax=None, Tmin=None, R=0, alpha=0, delay=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Creates the most general homogenous diattenuator retarder from the characteristic angles of the fast eigenstate.

Parameters:
  • p1 (float or numpy.ndarray) – Field transmission of the fast axis. Default: 1.

  • p2 (float or numpy.ndarray) – Electric field transmission coefficient of the extinction eigenstate. Default: 0.

  • Tmax (float or numpy.ndarray) – Maximum transmission. If not None, overrides p1. Default: None.

  • Tmin (float or numpy.ndarray) – Minimum transmission. If not None, overrides p2. Default: None.

  • R (float or numpy.ndarray) – Retardance. Default: 0.

  • alpha (float or numpy.ndarray) – [0, pi/2]: tan(alpha) is the ratio between field amplitudes of X and Y components. Default: 0.

  • delay (float or numpy.ndarray) – [0, 2*pi]: phase difference between X and Y field components. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Mueller)

general_eigenstates(E1, E2=None, p1=1, p2=0, Tmax=None, Tmin=None, R=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Creates the most general pure optical element from its eigenstates.

Parameters:
  • E1 (Jones_vector) – First eigenstate.

  • E2 (Jones_vector) – Second eigenstate. If None, E2 is taken as the perpendicular state to E1, so the optical object is homogenous. Default: None

  • p1 (float or numpy.ndarray) – Field transmission of the fast axis. Default: 1.

  • p2 (float or numpy.ndarray) – Electric field transmission coefficient of the extinction eigenstate. Default: 0.

  • Tmax (float or numpy.ndarray) – Maximum transmission. If not None, overrides p1. Default: None.

  • Tmin (float or numpy.ndarray) – Minimum transmission. If not None, overrides p2. Default: None.

  • R (float or numpy.ndarray) – Retardance. Default: 0.

  • global_phase (float or numpy.ndarray) – Global phase introduced by the optical element. Default: 0.

  • length (int) – If final object is of size 1, it is stretched to match this size. Default: 1.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

Returns:

Created object.

Return type:

(Jones_matrix)

class py_pol.mueller.Parameters_Mueller(parent)[source]

Bases: object

Class for Mueller Matrix Parameters.

Parameters:

self.parent (Mueller_matrix) – Parent object.

get_all(verbose=False, draw=False)[source]

Creates a dictionary with all the parameters of Mueller matrix.

Parameters:
  • verbose (bool) – If True, print all parameters. Default: False.

  • draw (bool) – If True, draw all plots/images of the parameters. Default: False.

matrix(shape=None, shape_like=None)[source]

Returns the numpy array of Mueller matrices.

Parameters:
  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

Returns:

(numpy.array) 4x4xN numpy array.

components(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Extracts the matrix components of the Mueller matrix.

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

array of the 0, 0 element of the matrix. M01 (numpy.ndarray): array of the 0, 1 element of the matrix. … M32 (numpy.ndarray): array of the 3, 2 element of the matrix. M33 (numpy.ndarray): array of the 3, 3 element of the matrix.

Return type:

M00 (numpy.ndarray)

mean_transmission(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Gives the mean transmission coefficients.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – if True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

diattenuation_vector(normalize=True, as_Stokes=False, shape_like=None, shape=None, verbose=False, draw=False)[source]

Gives the diattenuation vector. The first dimension will always have size 3.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • normalize (bool) – If True, normalizes the diattenuation vector to M00. Default: True.

  • as_Stokes (bool) – If True, the vectors are inside a normlized Stokes object. Default: False.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – if True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or Stokes)

polarizance_vector(normalize=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Gives the polarizance vector. The first dimension will always have size 3.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • normalize (bool) – If True, normalizes the diattenuation vector to M00. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray)

small_matrix(normalize=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Gives the small matrix m. The first two dimensions will always have size 3.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • normalize (bool) – If True, normalizes the diattenuation vector to M00. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray)

blocks(normalize=True, out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Method that gives the Mueller matrix block components: $M_{00}$ (mean transmission), $D$ (diattenuation vector), $P$ (polarizance vector) and $m$ (small matrix).

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • normalize (bool) – If True, normalizes the diattenuation vector to M00. Default: True.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Average intensity. D (numpy.ndarray): Diattenuation vectors 3xN. P (numpy.ndarray): Diattenuation vector 3xN. m (numpy.ndarray): Small m matrix 3x3xN.

Return type:

m00 (float or numpy.ndarray)

global_phase(give_nan=True, out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the phase of J00 (which is the reference for global phase in py_pol model).

Parameters:
  • give_nan (bool) – If False, NaN values are transformed into 0. Default: True.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

inhomogeneity(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the inhomogeneity parameter. This parameter is 0 for homogeneous optical elements and 1 for totally inhomogeneous (degenerate) elements.

Note: The equation of the reference shows at least an incorrect result in the diattenuator retarders.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 119.

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – if True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

diattenuation(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the diattenuation of the Mueller matrices.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, pp. 200, CRC Press (2016)

Parameters:
  • out_number (bool) – if True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

diattenuation_linear(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the linear diattenuation of the Mueller matrices.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – if True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

diattenuation_circular(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the circular diattenuation of the Mueller matrices.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – if True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

polarizance(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the polarizance of the Mueller matrices.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

polarizance_linear(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the linear polarizance of the Mueller matrices.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

polarizance_circular(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the linear polarizance of the Mueller matrices.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • out_number (bool) – if True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

degree_polarizance(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the degree of polarizance of the Mueller matrices.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

spheric_purity(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the degree of spheric purity of the Mueller matrices.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016) pp 204.

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

retardance(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the retardance of the Mueller matrix of a pure retarder.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016) pp 129.

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

polarimetric_purity(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the degree of polarimetric purity of the Mueller matrices.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

depolarization_index(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the depolarization index of the Mueller matrices.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

polarimetric_purity_indices(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the polarimetric purity indices of the Mueller matrices.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 208.

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Results.

Return type:

P1, P2, P3 (numpy.ndarray or float)

transmissions(kind='Intensity', out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculate the maximum and minimum transmitance of an optical element.

References

Handbook of Optics vol 2. 22.32 (eq.38)

Parameters:
  • kind (str) – There are three options, FIELD, INTENSITY or ALL.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Maximum intensity transmission. T_min (numpy.ndarray): Minimum intensity transmission. p1 (numpy.ndarray): Maximum field transmission. p2 (numpy.ndarray): Minimum field transmission.

Return type:

T_max (numpy.ndarray)

retardance_vector(kind='norm', shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculate the retardance of a vector.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 128-130.

Parameters:
  • kind (string) – Identifies the type of retardance vector. There are three possibilities: NORM (also called Pauli vector), STRAIGHT or COMPLETE. Default: ‘norm’.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

3xN array of the result.

Return type:

(numpy.ndarray)

eig(values_as_matrix=False, vectors_as_matrix=False, out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the eigenvalues and eigenvectors of the Mueller matrices.

Parameters:
  • values_as_matrix (bool) – If True, the eigenvalues output is a numpy.ndarray instead of a list of arrays. Default: False.

  • vectors_as_matrix (bool) – If True, the eigenvectors output is a numpy.ndarray instead of a list of arrays. Default: False.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

List with the four eigenvalues (if values_as_matrix is False) or 4xN array (if values_as_matrix is True). eigenvectors (list or numpy.ndarray): List with the four eigenvectors (if vectors_as_matrix is False) or 4x4xN array (if vectors_as_matrix is True).

Return type:

eigenvalues (list or numpy.ndarray)

eigenvectors(vectors_as_matrix=False, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the eigenvectors of the Mueller matrices.

Parameters:
  • vectors_as_matrix (bool) – If True, the eigenvectors output is a numpy.ndarray instead of a list of arrays. Default: False.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

4x4xN eigenvector matrix (if vectors_as_matrix is True). e1, e2, e3, e4 (numpy.ndarray): 4xN eigenvector matrices (if vectors_as_matrix is False).

Return type:

(numpy.ndarray)

eigenstates(shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the eigenstates of the optical object. It must be done in Jones formalism, so it is only valid for pure Mueller matrices.

Parameters:
  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

eigenstates.

Return type:

S1, S2, S3, S4 (Stokes)

eigenvalues(values_as_matrix=False, out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the eigenvalues and eigenstates of the Jones object.

Parameters:
  • values_as_matrix (bool) – If True, the eigenvalues output is a numpy.ndarray instead of a list of arrays. Default: False.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

4xN eigenvalues matrix (if values_as_matrix is True). v1, v2, v3, v4 (numpy.ndarray or float): Individual eigenvalues (if values_as_matrix is False).

Return type:

v (numpy.ndarray)

det(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the determinants of the Mueller matrices.

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray, float or complex)

trace(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the trace of the Mueller matrices.

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or float)

norm(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the Frobenius norm of the Mueller matrices.

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray, float or complex)

class py_pol.mueller.Analysis_Mueller(parent)[source]

Bases: object

Class for Analysis of Mueller Analysis

Parameters:

mueller_matrix (Mueller_matrix) – Mueller Matrix

self.marent

parent object.

Type:

Mueller

depolarizer(transmissions='all', angles='all', depolarization='all', out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates some of the parameters from the Mueller matrix of a diattenuator.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • transmissions (string) – Determines the type of transmission output, FIELD, INTENSITY or ALL. Default: All.

  • angles (string) – Determines the type of angles output, CHARAC (characteristic angles), AZIMUTH (azimuth and ellipticity) or ALL. Default: All.

  • depolarization (string) – Determines the type of depolarization information: INDEX, FACTORS or ALL. Default: All.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

trans_D, transP (list). Transmissions calculated from the diattenuation and polarizance vectors (in that order). Depending on the input parameter transmissions, it can contain the field transmissions, the intensity transmissions or both. angles_D, angles_P (list). Angles of the transmission eigenstate calculated from the diattenuation and polarizance vectors respectively. Depending on the input parameter angles, it can contain the characteristic angles, the azimuth and ellipticity, or all of them. depol (numpy.ndarray or float): Depolarization index. S (list): List with the three principal states.

diattenuator(transmissions='all', angles='all', out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates all the parameters from the Mueller Matrix of a pure homogeneous diattenuator (using the diattenuance vector). If the object is not a pure homogenous diattenuator, some parameters may be wrong.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • transmissions (string) – Determines the type of transmission output, FIELD, INTENSITY or ALL. Default: All.

  • angles (string) – Determines the type of angles output, CHARAC (characteristic angles), AZIMUTH (azimuth and ellipticity) or ALL. Default: All.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

transmissions (list). Transmissions of the diattenuator. Depending on the input parameter transmissions, it can contain the field transmissions, the intensity transmissions or both. angles (list). Angles of the transmission eigenstate. Depending on the input parameter angles, it can contain the characteristic angles, the azimuth and ellipticity, or all of them.

polarizer(transmissions='all', angles='all', out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates all the parameters from the Mueller Matrix of a pure homogeneous diattenuator (using the polarizance vector). If the object is not a pure homogenous diattenuator, some parameters may be wrong.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • transmissions (string) – Determines the type of transmission output, FIELD, INTENSITY or ALL. Default: All.

  • angles (string) – Determines the type of angles output, CHARAC (characteristic angles), AZIMUTH (azimuth and ellipticity) or ALL. Default: All.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

transmissions (list). Transmissions of the diattenuator. Depending on the input parameter transmissions, it can contain the field transmissions, the intensity transmissions or both. angles (list). Angles of the transmission eigenstate. Depending on the input parameter angles, it can contain the characteristic angles, the azimuth and ellipticity, or all of them.

retarder(angles='all', out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates all the parameters from the Mueller Matrix of a pure homogeneous retarder. If the object is not a pure homogenous retarder, some parameters may be wrong.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016)

Parameters:
  • angles (string) – Determines the type of angles output, CHARAC (characteristic angles), AZIMUTH (azimuth and ellipticity) or ALL. Default: All.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

R (np.ndarray). Retardance. angles (list). Angles of the transmission eigenstate. Depending on the input parameter angles, it can contain the characteristic angles, the azimuth and ellipticity, or all of them.

filter_purify_number(Neig=3, keep=False)[source]

Method that filters experimental errors by making zero a certain number of eigenvalues of the covariance matrix.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016) pp 226.

Parameters:
  • Neig (int) – Number of eigenvalues (1-3) of the covariant matrix to be made 0. Default: 3.

  • keep (bool) – If True, the original object won’t be altered. Default: False.

Returns:

Result.

Return type:

(Mueller)

filter_purify_threshold(threshold=0.01, keep=False)[source]

Method that filters experimental errors by making zero a certain number of eigenvalues of the covariance matrix.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016) pp 226.

Parameters:
  • threshold (float) – If eigenvalues are lower than threshold, they will be make 0. Default: 0.01.

  • keep (bool) – If True, the original object won’t be altered. Default: False.

Returns:

Result.

Return type:

(Mueller)

filter_physical_conditions(tol=1e-10, ignore_cond=None, keep=False, _counter=0)[source]

Method that filters experimental errors by forcing the Mueller matrix to fulfill the conditions necessary for a matrix to be a real optical component.

Parameters:
  • tol (float) – Tolerance in equalities.

  • ignore_cond (list) – Conditions to ignore. If False or None, no condition is ignored. Default: None.

  • keep (bool) – If True, the object is updated to the filtered result. If false, a new fresh copy is created. Default: True.

  • _counter (int) – Auxiliar variable that shouldn’t be used when calling this function from outside.

Returns:

Filtered Mueller matrix.

Return type:

Mf (4x4 matrix)

decompose_pure(decomposition='RP', give_all=False, tol=1e-06, out_number=True, shape_like=None, shape=None, verbose=False, draw=False, transmissions='all', angles='all')[source]

Polar decomposition of a pure Mueller matrix in a retarder and a diattenuator.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 151. S. Y. Lu, R. A. Chipman; “Interpretation of Mueller matrices based on polar decomposition”; J. Opt. Soc. Am. A/Vol. 13, No. 5 (1996)

Parameters:
  • decomposition (string) – string with the order of the elements: retarder (R) or diattenuator/polarizer (D or P). Default: RP.

  • give_all (bool) – If True, the dictionary of parameters will be given in the returned. Default: False.

  • tol (float) – Tolerance in equalities.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (float) – If true, the function prints out some information about the matrices.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

  • transmissions (string) – Determines the type of transmission output, FIELD, INTENSITY or ALL. Default: All.

  • angles (string) – Determines the type of angles output, CHARAC (characteristic angles), AZIMUTH (azimuth and ellipticity) or ALL. Default: All.

Returns:

Mueller matrix of the retarder. Md (Mueller): Mueller matrix of the diattenuator. param (dictionary, optional): Dictionary with all the parameters of the decomposed elements.

Return type:

Mr (Mueller)

decompose_polar(decomposition='PRD', give_all=False, tol=1e-06, out_number=True, shape_like=None, shape=None, verbose=False, draw=False, transmissions='all', angles='all', depolarization='all')[source]

Polar decomposition of a physically realizable Mueller matrix in a partial depolarizer, retarder and a diattenuator.

TODO: When the depolarizer is singular with 2 or 3 non-zero eigenvalues, the decomposed retarder is often erroneous (60-80% of the time).

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 257.

Parameters:
  • decomposition (string) – string with the order of the elements: depolarizer (P), retarder (R) or diattenuator (D). There are six possible decompositions: PRD, RDP, PDR, RDP, DRP and DPR. Default: PRD.

  • give_all (bool) – If true, the dictionary of parameters will be given in the returned. Default: False.

  • tol (float) – Tolerance in equalities.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (float) – If true, the function prints out some information about the matrices.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

  • transmissions (string) – Determines the type of transmission output, FIELD, INTENSITY or ALL. Default: All.

  • angles (string) – Determines the type of angles output, CHARAC (characteristic angles), AZIMUTH (azimuth and ellipticity) or ALL. Default: All.

  • depolarization (string) – Determines the type of depolarization information: INDEX, FACTORS or ALL. Default: All.

Returns:

Mueller matrix of the retarder. Md (Mueller): Mueller matrix of the diattenuator/polarizer. Mp (Mueller): Mueller matrix of the depolarizer. param (dictionary, optional): Dictionary with all the parameters of the decomposed elements.

Return type:

Mr (Mueller)

class py_pol.mueller.Check_Mueller(parent)[source]

Bases: object

Class for Check of Mueller Matrices

Parameters:

parent (Mueller_matrix) – Mueller Matrix

self.parent

parent object.

Type:

Mueller

get_all(verbose=False, draw=False)[source]

Creates a dictionary with all the checks of Mueller matrix.

Parameters:
  • verbose (bool) – If True, print all parameters. Default: False.

  • draw (bool) – If True, draw all plots/images of the parameters. Default: False.

is_physical(tol=1e-06, give_all=False, ignore_cond=None, out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

A Mueller matrix must fulfill several conditions in order to be physically realizable:

1. $M_{ij}inmathbb{R}$ for i, j = 0, 1, 2 and 3. 2a. $M_{00} geq 0$. 2b. $M_{00} leq 1$ (except in active media). 3. $M_{00}geq abs(M_{ij})$ for i, j = 0, 1, 2 and 3. 4a. $D leq 1$ 4a. $P leq 1$. 5a. $M_{00} (1 + D) leq 1$ (except in active media). 5b. $M_{00} (1 + P) leq 1$ (except in active media). 6. $Tr(M*M^T)leq 4(M_{00})^2$. 7a. $M_{00}^{2}left(1-D

ight)^{2}geqmathop{sum_{i=1}^{3}M_{0i}^{2}left(1-sum_{j=1}^{3} rac{M_{ij}}{M_{00}D} ight)}^{2}$.

7b. $M_{00}^{2}left(1-P

ight)^{2}geqmathop{sum_{i=1}^{3}M_{i0}^{2}left(1-sum_{j=1}^{3} rac{M_{ji}}{M_{00}P} ight)}^{2}$.

8a. $lambda_{i}inmathbb{R}$ 8b. $lambda_{i} geq 0$. 8c. $lambda_{i} leq 1$ (except in active media).

Being D the diattenuation, P the polarizance and $lambda_{i}$ the eigenvalues of the covariance matrix.

References:

Handbook of Optics vol 2. 22.34 (There is an errata in the equation equivalent to condition 7). “Polarized light and the Mueller Matrix approach”, J. J. Gil, pp 187.

Parameters:

tol (float): Tolerance in conditions. Default: tol_default. give_all (bool): If True, the method also gives a list with the individual conditions. Default: False. ignore_cond (list): Conditions to ignore. If False or None, no condition is ignored. Default: None. out_number (bool): If True and the result is a 1x1 array, return a number instead. Default: True. shape_like (numpy.ndarray or py_pol object): Use the shape of this object. Default: None. shape (tuple or list): If no shape_like array is given, use this shape instead. Default: None. verbose (bool): If True prints the parameter. Default: False. draw (bool): If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

cond (numpy.ndarray or bool): Result. partial_conditions (list): List with the partial conditions.

is_non_depolarizing(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Checks if matrix is pure, i.e., is non-depolarizing (the degree of polarimetric purity must be 1).

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or bool)

is_pure(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Checks if matrix is pure, i.e., is non-depolarizing (the degree of polarimetric purity must be 1).

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or bool)

is_homogeneous(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Checks if the matrix is homogeneous, i.e., its two eigenstates are perpendicular. If true, the inhomogeneity parameter must be 0.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 119.

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or bool)

is_retarder(give_all=False, out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Checks if the matrix M corresponds to a pure retarder.There are three conditions:

  1. Is physical

  2. Is pure

  3. Diatteunation = 0.

  4. Polarizance = 0.

  5. M must be unitary ($M^{T}=M^{-1}$).

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 129.

Parameters:
  • give_all (bool) – If True, the method also gives a list with the individual conditions. Default: False.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result. partial_conditions (list): List with the partial conditions (if give_all is True).

Return type:

cond (numpy.ndarray or bool)

is_diattenuator(give_all=False, out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Checks if the matrix M corresponds to a pure homogeneous diattenuator. It must fullfill several conditions:

  1. Is physical

  2. Is pure

  3. Diattenuation > 0.

  4. $M = M^T$.

  5. The eigenstates of M are the Stokes vectors (1, D) and (1, -D).

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 142.

Parameters:
  • give_all (bool) – If True, the method also gives a list with the individual conditions. Default: False.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result. partial_conditions (list): List with the partial conditions (if give_all is True).

Return type:

cond (numpy.ndarray or bool)

is_polarizer(*args, **kwargs)[source]

Checks if the matrix M corresponds to a pure homogeneous polarizer (diattenuator). It must fullfill several conditions:

  1. Is physical

  2. Is pure

  3. Polarizance > 0.

  4. $M = M^T$.

  5. The eigenstates of M are the Stokes vectors (1, P) and (1, -P).

Note: This method is the same as is_diattenuator.

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 142.

Parameters:
  • give_all (bool) – If True, the method also gives a list with the individual conditions. Default: False.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result. partial_conditions (list): List with the partial conditions.

Return type:

cond (numpy.ndarray or bool)

is_depolarizer(give_all=False, out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Checks if the matrix M corresponds to a depolarizer. It must fullfill several conditions:

  1. Is physical

  2. Depolarization index > 0.

  3. $m = m^T$ (m being the small m matrix).

References

    1. Lu, R. A. Chipman; “Interpretation of Mueller matrices based on polar decomposition”; J. Opt. Soc. Am. A/Vol. 13, No. 5 (1996)

Parameters:
  • give_all (bool) – If True, the method also gives a list with the individual conditions. Default: False.

  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result. partial_conditions (list): List with the partial conditions.

Return type:

cond (numpy.ndarray or bool)

is_singular(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Checks if the matrix is singular (det(M) = 0).

References

J.J. Gil, R. Ossikovsky “Polarized light and the Mueller Matrix approach”, CRC Press (2016), pp 282.

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or bool)

is_symmetric(out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Determines if the object matrix is symmetric (i.e. $$M = M^T$$).

Parameters:
  • out_number (bool) – If True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – If True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or bool)

is_eigenstate(S, out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Determines if the vector S is an eigenstate of the object.

Parameters:
  • S (Stokes or Jones_vector) – State to test.

  • out_number (bool) – if True and the result is a 1x1 array, return a number instead. Default: True.

  • shape_like (numpy.ndarray or py_pol object) – Use the shape of this object. Default: None.

  • shape (tuple or list) – If no shape_like array is given, use this shape instead. Default: None.

  • verbose (bool) – if True prints the parameter. Default: False.

  • draw (bool) – If True and the object is a 1D or 2D, plot it. Default: False.

Returns:

Result.

Return type:

(numpy.ndarray or bool)