crystalpy.polarization package

Submodules

crystalpy.polarization.CrystalPhasePlate module

Represents a Phase Plate by a perfect crystal.

class crystalpy.polarization.CrystalPhasePlate.CrystalPhasePlate(intensity_sigma, phase_sigma, intensity_pi, phase_pi, inclination_angle=0.0)[source]

Bases: MuellerMatrix

Constructor.

Parameters:
  • intensity_sigma (float) – intensity sigma

  • phase_sigma (float) – phase sigma

  • intensity_pi (float) – intensity pi

  • phase_pi (float) – phase pi

  • incoming_stokes_vector (StokesVector instance) – the Stokes vectoR.

  • inclination_angle (float, optional) – The inclination angle in rad.

crystalpy.polarization.MuellerDiffraction module

Represents Mueller diffraction setup.

class crystalpy.polarization.MuellerDiffraction.MuellerDiffraction(diffraction_result, incoming_stokes_vector, inclination_angle=0.0)[source]

Bases: object

Constructor.

Parameters:
  • diffraction_result (DiffractionResult instance) – result of the diffraction.

  • incoming_stokes_vector (StokesVector instance) – the Stokes vectoR.

  • inclination_angle (float, optional) – the inclination angle in rad.

See also

crystalpy.diffraction.DiffractionResults.DiffractionResults

calculate_stokes()[source]

Calculates the outgoing Stokes vectors (deviation).

Return type:

MuellerResult instance

crystalpy.polarization.MuellerMatrix module

Represents a Mueller matrix. See, e.g., https://en.wikipedia.org/wiki/Mueller_calculus

class crystalpy.polarization.MuellerMatrix.MuellerMatrix(matrix=array([[0., 0., 0., 0.], [0., 0., 0., 0.], [0., 0., 0., 0.], [0., 0., 0., 0.]]))[source]

Bases: object

Constructor.

Parameters:

matrix – Matrix as a numpy array (4,4).

calculate_stokes_vector(incoming_stokes_vector)[source]

Takes an incoming Stokes vector, multiplies it by a Mueller matrix and gives an outgoing Stokes vector as a result.

Parameters:

incoming_stokes_vector (StokesVector instance) – The incoming vector.

Returns:

The resulting stokes vector.

Return type:

StokesVector instance

from_matrix_to_elements(return_numpy=True)[source]

Returns a list of flatten numpy array with the elements of a given matrix. If a list is needed one can use the numpy.array.tolist() method.

Parameters:

return_numpy (boolean, optional) – if True returns numpy.ndarray, if False returns list. (Default value = True)

Returns:

[m00, m01, m02….mN0, mN1, mN2…]

Return type:

numpy array or list

get_matrix()[source]

Returns the muller matric (reference, not copied).

classmethod initialize_as_filter(transmission=1.0)[source]

Creare a MuellerMatrix instance with a quarter wave plate with a filter.

Parameters:

transmission (float, optional) – The transmission value. (Default value = 1.0)

classmethod initialize_as_general_linear_polarizer(theta=0.0)[source]

Creates a MuellerMatrix instance with a linear polarized.

Parameters:

theta (float, optional) – The the angle of the fast axis in rad. (Default value = 0.0)

classmethod initialize_as_general_linear_retarder(theta=0.0, delta=0.0)[source]

Creates a MuellerMatrix instance with a phase retarder.

Parameters:
  • theta (float, optional) – The the angle of the fast axis in rad. (Default value = 0.0)

  • delta (float, optional) – The phase difference between the fast and slow axis in rad. (Default value = 0.0)

classmethod initialize_as_half_wave_plate()[source]

Creare a MuellerMatrix instance with a half wave plate.

classmethod initialize_as_ideal_mirror()[source]

Creare a MuellerMatrix instance with a quarter wave plate with an ideal mirror.

classmethod initialize_as_linear_polarizer_horizontal()[source]

Creates a MuellerMatrix instance with a horizontal linear polarized.

classmethod initialize_as_linear_polarizer_minus45()[source]

Creates a MuellerMatrix instance with a -45 deg linear polarized.

classmethod initialize_as_linear_polarizer_plus45()[source]

Creates a MuellerMatrix instance with a +45 deg linear polarized.

classmethod initialize_as_linear_polarizer_vertical()[source]

Creates a MuellerMatrix instance with a vertical linear polarized.

classmethod initialize_as_quarter_wave_plate_fast_horizontal()[source]

Creare a MuellerMatrix instance with a quarter wave plate with fast axis horizontal.

classmethod initialize_as_quarter_wave_plate_fast_vertical()[source]

Creare a MuellerMatrix instance with a quarter wave plate with fast axis vertical.

matrix_by_scalar(scalar)[source]

Multiplies the matrix by a scalar.

Parameters:

scalar – the scalar factor.

Returns:

the new Mueller matrix.

Return type:

MullerMatric instance

matrix_by_vector(vector, return_numpy=True)[source]

Multiplies the matrix by a vector.

Parameters:
  • vector (numpy array) – the vector factor.

  • return_numpy – if True returns numpy.ndarray, if False returns list. (Default value = True)

Returns:

matrix * vector.

Return type:

numpy array

mueller_times_mueller(matrix_2, mod=False)[source]

Multiplies two Mueller matrices.

Parameters:
  • matrix_2 – Mueller matrix factor.

  • mod (boolean, optional) – matrix multiplication is not commutative -> mod controls which of the two matrices is the first factor. (Default value = False, matrix_2 * mueller)

Returns:

matrix * matrix_2 if mof=True matrix_2 * matrix if mof=false

Return type:

MuellerMatrix instance

set_general_linear_polarizer(theta)[source]

Sets the Muller matrix as a linear polarizer. See [rt].

Parameters:

theta (float) – the angle of the fast axis in rad

References

set_general_linear_retarder(theta, delta=0.0)[source]

Sets the Muller matrix as a generic line retarder. See [rg].

Parameters:
  • theta (float) – angle of fast axis in rad

  • delta – phase difference in rad between the fast and slow axis in rad (Default value = 0.0)

References

vector_by_matrix(vector, return_numpy=True)[source]

Multiplies a vector by the Muller matrix.

Parameters:
  • vector (numpy array) – the vector factor.

  • return_numpy (boolean, optional) – if True returns numpy.ndarray, if False returns list. (Default value = True)

Returns:

vector * matrix.

Return type:

numpy array

crystalpy.polarization.MuellerResult module

Represents Mueller calculation results.

class crystalpy.polarization.MuellerResult.MuellerResult(diffraction_result)[source]

Bases: object

Constructor.

Parameters:

diffraction_result (DiffractionResult instance) – result of the diffraction.

See also

crystalpy.diffraction.DiffractionResults.DiffractionResults

add(energy, deviation, stokes_vector)[source]

Adds a diffraction result for a given energy and deviation.

Parameters:
  • energy (float) – The energy in eV

  • deviation (float) – The deviation angle in rad.

  • stokes_vector (StokesVector instance) – The stokes vector

angle_deviations()[source]

Returns the angle deviations used for these results.

Returns:

Angle deviations used for these results.

Return type:

numpy array

energies()[source]

Returns the energies used for these results.

Returns:

The array with energies in eV

Return type:

numpy array

polarization_degree_by_deviation(deviation)[source]

Returns the degree of circular polarization for a given deviation.

Parameters:

deviation – Deviation corresponding to the returned degree of circular polarization.

Returns:

degree of circular polarization.

Return type:

float

polarization_degree_by_energy(energy)[source]

Returns the degree of circular polarization.

Parameters:

energy (float) – Energy corresponding to the returned circular polarization value.

Returns:

degree of circular polarization.

Return type:

float

s0_by_deviation(deviation)[source]

Returns the S0 Stokes parameter for a given deviation value.

Parameters:

deviation (float) – Deviation corresponding to the returned S0.

Returns:

S0.

Return type:

float

s0_by_energy(energy)[source]

Returns the S0 Stokes parameter.

Parameters:

energy (float) – Energy corresponding to the returned S0.

Returns:

S0.

Return type:

Stokesvector instance.

s1_by_deviation(deviation)[source]

Returns the S1 Stokes parameter for a given deviation value.

Parameters:

deviation (float) – Deviation corresponding to the returned S1.

Returns:

S1.

Return type:

float

s1_by_energy(energy)[source]

Returns the S1 Stokes parameter.

Parameters:

energy (float) – Energy corresponding to the returned S1.

Returns:

S1.

Return type:

Stokesvector instance.

s2_by_deviation(deviation)[source]

Returns the S2 Stokes parameter for a given deviation value.

Parameters:

deviation (float) – Deviation corresponding to the returned S2.

Returns:

S2.

Return type:

float

s2_by_energy(energy)[source]

Returns the S2 Stokes parameter.

Parameters:

energy (float) – Energy corresponding to the returned S2.

Returns:

S2.

Return type:

Stokesvector instance.

s3_by_deviation(deviation)[source]

Returns the S0 Stokes parameter for a given deviation value.

Parameters:

deviation (float) – Deviation corresponding to the returned S3.

Returns:

S3.

Return type:

float

s3_by_energy(energy)[source]

Returns the S3 Stokes parameter.

Parameters:

energy (float) – Energy corresponding to the returned S3.

Returns:

S3.

Return type:

Stokesvector instance.

Module contents