prysm.x.polarization#
Jones and Mueller Calculus.
- prysm.x.polarization.linear_pol_vector(angle, degrees=True)#
Returns a linearly polarized jones vector at a specified angle
- Parameters:
angle (float) – angle that the linear polarization is oriented with respect to the horizontal axis
shape (list, optional) – shape to prepend to the jones vector array. shape = [32,32] returns an array of shape [32,32,2,1] where the matrix is assumed to be in the last indices. Defaults to None, which returns a [2] array.
- Returns:
linear jones vector
- Return type:
ndarray
- prysm.x.polarization.circular_pol_vector(handedness='left', shape=None)#
Returns a circularly polarized jones vector
- Parameters:
shape (list, optional) – shape to prepend to the jones vector array. shape = [32,32] returns an array of shape [32,32,2,1] where the matrix is assumed to be in the last indices. Defaults to None, which returns a [2] array.
- Returns:
circular jones vector
- Return type:
ndarray
- prysm.x.polarization.jones_rotation_matrix(theta, shape=None)#
A rotation matrix for rotating the coordinate system transverse to propagation. source: https://en.wikipedia.org/wiki/Rotation_matrix.
- Parameters:
theta (float) – angle in radians to rotate the jones matrix with respect to the x-axis.
shape (list) – shape to prepend to the jones matrix array. shape = [32,32] returns an array of shape [32,32,2,2] where the matrix is assumed to be in the last indices. Defaults to None, which returns a 2x2 array.
- Returns:
2D rotation matrix
- Return type:
ndarray
- prysm.x.polarization.linear_retarder(retardance, theta=0, shape=None)#
Generates a homogenous linear retarder jones matrix.
- Parameters:
retardance (float) – phase delay experienced by the slow state in radians.
theta (float) – angle in radians the linear retarder is rotated with respect to the x-axis. Defaults to 0.
shape (list) – shape to prepend to the jones matrix array. shape = [32,32] returns an array of shape [32,32,2,2] where the matrix is assumed to be in the last indices. Defaults to None, which returns a 2x2 array.
- Returns:
retarder – numpy array containing the retarder matrices
- Return type:
ndarray
- prysm.x.polarization.linear_diattenuator(alpha, theta=0, shape=None)#
Generates a homogenous linear diattenuator jones matrix.
- Parameters:
alpha (float) – Fraction of the light that passes through the partially transmitted channel. If 1, this is an unpolarizing plate. If 0, this is a perfect polarizer
theta (float) – angle in radians the linear retarder is rotated with respect to the x-axis. Defaults to 0.
shape (list) – shape to prepend to the jones matrix array. shape = [32,32] returns an array of shape [32,32,2,2] where the matrix is assumed to be in the last indices. Defaults to None, which returns a 2x2 array.
- Returns:
diattenuator – numpy array containing the diattenuator matrices
- Return type:
ndarray
- prysm.x.polarization.half_wave_plate(theta=0, shape=None)#
Make a half wave plate jones matrix. Just a wrapper for linear_retarder.
- Parameters:
theta (float) – angle in radians the linear retarder is rotated with respect to the x-axis. Defaults to 0.
shape (list) – shape to prepend to the jones matrix array. shape = [32,32] returns an array of shape [32,32,2,2] where the matrix is assumed to be in the last indices. Defaults to None, which returns a 2x2 array.
- Returns:
a linear retarder with half-wave retardance
- Return type:
linear_retarder
- prysm.x.polarization.quarter_wave_plate(theta=0, shape=None)#
Make a quarter wave plate jones matrix. Just a wrapper for linear_retarder.
- Parameters:
theta (float) – angle in radians the linear retarder is rotated with respect to the x-axis. Defaults to 0.
shape (list, optional) – shape to prepend to the jones matrix array. shape = [32,32] returns an array of shape [32,32,2,2] where the matrix is assumed to be in the last indices. Defaults to None, which returns a 2x2 array.
- Returns:
a linear retarder with quarter-wave retardance
- Return type:
linear_retarder
- prysm.x.polarization.linear_polarizer(theta=0, shape=None)#
Make a linear polarizer jones matrix. Just a wrapper for linear_diattenuator.
- Parameters:
theta (float) – angle in radians the linear retarder is rotated with respect to the x-axis. Defaults to 0.
shape (list) – shape to prepend to the jones matrix array. shape = [32,32] returns an array of shape [32,32,2,2] where the matrix is assumed to be in the last indices. Defaults to None, which returns a 2x2 array.
- Returns:
a linear diattenuator with unit diattenuation
- Return type:
linear_diattenuator
- prysm.x.polarization.vector_vortex_retarder(charge, theta, retardance=3.141592653589793, rotate=0)#
Generate a phase-only spatially-varying vector vortex retarder (VVR).
This model follows Eq (7) in D. Mawet. et al. (2009) https://opg.optica.org/oe/fulltext.cfm?uri=oe-17-3-1902&id=176231 (open access)
- Parameters:
charge (float) – topological charge of the vortex, typically an interger
theta (ndarray) – angular coordinate grid describing the azimuthal angle of the vortex. This can be created from prysm.coordinates.cart_to_polar
retardance (float) – phase difference between the ordinary and extraordinary modes, by default np.pi or half a wave
rotate (float, optional) – angle in radians to rotate the vortex by, by default 0
- Returns:
jones matrix of a vector vortex retarder
- Return type:
ndarray
- prysm.x.polarization.broadcast_kron(a, b)#
broadcasted kronecker product of two N,M,…,2,2 arrays.
Used for jones -> mueller conversion.
In the unbroadcasted case, this output looks like
- out = [a[0,0]*b,a[0,1]*b]
[a[1,0]*b,a[1,1]*b]
where out is a N,M,…,4,4 array. This works for generally shaped kronecker products where the matrix is contained in the last two axes, but it’s only tested for the Nx2x2 case.
- Parameters:
a (ndarray) – N,M,…,2,2 array used to scale b in kronecker product
b (ndarray) – N,M,…,2,2 array used to form block matrices in kronecker product
- Returns:
N,M,…,4,4 array
- Return type:
out
- prysm.x.polarization.jones_to_mueller(jones, broadcast=True)#
Construct a Mueller Matrix given a Jones Matrix. From Chipman, Lam, and Young Eq (6.99).
- Parameters:
jones (ndarray with final dimensions 2x2) – The complex-valued jones matrices to convert into mueller matrices
broadcast (bool) – Whether to use the experimental broadcast_kron to compute the conversion in a broadcast fashion, by default True
- Returns:
M – Mueller matrix
- Return type:
np.ndarray
- prysm.x.polarization.pauli_spin_matrix(index, shape=None)#
Generates a pauli spin matrix used for Jones matrix data reduction. From CLY Eq 6.108.
- Parameters:
index (int) – 0 - the identity matrix 1 - a linear half-wave retarder oriented horizontally 2 - a linear half-wave retarder oriented 45 degrees 3 - a circular half-wave retarder
shape (list, optional) – shape to prepend to the jones matrix array. shape = [32,32] returns an array of shape [32,32,2,2] where the matrix is assumed to be in the last indices. Default returns a 2x2 array
- Returns:
pauli spin matrix of index specified
- Return type:
jones
- prysm.x.polarization.pauli_coefficients(jones)#
Compute the pauli coefficients of a jones matrix.
- Parameters:
jones (ndarray) – complex jones matrix to decompose
- Returns:
complex coefficients of pauli matrices
- Return type:
c0,c1,c2,c3
- prysm.x.polarization.jones_adapter(prop_func)#
wrapper around prysm.propagation functions to support polarized field propagation
- Parameters:
prop_func (callable) – propagation function to decorate
Notes
There isn’t anything particularly special about polarized field propagation. We simply leverage the independence of the 4 “polarized” components of an optical system expressed as a Jones matrix
J is:
[ [J00, J01], [J10, J11] ]
The elements of this matrix can be propagated as incoherent wavefronts to express the polarized response of an optical system. All jones_adapter does is call a given propagation function 4 times, one for each element of the Jones matrix.
- Returns:
decorated propagation function
- Return type:
callable
- prysm.x.polarization.add_jones_propagation(funcs_to_change=['focus', 'unfocus', 'focus_dft', 'unfocus_dft', 'angular_spectrum'])#
apply decorator to supported propagation functions
- Parameters:
funcs_to_change (list, optional) – list of propagation functions to add polarized field propagation to, by default supported_propagation_funcs
- prysm.x.polarization.apply_polarization_optic(field, pol_optic)#
applies a polarization optic represented by a jones matrix to a scalar field If field.ndim != 2, this returns the original field
- Parameters:
field (ndarray) – scalar field of shape M x N
pol_optic (ndarray) – jones matrix of shape M x N x 2 x 2
- Returns:
jones matrix of shape M x N x 2 x 2
- Return type:
ndarray