Solvers
For calculation of light interaction in material stacks the transfer matrix method is used.
In pyElli the Solver classes provide the necessary toolset for two kinds of transfer matrix algorithms.
They are not intended to be used directly, but rather to be provided in the evaluation in the Structure class.
The Solver2x2 is a simple and fast algorithm for isotropic materials.
It splits the calculation into two 2x2 matrices, one for the s and one for the p polarized light.
The Solver4x4 is a more complex algorithm for anisotropic materials.
It employs a full 4x4 matrix formulation for all light interaction.
It is based on the Berreman matrix formalism [1].
In the Berreman formalism a propagator for matrix exponentials is needed.
pyElli provides different implementations to be used in the calculation of the transfer matrices.
The PropagatorEig is based on solving the eigenvalues of the first order approximation of the matrix exponential.
Although, it is very fast it is not very accurate.
The PropagatorExpm is solving the matrix exponential by the Pade approximation.
It can use SciPy as backend, but for performance-critical tasks, it is recommended to install PyTorch.
References
Solver base class (Solver)
- class elli.solver.Solver(experiment)[source]
Bases:
ABCSolver base class to evaluate Experiment objects. Here the experiment and structure get unpacked and the simulation results get returned.
The actual simulation is handled by subclasses. Therefore, this class should never be called directly.
- experiment = None
- jones_vector = None
- lbda = None
- permittivity_profile = None
- structure = None
- theta_i = None
2x2 Matrix Solver (Solver2x2)
- class elli.solver2x2.Solver2x2(experiment)[source]
Bases:
SolverSolver class to evaluate Experiment objects. Simple but fast 2x2 transfer matrix method. Cannot handle anisotropy or anything fancy, thus Jonas and Mueller matrices cannot be calculated (respective functions return None).
- static fresnel(n_i, n_t, th_i, th_t)[source]
Calculate fresnel coefficients at the interface of two materials
- Parameters:
n_i – Refractive index of the material of the incident wave
n_t – Refractive index of the material of the transmitted wave
thi_i – Incident angle of the incident wave
thi_t – Refracted angle of the transmitted wave
- Returns:
s-polarized reflection coefficient r_p: p-polarized reflection coefficient t_s: s-polarized transmission coefficient t_p: p-polarized transmission coefficient
- Return type:
r_s
4x4 Matrix Solver (Solver4x4)
- class elli.solver4x4.Propagator[source]
Bases:
ABCPropagator abstract base class.
- abstract calculate_propagation(delta, thickness, lbda)[source]
Calculates propagation for a given Delta matrix and layer thickness.
- Parameters:
delta (npt.NDArray) – Delta Matrix
thickness (float) – Thickness of layer (nm)
lbda (npt.ArrayLike) – Wavelengths to evaluate (nm)
- Returns:
Propagator for the given layer
- Return type:
npt.NDArray
- class elli.solver4x4.PropagatorEig[source]
Bases:
PropagatorPropagator class using the eigenvalue decomposition method.
- calculate_propagation(delta, thickness, lbda)[source]
Calculates propagation for a given Delta matrix and layer thickness with eigenvalue decomposition.
- Parameters:
delta (npt.NDArray) – Delta Matrix
thickness (float) – Thickness of layer (nm)
lbda (npt.ArrayLike) – Wavelengths to evaluate (nm)
- Returns:
Propagator for the given layer
- Return type:
npt.NDArray
- class elli.solver4x4.PropagatorExpm(backend='automatic')[source]
Bases:
PropagatorPropagator class using the Padé approximation of the matrix exponential.
The Propagator can use two different backends: SciPy and PyTorch. The default installation only provides SciPy. PyTorch is faster and will be used automatically if available. If you want to install PyTorch please follow the instructions at https://pytorch.org/get-started/locally/.
- Parameters:
backend (Literal["torch", "scipy", "automatic"], optional) – Setting to change the linear algebra provider. Defaults to “automatic”.
- calculate_propagation(delta, thickness, lbda)[source]
Calculates propagation for a given Delta matrix and layer thickness with the Padé approximation of the matrix exponential.
- Parameters:
delta (npt.NDArray) – Delta Matrix
thickness (float) – Thickness of layer (nm)
lbda (npt.ArrayLike) – Wavelengths to evaluate (nm)
- Returns:
Propagator for the given layer
- Return type:
npt.NDArray
- class elli.solver4x4.PropagatorLinear[source]
Bases:
PropagatorPropagator class using a simple linear approximation of the matrix exponential.
- calculate_propagation(delta, thickness, lbda)[source]
Calculates propagation for a given Delta matrix and layer thickness with a linear approximation of the matrix exponential.
- Parameters:
delta (npt.NDArray) – Delta Matrix
thickness (float) – Thickness of layer (nm)
lbda (npt.ArrayLike) – Wavelengths to evaluate (nm)
- Returns:
Propagator for the given layer
- Return type:
npt.NDArray
- class elli.solver4x4.Solver4x4(experiment, propagator=<elli.solver4x4.PropagatorExpm object>)[source]
Bases:
SolverSolver class to evaluate Experiment objects. Based on Berreman’s 4x4 method.
- static build_delta_matrix(k_x, eps)[source]
Calculates Delta matrix for given permittivity and reduced wave number.
- Parameters:
k_x (npt.ArrayLike) – reduce wave number, Kx = kx/k0
eps (npt.NDArray) – permittivity tensor
- Returns:
Delta 4x4 matrix: infinitesimal propagation matrix
- Return type:
npt.NDArray
- calculate()[source]
Calculates transition matrices for every element in the structure and resulting Jones matrices.
- Returns:
Result object with calculation results
- Return type:
- static get_k_z(material, lbda, k_x)[source]
Calculates Kz in a material
- Parameters:
material (Material) – Material of the half-space
lbda (npt.ArrayLike) – Wavelengths to evaluate (nm)
k_x (npt.ArrayLike) – Reduced wavenumber, Kx = kx/k0
- Returns:
value of Kz in the material
- Return type:
npt.NDArray
- static transition_matrix_halfspace(delta)[source]
Returns transition exit matrix L for any half-space.
Sort eigenvectors of the Delta matrix according to propagation direction first, then according to $y$ component.
Returns eigenvectors ordered like (s+,s-,p+,p-)
- Parameters:
delta (npt.NDArray) – Delta 4x4 matrix: infinitesimal propagation matrix
- Returns:
Translation matrix for semi-infinite half-spaces
- Return type:
npt.NDArray
- static transition_matrix_iso_halfspace(k_x, epsilon, inv=False)[source]
Returns transition incident or exit matrix L for isotropic half-spaces.
- Parameters:
k_x (npt.ArrayLike) – Reduced wavenumber, Kx = kx/k0
epsilon (npt.ArrayLike) – dielectric tensor
inv (bool, optional) – If True, returns inverse transition matrix L^-1, used for the incident Matrix Li. Defaults to False.
- Returns:
transition matrix L
- Return type:
npt.NDArray