Welcome to PyLlama’s documentation!¶
Documentation¶

class
pyllama.
CholestericModel
(chole, n_e, n_o, n_entry, n_exit, wl_nm, N_per, theta_in_rad)¶ This class represents a cholesteric liquid crystal with a multilayer stack of rotating nematic layers, constructed from a
Cholesteric
physical model.Parameters:  chole (Cholesteric) – a
Cholesteric
object from theCholesteric
library  n_e (float) – the extraordinary refractive index
 n_o (float) – the ordinary refractive index
 n_entry (float) – the refractive index of the stack’s entry isotropic semiinfinite medium
 n_exit (float) – the refractive index of the stack’s exit isotropic semiinfinite medium
 N_per (int) – the number of periods. The cholesteric
chole
may already represent more than one helicoid: the layers created from the helicoid(s) inchole
represent the periodic unit, which is repeatedN_per
times inCholestericModel
.  wl_nm (float) – the wavelength in nanometers
 theta_in_rad (float) – the angle of incidence in radians
 chole (Cholesteric) – a

class
pyllama.
HalfSpace
(epsilon, Kx, Kz, k0, category='isotropic')¶ This class represents an isotropic semiinfinite medium before or after a multilayer stack and enables to build the partial waves (eigenvalues, eigenvectors) of the medium.
HalfSpace
represents the physical layer for one specific wavelength (the material may be dispersive).Parameters:  epsilon (ndarray) – permittivity tensor: a 3x3 Numpy array
 Kx (float) – component of the normalised wavevector
 k0 (float) – normalisation factor of the wavevector: the component of the wavevector is equal to
 category (str) – always
"isotropic"
in the code’s 1.0 version

class
pyllama.
Layer
(epsilon, thickness_nm, Kx, k0, rot_angle_rad=0, rot_axis='z', hold=False, numerical_method='numpy')¶ This class represents a homogeneous layer in a multilayer stack and enables to build Berreman’s matrix as well as the partial waves (eigenvalues, eigenvectors) of the layer. The layer is made of a nonmagnetic and nonoptically acvive material.
Layer
represents the physical layer for one specific wavelength (the material may be dispersive). Its parameters are:Parameters:  epsilon (ndarray) – permittivity tensor, a 3x3 Numpy array
 thickness_nm (float) – thickness of the
Layer
in nanometers  Kx (float) – component of the normalised wavevector
 k0 (float) – normalisation factor of the wavevector: the component of the wavevector is equal to
 rot_angle_rad (float) – rotation angle of the layer (in radians) around the axis rot_axis
 rot_axis (ndarray) – rotation axis: a onedimensional Numpy array of length 3 (or the string
'x'
,'y'
or'z'
)  hold (bool) – when the user decides to hold (
hold=True
) the calculation of Berreman’s matrix, the eigenvalues and eigenvectors, the user must then manually apply the functions to theLayer
before calculating the transfer or scattering matrix. This is exceptional practice. The default ishold=True
.  numerical_method (String) – indicates the package to use to calculate the eigenvectors and eigenvalues of
the layer; either
'numpy'
(default) or'sympy'

build_P_Q
()¶ This function constructs the interface matrix and the propagation matrix for one
Layer
. The interface matrix describes the change of medium.
 The propagation matrix describes the propagation in the thickness of the medium and the phase buildup.
Return ndarray P: interface matrix , 3x3 Numpy array Return ndarray Q: propagation matrix , 3x3 Numpy array

static
rotate_permittivity
(eps, angle_rad, axis='z')¶ This function calculates a rotated permittivity tensor.
Parameters:  eps (ndarray) – permittivity tensor: a 3x3 Numpy array
 angle_rad (float) – rotation angle (in radians) around the rotation axis
axis
 axis (ndarray) – rotation axis: a onedimensional Numpy array of length 3 (or the string
'x'
,'y'
or'z'
)
Returns: rotated permittivity tensor: a 3x3 Numpy array

class
pyllama.
MixedModel
(models_list, n_entry, n_exit, wl_nm, theta_in_rad)¶ This class represents the combination of several
Models
with their subperiodicities, given in a list ofModels
. The entry and exitHalfSpaces
of theseModels
are ignored and replaced by these of theMixedModel
.Kx
andk0
must be identical throughout all stacked models, which is checked at the initialisation; theModels
that don’t fit will be discarded and a warning will be issued.Parameters:  models_list (list) – a list of
Models
(models_list[0]
is on top of the stack, after the entryHalfSpace
)  n_entry (float) – the refractive index of the stack’s entry isotropic semiinfinite medium
 n_exit (float) – the refractive index of the stack’s exit isotropic semiinfinite medium
 wl_nm (float) – the wavelength in nanometers
 theta_in_rad (float) – the angle of incidence in radians

copy_as_stack
()¶ This function retrieves the permittivity and the thickness of the
Structure
created by theModel
and creates an identical nonperiodicStackModel
(if theModel
was periodic, theStackModel
contains multiple times the same layers, but no periodic pattern to repeat).Returns: a StackModel

get_refl_trans
(circ=False, method='SM')¶ This function calculates the
Model
’s reflectance in the linear or circular polarisation basis, with the method chosen by the user.Parameters:  circ (bool) –
False
to express results in the linear polarisation basis,True
to express results in the circular polarisation basis  method (string) –
the matrix method to use for the calculation:
"SM"
for the scattering matrix method"TM"
for the transfer matrix method with the eigenvectors and eigenvalues"EM"
for the transfer matrix method with the direct exponential of Berreman’s matrix
Returns: reflectance: 2x2 Numpy array whose values correspond to:
in the linear polarisation basis (
circ=False
):
in the circular polarisation basis (
circ=False
):
Returns: transmittance: 2x2 Numpy array whose values correspond to:
in the linear polarisation basis (
circ=False
):
in the circular polarisation basis (
circ=False
):
 circ (bool) –
 models_list (list) – a list of

class
pyllama.
Model
(n_entry, n_exit, wl_nm, theta_in_rad)¶ This class and its children enable the user to construct
Structures
automatically from given parameters. The classModel
can be viewed as an abstract class that defines parameters and methods common to all its children; however, it is possible to create an instance ofModel
: it will have an emptyStructure
and itsLayers
(Model.structure.layers
) can be added manually (Structure.add_layer()
). The parameters ofModels
are:Parameters:  n_entry (float) – the refractive index of the stack’s entry isotropic semiinfinite medium
 n_exit (float) – the refractive index of the stack’s exit isotropic semiinfinite medium
 wl_nm (float) – the wavelength in nanometers
 theta_in_rad (float) – the angle of incidence in radians

copy_as_stack
()¶ This function retrieves the permittivity and the thickness of the
Structure
created by theModel
and creates an identical nonperiodicStackModel
(if theModel
was periodic, theStackModel
contains multiple times the same layers, but no periodic pattern to repeat).Returns: a StackModel

get_refl_trans
(circ=False, method='SM')¶ This function calculates the
Model
’s reflectance in the linear or circular polarisation basis, with the method chosen by the user.Parameters:  circ (bool) –
False
to express results in the linear polarisation basis,True
to express results in the circular polarisation basis  method (string) –
the matrix method to use for the calculation:
"SM"
for the scattering matrix method"TM"
for the transfer matrix method with the eigenvectors and eigenvalues"EM"
for the transfer matrix method with the direct exponential of Berreman’s matrix
Returns: reflectance: 2x2 Numpy array whose values correspond to:
in the linear polarisation basis (
circ=False
):
in the circular polarisation basis (
circ=False
):
Returns: transmittance: 2x2 Numpy array whose values correspond to:
in the linear polarisation basis (
circ=False
):
in the circular polarisation basis (
circ=False
):
 circ (bool) –

class
pyllama.
SlabModel
(eps, thickness_nm, n_entry, n_exit, wl_nm, theta_in_rad, rotangle_rad=0, rotaxis='z')¶ This class represents a homogeneous slab of arbitrary permittivity.
Parameters:  eps (ndarray) – permittivity tensor, 3x3 Numpy array
 thickness_nm (float) – thickness in nanometers
 n_entry (float) – the refractive index of the stack’s entry isotropic semiinfinite medium
 n_exit (float) – the refractive index of the stack’s exit isotropic semiinfinite medium
 wl_nm (float) – the wavelength in nanometers
 theta_in_rad (float) – the angle of incidence in radians
 rotangle_rad (float) – the rotation angle to apply to the permittivity tensor, in radians
 rotaxis (ndarray) – the rotation axis, a onedimensional Numpy array of length 3 (or the string
'x'
,'y'
or'z'
)

class
pyllama.
Spectrum
(wl_nm_list, model_type, model_parameters)¶ This class implements the modelling of a multilayer stack over a range of wavelength and provide tools for calculating reflection spectra with the choice of the polarisation basis and for exporting the data.
Spectrum
contains an initiallyempty dictionarySpectrum.data
that will be filled with the calculated reflection spectra and additional data.Parameters:  wl_nm_list (ndarray) – a list (or array or range) of wavelengths (integers or floats), for example
range(400, 800)
 model_type (string) –
the name of the model to use. These include:
"CholestericModel"
"SlabModel"
"StackModel"
"StackOpticalThicknessModel"
 model_parameters (dict) – a dictionary containing the list of parameters required to create the chosen
Model
,
except the wavelength. See the chosen
Model
’s documentation to know how to construct the dictionary.
add_result
(key, value)¶ This function add an entry to the dictionary
Spectrum.data
. This entry will be included in the content that is saved bySpectrum.export()
.Parameters:  key (string) – the key for the value to add to the dictionary
 value – the value to add (any type)

calculate_refl_trans
(circ=False, method='SM', talk=False)¶ This function creates the required
Model
and calculates the reflection spectrum in the linear (default) or circular polarisation basis, usinq a chosen method (by default the scattering matrix method). The results are stored in the initially empty dictionarySpectrum.data
. The values of the results correspond to:in the linear polarisation basis (
circ=False
):Spectrum.data["R_p_to_p"]
: reflection spectrum for incoming polarisation to outgoing polarisation, 1d Numpy arraySpectrum.data["R_p_to_s"]
: reflection spectrum for incoming polarisation to outgoing polarisation, 1d Numpy arraySpectrum.data["R_s_to_p"]
: reflection spectrum for incoming polarisation to outgoing polarisation, 1d Numpy arraySpectrum.data["R_s_to_s"]
: reflection spectrum for incoming polarisation to outgoing polarisation, 1d Numpy array
in the circular polarisation basis (
circ=False
):Spectrum.data["R_R_to_R"]
: reflection spectrum for incoming polarisation to outgoing polarisation, 1d Numpy arraySpectrum.data["R_R_to_L"]
: reflection spectrum for incoming polarisation to outgoing polarisation, 1d Numpy arraySpectrum.data["R_L_to_R"]
: reflection spectrum for incoming polarisation to outgoing polarisation, 1d Numpy arraySpectrum.data["R_L_to_L"]
: reflection spectrum for incoming polarisation to outgoing polarisation, 1d Numpy array
as well as
time_elapsed
(float) which calculates the time that it took to compute the spectrum.Parameters:  circ (bool) –
False
to express results in the linear polarisation basis,True
to express results in the circular polarisation basis  method (string) –
the matrix method to use for the calculation:
"SM"
for the scattering matrix method"TM"
for the transfer matrix method with the eigenvectors and eigenvalues"EM"
for the transfer matrix method with the direct exponential of Berreman’s matrix
 talk (bool) –
True
(nondefault) to display the computation progress, wavelength per wavelength

export
(path_out, with_param=True)¶ This function exports the
Spectrum
for further processing in MATLAB or Python, and stores it to the specified path. The contents ofSpectrum.data
andSpectrum.wl_list
are exported.Parameters:  path_out (string) – path of the file to save the spectrum. It must end with
".mat"
(to save in MATLABcompatible format) or".pck"
(to save with Pickles in Pythoncompatible format).  with_param (bool) –
True
to save theSpectrum
’s model parameters in addition to the content ofSpectrum.data
,
False
(default) to only save the content ofSpectrum.data
. path_out (string) – path of the file to save the spectrum. It must end with

rename_result
(old_key, new_key)¶ This function enables to rename one of the elements contained in
Spectrum.data
.For example, the user may calculate the reflection spectrum with the scattering matrix method:
my_spectrum.calculate(method="SM")
then rename the keys in
Spectrum.data
with:my_spectrum.rename_result("R_R_to_R", "R_R_to_R_SM") my_spectrum.rename_result("R_R_to_L", "R_R_to_L_SM") my_spectrum.rename_result("R_L_to_R", "R_L_to_R_SM") my_spectrum.rename_result("R_L_to_L", "R_L_to_L_SM") my_spectrum.rename_result("time_elapsed", "time_elpased_SM")
then calculate the reflection spectrum with the transfer matrix method:
Spectrum.calculate(method="TM")
then rename the keys in
Spectrum.data
with:my_spectrum.rename_result("R_R_to_R", "R_R_to_R_TM") my_spectrum.rename_result("R_R_to_L", "R_R_to_L_TM") my_spectrum.rename_result("R_L_to_R", "R_L_to_R_TM") my_spectrum.rename_result("R_L_to_L", "R_L_to_L_TM") my_spectrum.rename_result("time_elapsed", "time_elpased_TM")
in order to save results calculated with both matrix methods.
 wl_nm_list (ndarray) – a list (or array or range) of wavelengths (integers or floats), for example

class
pyllama.
StackModel
(eps_list, thickness_nm_list, n_entry, n_exit, wl_nm, theta_in_rad, N_per=1)¶ This class represents a periodic multilayer stack where each layer has a given permittivity and thickness.
Parameters:  eps_list (list) – list of permittivity tensors for each layer, each a 3x3 Numpy array
 thickness_nm_list (list) – list of thicknesses in nanometers for each layer, each a float
 n_entry (float) – the refractive index of the stack’s entry isotropic semiinfinite medium
 n_exit (float) – the refractive index of the stack’s exit isotropic semiinfinite medium
 wl_nm (float) – the wavelength in nanometers
 theta_in_rad (float) – the angle of incidence in radians
 N_per (int) – the number of periods

add_layer
(new_layer)¶ This function adds a
Layer
to the multilayer stack represented by theStackModel
.Parameters: new_layer (Layer) – Layer
to add

add_layers
(new_layers_list)¶ This function adds a list of
Layers
to the multilayer stack represented by theStackModel
.Parameters: new_layers_list (list) – list of Layers
to add

change_N_per
(new_N_per)¶ This function changes the number of periods of the Bragg stack.
Parameters: new_N_per (int) – new number of periods

extract_stack
(index_first_layer, index_last_layer)¶ This function extracts a substack from the
StackModel
(and return a new instance ofStackModel
).Parameters:  index_first_layer – index of the first
Layer
 index_last_layer – index of the last
Layer
to extract + 1 (ifindex_first_layer = index_last_layer
, the
substack contains the
Layer
indexedindex_first_layer
) :return: aStackModel
 index_first_layer – index of the first

rotate_layer
(layer_index, rot_angle_rad, rot_axis='z', hold=False)¶ This function rotates a given
Layer
’s permittivity tensor: it creates the new rotatedLayer
and replaces the nonrotatedLayer
by the rotatedLayer
in theStructure
.Parameters:  layer_index (int) – the index of the
Layer
to rotate  rot_angle_rad (float) – the rotation angle in radians
 rot_axis (ndarray) – the rotation axis
 hold (bool) – when the user decides to hold (
hold=True
) the calculation of Berreman’s matrix, the eigenvalues
and eigenvectors, the user must then manually apply the functions to the
Layer
before calculating the transfer or scattering matrix. This is exceptional practice. The default ishold=True
. layer_index (int) – the index of the

rotate_layers
(layer_number_list, rot_angle_rad_list, rot_axis='z')¶ This function applies the function
rotate_layer
on severalLayers
. Seerotate_layer
’s documentation.

class
pyllama.
StackOpticalThicknessModel
(n_list, total_thickness_nm, n_entry, n_exit, wl_nm, theta_in_rad, N_per=1)¶ This class represents a periodic multilayer stack where all layers are isotropic and have the same optical thickness.
Parameters:  n_list (list) – list of refractive indices for each
Layer
, each a float  total_thickness_nm (float) – totat thickness of the stack, in nanometers
 n_entry (float) – the refractive index of the stack’s entry isotropic semiinfinite medium
 n_exit (float) – the refractive index of the stack’s exit isotropic semiinfinite medium
 wl_nm (float) – the wavelength in nanometers
 theta_in_rad (float) – the angle of incidence in radians
 N_per (int) – the number of periods
 n_list (list) – list of refractive indices for each

class
pyllama.
Structure
(entry, exit, Kx, Ky, Kz_entry, Kz_exit, k0, N_periods=1)¶ This class represents a multilayer stack by:
 a list of layers (instances of
Layer
), initially an empty list  an isotropic entry semiinfinite medium (instance of
HalfSpace
)  an isotropic exit semiinfinite medium (instance of
HalfSpace
)  the number of periods , which means that the list of layers will be repeated times
Parameters:  Kx (float) – component of the normalised wavevector (stays the same throughought the stack)
 Ky (float) – component of the normalised wavevector (equal to 0 by construction)
 Kz (float) – component of the normalised wavevector (changes in each layer)
 k0 (float) –
normalisation factor of the wavevector:
which stays the same throughout the stack and depends on the wavelength
 N_periods (int) – the number of periods

add_layer
(new_layer)¶ This function adds a
Layer
to the structure, provided it is compatible with the structure (see functionStructure.is_layer_compatible(layer)
).Parameters: new_layer – a Layer
to add

add_layers
(new_layers_list)¶ This function adds
Layers
to the structure, provided they are compatible with the structure (see functionStructure.is_layer_compatible(layer)
). CompatibleLayers
are added, noncompatibleLayers
are not added.Parameters: new_layers_list – a list of Layers
to add

static
are_structures_compatible
(structures_list)¶ This function checks if several structures are compatible with each other: the component of the normalised wavevector and its normalisation factor must stay the same in all structures.
Parameters: structures_list (list) – a list of Structures
Return bool: True
if allStructures
from the list are compatible,False
otherwise

build_exponential_matrix
()¶ This function calculates the transfer matrix of the system with the exponential of Berreman’s matrix.
Returns: transfer matrix, a 4x4 Numpy array

static
build_exponential_matrix_multi
(struct_list, entry, exit)¶ This function calculates the transfer matrix with the direct exponential of Berreman’s matrix for a system made of substacks.
Returns: transfer matrix, a 4x4 Numpy array

build_scattering_matrix
()¶ This function calculates the scattering matrix of the system.
Returns: scattering matrix, a 4x4 Numpy array

static
build_scattering_matrix_multi
(struct_list, entry, exit)¶ This function calculates the scattering matrix for a system made of substacks.
Returns: scattering matrix, a 4x4 Numpy array

static
build_scattering_matrix_to_next
(layer_a, layer_b)¶ This function constructs the scattering matrix between two successive layers and by taking into acount the following phenomena:
 the propagation through the first layer with the propagation matrix Q of
layer_a
 the transition from the first layer (
layer_a
’s matrix P) and the second layer (layer_b
’s matrix P)
Parameters:  layer_a (ndarray) – the first
Layer
 layer_b (ndarray) – the second
Layer
Returns: partial scattering matrix from layer to layer , a 4x4 Numpy array
 the propagation through the first layer with the propagation matrix Q of

build_transfer_matrix
()¶ This function calculates the transfer matrix of the system with the matrices of eigenvalues and eigenvectors.
Returns: transfer matrix, a 4x4 Numpy array

static
build_transfer_matrix_multi
(struct_list, entry, exit)¶ This function calculates the transfer matrix with the eigenvectors and eigenvalues for a system made of substacks.
Returns: transfer matrix, a 4x4 Numpy array

static
combine_scattering_matrices
(S_ab, S_bc)¶ This function constructs the scattering matrix between three successive layers , and by combining the scattering matrices from layer to layer and from layer to layer .
Parameters:  S_ab (ndarray) – the scattering matrix from layer to layer , a 4x4 Numpy array
 S_bc (ndarray) – the scattering matrix from layer to layer , a 4x4 Numpy array
Returns: partial scattering matrix from layer to layer , a 4x4 Numpy array

static
fresnel_to_fresnel_circ
(J_refl, J_trans)¶ This function converts reflection and transmission coefficients in the linear polarisation basis to reflection and transmission coefficients in the circular polarisation bases.
Parameters:  J_refl (ndarray) –
2x2 Numpy array whose values correspond to:
 J_trans (ndarray) –
2x2 Numpy array whose values correspond to:
Return J_refl_c: 2x2 Numpy array whose values correspond to:
Return J_trans_c: 2x2 Numpy array whose values correspond to:
 J_refl (ndarray) –

get_fresnel
(method='SM')¶ This function calculates the
Structure
’s reflection and transmission coefficients in the linear polarisation basis, with the method chosen by the user.Parameters: method (string) –
the matrix method to use for the calculation:
"SM"
for the scattering matrix method"TM"
for the transfer matrix method with the eigenvectors and eigenvalues"EM"
for the transfer matrix method with the direct exponential of Berreman’s matrix
Return J_refl: 2x2 Numpy array whose values correspond to:
Return J_trans: 2x2 Numpy array whose values correspond to:

static
get_fresnel_multi
(structures_list, entry, exit, method='SM')¶ This function calculates reflection and transmission coefficients for a system made of a list of Structures in the linear polarisation basis, with the method chosen by the user.
Parameters:  structures_list (list) – list of multiple
Structures
that constitute the stack. Their respective entry and exitHalfSpaces
will be ignored.  entry – instance of
HalfSpace
that constitutes the stack’s entry semiinfinite medium  exit – instance of
HalfSpace
that constitutes the stack’s exit semiinfinite medium  method (string) –
the matrix method to use for the calculation:
"SM"
for the scattering matrix method"TM"
for the transfer matrix method with the eigenvectors and eigenvalues"EM"
for the transfer matrix method with the direct exponential of Berreman’s matrix
Return J_refl: 2x2 Numpy array whose values correspond to:
Return J_trans: 2x2 Numpy array whose values correspond to:
 structures_list (list) – list of multiple

get_refl_trans
(circ=False, method='SM')¶ This function calculates the
Structure
’s reflectance in the linear or circular polarisation basis, with the method chosen by the user.Parameters:  circ (bool) –
False
to express results in the linear polarisation basis,True
to express results in the circular polarisation basis  method (string) –
the matrix method to use for the calculation:
"SM"
for the scattering matrix method"TM"
for the transfer matrix method with the eigenvectors and eigenvalues"EM"
for the transfer matrix method with the direct exponential of Berreman’s matrix
Returns: reflectance: 2x2 Numpy array whose values correspond to:
in the linear polarisation basis (
circ=False
):
in the circular polarisation basis (
circ=False
):
Returns: transmittance: 2x2 Numpy array whose values correspond to:
in the linear polarisation basis (
circ=False
):
in the circular polarisation basis (
circ=False
):
 circ (bool) –

static
get_refl_trans_multi
(structures_list, entry, exit, circ=False, method='SM')¶ This function calculates reflectance of a system made of a list of Structures in the linear or circular polarisation basis, with the method chosen by the user.
Parameters:  structures_list (list) – list of multiple
Structures
that constitute the stack. Their respective entry and exitHalfSpaces
will be ignored.  entry – instance of
HalfSpace
that constitutes the stack’s entry semiinfinite medium  exit – instance of
HalfSpace
that constitutes the stack’s exit semiinfinite medium  circ (bool) –
False
to express results in the linear polarisation basis,True
to express results in the circular polarisation basis  method (string) –
the matrix method to use for the calculation:
"SM"
for the scattering matrix method"TM"
for the transfer matrix method with the eigenvectors and eigenvalues"EM"
for the transfer matrix method with the direct exponential of Berreman’s matrix
Returns: reflectance: 2x2 Numpy array whose values correspond to:
in the linear polarisation basis (
circ=False
):
in the circular polarisation basis (
circ=False
):
Returns: transmittance: 2x2 Numpy array whose values correspond to:
in the linear polarisation basis (
circ=False
):
in the circular polarisation basis (
circ=False
):
 structures_list (list) – list of multiple

is_layer_compatible
(layer)¶ This function checks if the layer
layer
is compatible with the structure: the component of the normalised wavevector and its normalisation factor must stay the same throughout the stack.Parameters: layer – a Layer
Return bool: True
if the layer is compatible with the structure,False
otherwise

remove_layer
(layer_index)¶ This function removes from the
Structure
theLayer
at the indexlayer_index
.Parameters: layer_index (int) – index of the Layer
to remove

replace_layer
(layer_index, new_layer)¶ This function replaces the
Layer
at the indexlayer_index
by theLayer
new_layer
provided it is compatible with the structure (see functionStructure.is_layer_compatible(layer)
).Parameters:  layer_index (int) – index of the
Layer
to replace  new_layer –
Layer
to add
 layer_index (int) – index of the
 a list of layers (instances of

class
pyllama.
Wave
(epsilon, Kx, Ex, Ey, Hx, Hy)¶ This class represents a partial wave in a layer of the multilayer stack with:
 its electric field
 its magnetic field
 its Poynting vector
 the  (tangential) component of its normalised wavevector
Parameters:  epsilon (ndarray) – permittivity tensor: a 3x3 Numpy array
 Kx (float) – component of the normalised wavevector
 Ex (float) – component of the electric field
 Ey (float) – component of the electric field
 Hx (float) – component of the magnetic field
 Hy (float) – component of the magnetic field

static
calc_Ez_Hz
(epsilon, Kx, Ex, Ey, Hy)¶ This function calculates the components of the electric and magnetic fields of the Wave

calc_cp_elec
()¶ This function calculates the parameter Cp, used to sort a pair of partial waves between s and p polarisations. :return: Cp = Ex ** 2 / (Ex**2 + Ey**2)

calc_cp_poynting
()¶ This function calculates the parameter Cp, used to sort a pair of partial waves between slike and plike polarisations. :return: Cp = Sx ** 2 / (Sx**2 + Sy**2)

calc_poynting
()¶ This function calculates the Poynting vector of the Wave

static
matrix_to_waves
(mat, epsilon, Kx)¶ Given a layer’s 4 eigenvectors in a 4x4 Numpy array where each column corresponds to a column vector , this function returns a list of the 4 corresponding Waves, which are easier to manipulate when electric fields, magnetic fields and Poynting vectors need to be accessed.
Parameters:  mat (ndarray) –
4x4 Numpy array of 4 eigenvectors , , and whose values correspond to:
 epsilon (ndarray) – permittivity tensor: 3x3 Numpy array
 Kx (float) – the  (tangential) component of its normalised wavevector
Returns: list of 4 corresponding
Waves
[w_0, w_1, w_2, w_3]
 mat (ndarray) –

static
waves_to_matrix
(w_list, norm=False)¶ Given a layer’s 4 partial waves as
Waves
objects, this function returns a matrix where the components , , and are arranged so that the matrix can be used as a transition matrix for the layer. The function extracts a vector for each of the 4 waves and formats them into a matrix where each column is a .Parameters:  w_list (list) – list of 4 partial waves
Waves
[w_0, w_1, w_2, w_3]
 norm (bool) – set to True to normalise each to a modulus of 1, otherwive set to False. Must
be set to False for the partial waves of the
HalfSpaces
.
Returns: 4x4 Numpy array of 4 eigenvectors , , and whose values correspond to:
 w_list (list) – list of 4 partial waves

pyllama.
rot_mat
(axis=array([0, 0, 1]), theta_rad=0)¶ This function builds a rotation matrix for a given angle around a given axis accordung to https://en.wikipedia.org/wiki/Rotation_matrix.
Parameters:  axis (ndarray) – rotation axis: a onedimensional Numpy array of length 3 (or the string
'x'
,'y'
or'z'
)  theta_rad (float) – rotation angle (in radians) around the rotation axis
axis
Returns: a 3x3 Numpy array rotation matrix
 axis (ndarray) – rotation axis: a onedimensional Numpy array of length 3 (or the string