1.2. py_pol.jones_vector module

Jones_vector objects describe light polarization states in the Jones formalism.

Class fields
  • M: 2xN array containing all the Jones vectors.

  • name: Name of the object for print purposes.

  • shape: Shape desired for the outputs.

  • size: Number of stores Jones vectors.

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

  • parameters: Object of class Parameters_Jones_vector.

  • checks: Object of class Checks_Jones_vector.

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 Jones_vector object directly from the electric field components $E_x$ and $E_y$.

  • from_matrix: Creates a Jones_vector object directly from a 2 x shape numpy array.

  • from_list: Creates a Jones_vector object directly from a list of 2 or 2x1 numpy arrays.

  • from_distribution: Creates a Jones vector from the temporal evolution of the electric field components.

  • from_Stokes: Creates a Jones vector from a Stokes object. Take into account that only pure (totally polarized) Stokes vectors must be transformed to Jones vectors, and thet even for them, the global phase might be unknown.

  • linear_light: Creates a state of linear polarization with the desired angle.

  • circular_light: Creates a state of circular polarization.

  • eliptical_light: Creates a state of eliptical polarization.

  • general_azimuth_ellipticity: Creates a Jones vector from the azimuth, ellipticity and amplitude parameters.

  • general_charac_angles: Creates a Jones vector from the characteristic angles and amplitude parameters.

Manipulation methods
  • simplify: Simplifies the Jones vector in several ways.

  • rotate: Rotates the Jones vector.

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

  • reciprocal: Calculates the Jones vector that propagates backwards.

  • orthogonal: Calculates the orthogonal Jones vector.

  • normalize: Normalize the electric field to be normalized in electric field amplitude or intensity.

  • rotate_to_azimuth: Rotates the Jones vector to have a certain azimuth.

  • remove_global_phase: Calculates the global phase of the electric field (respect to the X component) and removes it.

  • add_global_phase: Adds a global phase to the Jones vector.

  • set_global_phase: Sets the global phase of the Jones vector.

  • add_delay: Adds a phase to the Y component of the electric field of the Jones vector.

Drawing methods
  • draw_ellipse: Draws the polarization ellipse of the Jones vector.

  • draw_poincare: Draws the light state in the Poincare sphere.

Parameters subclass methods
  • matrix: Gets a numpy array with all the vectors (similat to object.M).

  • components: Calculates the electric field components of the Jones vector.

  • amplitudes: Calculates the electric field amplitudes of the Jones vector.

  • intensity: Calculates the intensity of the Jones vector.

  • irradiance: Calculates the irradiance of the Jones vector.

  • alpha: Calculates the ratio between electric field amplitude angle ($|E_x|$/$|E_y|$).

  • delay / delta: Calculates the delay (phase shift) between Ex and Ey components of the electric field.

  • charac_angles: Calculates both alpha and delay, the characteristic angles of the Jones vector.

  • azimuth: Calculates azimuth, that is, the orientation angle of the major axis.

  • ellipticity_angle: Calculates the ellipticity angle.

  • azimuth_ellipticity: Calculates both azimuth and ellipticity angles.

  • ellipse_axes: Calculates the length of major and minor axis (a,b).

  • ellipticity_param: Calculates the ellipticity parameter, b/a.

  • eccentricity: Calculates the eccentricity, the complementary of the ellipticity parameter.

  • global_phase: Calculates the global phase of the Jones vector (respect to the X component of the electric field).

  • degree_linear_polarization: Calculates the degree of linear polarization of the Jones vector.

  • degree_circular_polarization: Calculates the degree of circular polarization of the Jones vector.

  • norm: Calculates the norm of the Jones vector (same as intensity for Jones vectors).

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

Checks subclass methods
  • is_linear: Checks if the Jones vector is lienarly polarized.

  • is_circular: Checks if the Jones vector is circularly polarized.

  • is_right_handed: Checks if the Jones vector rotation direction is right handed.

  • is_left_handed: Checks if the Jones vector rotation direction is left handed.

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

Auxiliar functions
  • create_Jones_vectors: Function to create several Jones_vector objects at once.

py_pol.jones_vector.create_Jones_vectors(name='E', N=1, out_object=True)[source]

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

Parameters:
  • name (str, list or tuple) – name of vector for string representation. If list or tuple, it also represents the number of objects to be created.

  • N (int) – Number of elements to be created. This parameter is overrided if name is a list or tuple. Defeult: 1.

  • out_object (bool) – If True and the result is a list of length 1, return a Jones_vector object instead. Default: True.

Returns:

List of Jones vectors

Return type:

E (Jones_vector or list)

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

Function 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 ofspaces between matrices if they are printed as a list. Default: None

class py_pol.jones_vector.Jones_vector(name='E')[source]

Bases: Py_pol

Class for Jones vectors.

Parameters:
  • M (np.ndarray) – 2xN array containing all the Jones vectors.

  • name (string) – Name of the object for print purposes.

  • shape (tuple or list) – Shape desired for the outputs.

  • size (int) – Number of stores Jones vectors.

  • ndim (int) – Number of dimensions for representation purposes.

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

self.parameters

Class containing the measurable parameters of the Jones vectors.

Type:

class

self.checks

Class containing the methods that check something about the Jones vectors.

Type:

class

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

Rotates a jones vector a certain angle.

M_rotated = rotation_matrix_Jones(-angle) * self.M

Parameters:
  • angle (float) – Rotation angle 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:

Rotated object.

Return type:

(Jones_vector)

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

Calculates the recirpocal of the Jones vector, so the light is propagated in the opposite direction. It is calculated as Ey = -Ey.

References

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

Parameters:
  • 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:

Reciprocal Jones matrix.

Return type:

(Jones_vector)

orthogonal(keep=False, change_name=True)[source]

Calculates the orthogonal of the Jones vector.

References

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

Parameters:
  • 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:

Reciprocal Jones matrix.

Return type:

(Jones_vector)

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

Calculates the sum of Jones vectors stored in the object.

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

  • 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:

(Jones_vector)

normalize(kind='amplitude', keep=False)[source]

Function that normalizes the Jones vectors in amplitude or intensity.

Parameters:
  • kind (string) – Field amplitude or intensity. Default: AMPLITUDE.

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

Returns:

Normalized Jones vector.

Return type:

(Jones_vector)

rotate_to_azimuth(azimuth=0, keep=False)[source]

Function that rotates the Jones vector to have a certain azimuth.

Parameters:
  • azimuth (string or np.ndarray) – Azimuth of the Jones vector. ‘X’, ‘Y’, ‘-X’ and ‘-Y’ are the same as 0, 90, 180 and 270 degrees respectively. Default: 0.

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

Returns:

Jones vector rotated.

Return type:

(Jones_vector)

remove_global_phase(keep=False)[source]

Function that transforms the Jones vector removing the global phase, so the first component of the electric field is real and positive.

Parameters:

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

Returns:

Recalculated Jones vector.

Return type:

(Jones_vector)

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

Function that adds a phase to the Jones vector.

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

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

Returns:

Recalculated Jones vector.

Return type:

(Jones_vector)

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

Function that sets the phase of the Jones vector.

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

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

Returns:

Recalculated Jones vector.

Return type:

(Jones_vector)

add_delay(delay=0, keep=False)[source]

Function that adds a phase to the Y component of the electric field of the Jones vector.

Parameters:
  • delay (float or np.ndarray) – Phase to be added to the Y component of the Jones vector. Default: 0.

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

Returns:

Recalculated Jones vector.

Return type:

(Jones_vector)

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

Draws polarization ellipse of Jones vector.

Parameters:
  • E (Jones_vector or Stokes) – Light object.

  • N_angles (int) – Number of angles to plot the ellipses. Default: 91.

  • filename (str) – name of filename to save the figure.

  • figsize (tuple) – A tuple of length 2 containing the figure size. Default: (8,8).

  • limit (float) – limit for drawing. If empty, it is obtained from amplitudes.

  • draw_arrow (bool) – If True, draws an arrow containing the turning sense of the polarization. Does not work with linear polarization vectors. Default: True.

  • depol_central (bool) – If True, draws a central circle containing the unpolarized field amplitude. Default: False.

  • depol_contour (bool) – If True, draws a line enveloping the polarization ellipse in order to plot the depolarization. Default: False.

  • depol_prob (bool) – If True, plots the probability distribution of the electric field. Default: False.

  • subplots (string, tuple or None) – If AS_SHAPE, divides the figure in several subplots as the shape of the py_pol object. If INDIVIDUAL, each vector is represented in its own subaxis, trying to use a square grid. If tuple, divides the figure in that same number of subplots. If None, all ellipses are plot in the same axes. Default: None.

  • N_prob (int) – Number of points in each dimension for probability distributions. Default: 256.

  • contour_levels (float, np.ndarray, tuple or list) – Contains the contour levels (normalized to 1). Default: 0.9.

  • cmap (str or color object) – Default colormap for probability distributions. Default: hot.

Returns:

handle to axis. fig (handle): handle to figure.

Return type:

ax (handle)

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

“Draws jones vector in the Poincare sphere.

Parameters:
  • S (Jones_vector or Stokes) – Object to be represented.

  • fig (plotly.graph_objects.Figure) – Figure to plot the data. Default: None

  • figsize (2-element iterable) – Figure size. Default: (6,6)

  • draw_axes (bool) – If True, it draws the three axes of the Poincare space. Default: True

  • draw_guides (bool) – If True, it draws the circles of S1, S2 and S3 = 0. Default: True

  • kind (str) – Choose between ‘scatter’, ‘line’, ‘scatterline’ or ‘surf’ to represent the data. If surf, the object must be 2D, 3D or 4D. Else, it must be 0D, 1D, 2D or 3D. Default: ‘scatter’.

  • depol (bool) – If True, the depolarization is taking into account for scatter and line plots shrinking the radius below 1. Default: False.

  • param (str, np.ndarray or None) – If str, parameter to use as information for the color. Must be a method of Parameters class which returns a single variable. If np.ndarray, must have the same shape as S. Default: None.

  • subplots (bool) – If True, it tries to use the first two dimensions as rows and columns. If method == ‘surf’, this is mandatory. Default: False.

  • in_degrees (bool) – If True, transforms the parameters to degrees. Default: False.

  • log (bool) – If True, it calculates it in logarithmic scale. Default: False.

  • hover (str) – Choose between ‘components’ (S1, S2, S3) or ‘angles’ (azimuth, ellipticity). Default: ‘components’.

  • colormap (str) – Colormap of the plots. Default: ‘Blackbody’.

  • show_fig (bool) – If True, the figure is inmediately plotted. Default: False.

Returns:

Plotly figure.

Return type:

fig (go.Figure)

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

Creates the Jones vector object form the arrays of electric field components.

Parameters:
  • Ex (numpy.array, float or 2x1 tuple/list) – Electric field amplitude along x axis. This variable can also be a 2x1 tuple or list containing both Ex and Ey.

  • Ey (numpy.array or float) – Electric field amplitude along y axis. Default: None.

  • global_phase (float or numpy.ndarray) – Adds a global phase to the Jones vector. 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_vector)

from_matrix(M, shape_like=None, shape=None)[source]

Create a Jones vector from an external matrix.

Parameters:
  • M (numpy.ndarray or float) – New matrix.

  • 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_vector)

from_distribution(Ex, Ey, ind_d=-1, method='direct', N_periods=1, shape_like=None, shape=None)[source]

Determine Jones vector from a temporal or spatial electric field distribution [(Ex(t), Ey(t)].

Parameters:
  • Ex (numpy.ndarray or float) – X component of the electric field.

  • Ey (numpy.ndarray or float) – Y component of the electric field.

  • ind_d (int) – Index of the spatial or temporal dimension. Default: -1.

  • method (string) – Method for calculating the field amplitude and delay: DIRECT or FIT. Default: direct.

  • N_periods (float) – Number of periods in the representation data. It is used by the fit algorithm (real case only) for calculating the frequency. If the value is not exact, convergency may decrease. 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_vector)

from_Stokes(S, shape_like=None, shape=None, verbose=False)[source]

Create a Jones vector from a Stokes vector. This operation is only meaningful for pure (totally polarized) Stokes vectors. For the rest of them, only the polarized part is transformed, and a warning is printed.

Parameters:
  • S (Stokes) – Stokes vector object.

  • 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.

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

Returns:

Created object.

Return type:

(Jones_vector)

linear_light(amplitude=None, azimuth=0, intensity=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Jones vector for polarizer linear light.

Parameters:
  • amplitude (numpy.array or float) – Array of electric field amplitude. Overrides inetnsity if it is different than None. Default: None.

  • azimuth (numpy.array or float) – Array of azimuths. Default: 0.

  • intensity (numpy.array or float) – Array of intensity. Default: 1.

  • global_phase (float or numpy.ndarray) – Adds a global phase to the Jones vector. 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_vector)

circular_light(kind='d', amplitude=None, intensity=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Jones vector for polarizer circular light

Parameters:
  • kind (str) – ‘d’,’r’ - right, dextro. ‘l’, ‘i’ - left, levo.

  • amplitude (numpy.array or float) – Array of electric field amplitude. Overrides intensity if it is different than None. Default: None.

  • intensity (numpy.array or float) – Array of intensity. Default: 1.

  • global_phase (float or numpy.ndarray) – Adds a global phase to the Jones vector. 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_vector)

elliptical_light(a=1, b=1, kind='r', azimuth=0, global_phase=0, length=1, shape_like=None, shape=None)[source]

Jones vector of the most general light calculated from the polarization ellipse parameters.

Parameters:
  • a (numpy.array or float) – Array of electric amplitude of x axis. Default: 1.

  • b (numpy.array or float) – Array of electric amplitude of y axis. Default: 1.

  • kind (str) – ‘d’,’r’ - right, dextro. ‘l’, ‘i’ - left, levo.

  • azimuth (numpy.array or float) – Angle of the a axis respect to the x axis. Default: 0.

  • global_phase (float or numpy.ndarray) – Adds a global phase to the Jones vector. 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_vector)

general_azimuth_ellipticity(azimuth=0, ellipticity=0, amplitude=None, intensity=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Jones vector from azimuth, ellipticity angle and amplitude parameters.

References

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

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

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

  • amplitude (numpy.array or float) – Array of electric field amplitude. Overrides inetnsity if it is different than None. Default: None.

  • intensity (numpy.array or float) – Array of intensity. Default: 1.

  • global_phase (float or numpy.ndarray) – Adds a global phase to the Jones vector. 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_vector)

general_charac_angles(alpha=0, delay=0, amplitude=None, intensity=1, global_phase=0, length=1, shape_like=None, shape=None)[source]

Jones vector from characteristic angles and amplitude parameters.

References

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

Parameters:
  • alpha (numpy.ndarray or float) – Ratio between amplitude of components Ex/Ey of electric field. Default:0

  • delay (numpy.ndarray or float) – Phase delay between Ex and Ey components of the electric field. Default: 0.

  • amplitude (numpy.array or float) – Array of electric field amplitude. Overrides inetnsity if it is different than None. Default: None.

  • intensity (numpy.array or float) – Array of intensity. Default: 1.

  • global_phase (float or numpy.ndarray) – Adds a global phase to the Jones vector. 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_vector)

class py_pol.jones_vector.Parameters_Jones_Vector(Jones_vector)[source]

Bases: object

Class for Jones vector parameters.

Parameters:

jones_vector (Jones_vector) – Jones Vector

self.parent
Type:

Jones_vector

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

Creates a dictionary with all the parameters of Jones vector.

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

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

Returns:

Dictionary with parameters of Jones vector.

Return type:

(dict)

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

Returns the numpy array of Jones vectors.

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:

2xN numpy array.

Return type:

(numpy.ndarray)

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

Calculates the x and y field components of the Jones vector.

Parameters:
  • give_Ez (bool) – If True, it returns the z component of the electric field (all values will be 0). 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:

Array of electric field along x axis. Ey (numpy.ndarray or float): Array of electric field along y axis. Ez (numpy.ndarray, optional): Array of electric field along z axis.

Return type:

Ex (numpy.ndarray or float)

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

Calculates the x and y field amplitudes of the Jones vector.

Parameters:
  • give_Ez (bool) – If True, it returns the z component of the electric field (all values will be 0). 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:

Array of electric field amplitude along x axis. E0y (numpy.ndarray or float): Array of electric field amplitude along y axis. E0z (numpy.array, optional): Array of electric field amplitude along z axis.

Return type:

E0x (numpy.ndarray or float)

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

Calculates the norm of the Jones vectors.

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:

Norm of Jones vectors.

Return type:

norma (numpy.ndarray or float)

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

Calculates the intensity of the Jones vector.

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 intensities.

Return type:

intensity (numpy.ndarray or float)

irradiance(n=1, out_number=True, shape_like=None, shape=None, verbose=False, draw=False)[source]

Calculates the irradiance of the Jones vector.

Parameters:
  • n (float) – Refractive index of the medium. Default: 1

  • 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 irradiance.

Return type:

irradiance (numpy.ndarray or float)

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

Calculates the angle ratio between amplitude of components Ex/Ey of electric field.

References

  1. Golstein “Polarized light” 2nd ed Marcel Dekker (2003), 3.4 eq.3-35

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 electric field amplitude in x axis. E0y (numpy.ndarray or float): Array of the electric field amplitude in y axis.

Return type:

E0x (numpy.ndarray or float)

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

Calculates the delay (phase shift) between Ex and Ey components of the electric field.

References

  1. Golstein “Polarized light” 2nd ed Marcel Dekker (2003), 3.4 eq.3-33b.

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 delay angles.

Return type:

(numpy.ndarray or float) [0, 2*pi]

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

Calculates the delay (phase shift) between Ex and Ey components of the electric field. It is the same method as delay.

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 delay angles.

Return type:

delta (numpy.ndarray or float) [0, 2*pi]

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

Calculates the characteristic angles (alpha and delay) of a Jones vector.

References

  1. Golstein “Polarized light” 2nd ed Marcel Dekker (2003), 3.4 eq.3-33b.

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:

[0, pi/2]: Array of alpha angles. delay (numpy.ndarray or float): [0, 2*pi]: Array of delay angles.

Return type:

alpha (numpy.ndarray or float)

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

Calculates azimuth, that is, the orientation of the major axis.

References

    1. Gil, “Polarized light and the Mueller Matrix approach”, pp 137.

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:

[0, pi]: Array of azimuth angles.

Return type:

azimuth (numpy.ndarray or float)

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

Calculates the ellipticity angle.

References

    1. Gil, “Polarized light and the Mueller Matrix approach”, pp 137.

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 ellipticity angles.

Return type:

ellipticity (numpy.ndarray or float) [-pi/4, pi/4]

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

Calculates the azimuth and ellipticity angle of a Jones vector.

References

    1. Gil, “Polarized light and the Mueller Matrix approach”, pp 137.

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:

[0, pi]: Array of azimuth angles. ellipticity (numpy.ndarray or float) [-pi/4, pi/4]: Array of ellipticity angles.

Return type:

azimuth (numpy.ndarray or float)

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

Calculates the phase of the first component of the electric field (which is the reference for global phase in py_pol model).

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 global phase.

Return type:

(numpy.ndarray or float) [0, 2*pi]

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

Calculates the length of major and minor axis (a,b) of the polarization elipse.

References

  1. Golstein “Polarized light” 2nd ed Marcel Dekker (2003), 3.4 eq.3-30a and 3-30b

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

  • sort (bool) – If True, it sorts a and b to be the major and minor axis respectively. Default: True. TODO: Check why this is neccessary.

  • 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:

Major axis b (numpy.ndarray or float): Minor axis

Return type:

a (numpy.ndarray or float)

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

Calculates the ellipticity parameter: the ratio between the minor and major polarization ellipse axes. It’s 0 for linearly polarized light and 1 for circulary polarized light.

References

Handbook of Optics vol 2. 22.16 (eq.7)

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 length of ellipticity parameter.

Return type:

e (numpy.ndarray or float)

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

Calculates the eccentricity, the opposite to the ellipticity parameter. It’s 1 for linearly polarized light and 0 for circulary polarized light.

References

Handbook of Optics vol 2. 22.16 (eq.9)

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 length of eccentricity parameter.

Return type:

e (numpy.ndarray or float)

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

Calculates the degree of circular polarization: a coefficient that measures the amount of circular polarization in the beam.

References

    1. Gil, “Polarized light and the Mueller Matrix approach”, pp 39.

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 degree of circular polarization.

Return type:

dcp (numpy.ndarray or float)

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

Calculates the degree of linear polarization: a coefficient that measures the amount of linear polarization in the beam.

References

    1. Gil, “Polarized light and the Mueller Matrix approach”, pp 39.

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 degree of linear polarization.

Return type:

dcp (numpy.ndarray or float)

class py_pol.jones_vector.Checks_Jones_Vector(Jones_vector)[source]

Bases: object

Class for Jones vector checks.

Parameters:

jones_vector (Jones_vector) – Parent object.

self.parent

Parent object.

Type:

Jones_vector

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

Creates a dictionary with all the checks of Jones vector.

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

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

Returns:

Dictionary with parameters of Jones vector.

Return type:

(dict)

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

Calculates if the Jones vector is linearly polarized.

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 condition.

Return type:

(numpy.ndarray or bool)

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

Calculates if the Jones vector is circularly polarized.

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 condition.

Return type:

(numpy.ndarray or bool)

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

Calculates if the Jones polarization rotation direction is right-handed.

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 condition.

Return type:

(numpy.ndarray or bool)

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

Calculates if the Jones polarization rotation direction is left-handed.

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 condition.

Return type:

(numpy.ndarray or bool)