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 the Cholesteric 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 semi-infinite medium
  • n_exit (float) – the refractive index of the stack’s exit isotropic semi-infinite 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) in chole represent the periodic unit, which is repeated N_per times in CholestericModel.
  • wl_nm (float) – the wavelength in nanometers
  • theta_in_rad (float) – the angle of incidence in radians
class pyllama.HalfSpace(epsilon, Kx, Kz, k0, category='isotropic')

This class represents an isotropic semi-infinite 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) – x-component of the normalised wavevector
  • k0 (float) – normalisation factor of the wavevector: the x-component of the wavevector is equal to k_x = k_0 K_x
  • 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 non-magnetic and non-optically 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) – x-component of the normalised wavevector
  • k0 (float) – normalisation factor of the wavevector: the x-component of the wavevector is equal to k_x = k_0 K_x
  • rot_angle_rad (float) – rotation angle of the layer (in radians) around the axis rot_axis
  • rot_axis (ndarray) – rotation axis: a one-dimensional 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 the Layer before calculating the transfer or scattering matrix. This is exceptional practice. The default is hold=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 P and the propagation matrix Q for one Layer.

  • The interface matrix P describes the change of medium.
  • The propagation matrix Q describes the propagation in the thickness of the medium and the phase build-up.
Return ndarray P:
 interface matrix P, 3x3 Numpy array
Return ndarray Q:
 propagation matrix Q, 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 one-dimensional 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 sub-periodicities, given in a list of Models. The entry and exit HalfSpaces of these Models are ignored and replaced by these of the MixedModel. Kx and k0 must be identical throughout all stacked models, which is checked at the initialisation; the Models 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 entry HalfSpace)
  • n_entry (float) – the refractive index of the stack’s entry isotropic semi-infinite medium
  • n_exit (float) – the refractive index of the stack’s exit isotropic semi-infinite 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 the Model and creates an identical non-periodic StackModel (if the Model was periodic, the StackModel 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):

    \begin{bmatrix}
    R_{p \: \text{to} \: p} & R_{s \: \text{to} \: p} \\
    R_{p \: \text{to} \: s} & R_{s \: \text{to} \: s}
\end{bmatrix}

  • in the circular polarisation basis (circ=False):

    \begin{bmatrix}
    R_{RCP \: \text{to} \: RCP} & R_{LCP \: \text{to} \: RCP} \\
    R_{RCP \: \text{to} \: LCP} & R_{LCP \: \text{to} \: LCP}
\end{bmatrix}

Returns:

transmittance: 2x2 Numpy array whose values correspond to:

  • in the linear polarisation basis (circ=False):

    \begin{bmatrix}
    T_{p \: \text{to} \: p} & T_{s \: \text{to} \: p} \\
    T_{p \: \text{to} \: s} & T_{s \: \text{to} \: s}
\end{bmatrix}

  • in the circular polarisation basis (circ=False):

    \begin{bmatrix}
    T_{RCP \: \text{to} \: RCP} & T_{LCP \: \text{to} \: RCP} \\
    T_{RCP \: \text{to} \: LCP} & T_{LCP \: \text{to} \: LCP}
\end{bmatrix}

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 class Model 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 of Model: it will have an empty Structure and its Layers (Model.structure.layers) can be added manually (Structure.add_layer()). The parameters of Models are:

Parameters:
  • n_entry (float) – the refractive index of the stack’s entry isotropic semi-infinite medium
  • n_exit (float) – the refractive index of the stack’s exit isotropic semi-infinite 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 the Model and creates an identical non-periodic StackModel (if the Model was periodic, the StackModel 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):

    \begin{bmatrix}
    R_{p \: \text{to} \: p} & R_{s \: \text{to} \: p} \\
    R_{p \: \text{to} \: s} & R_{s \: \text{to} \: s}
\end{bmatrix}

  • in the circular polarisation basis (circ=False):

    \begin{bmatrix}
    R_{RCP \: \text{to} \: RCP} & R_{LCP \: \text{to} \: RCP} \\
    R_{RCP \: \text{to} \: LCP} & R_{LCP \: \text{to} \: LCP}
\end{bmatrix}

Returns:

transmittance: 2x2 Numpy array whose values correspond to:

  • in the linear polarisation basis (circ=False):

    \begin{bmatrix}
    T_{p \: \text{to} \: p} & T_{s \: \text{to} \: p} \\
    T_{p \: \text{to} \: s} & T_{s \: \text{to} \: s}
\end{bmatrix}

  • in the circular polarisation basis (circ=False):

    \begin{bmatrix}
    T_{RCP \: \text{to} \: RCP} & T_{LCP \: \text{to} \: RCP} \\
    T_{RCP \: \text{to} \: LCP} & T_{LCP \: \text{to} \: LCP}
\end{bmatrix}

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 semi-infinite medium
  • n_exit (float) – the refractive index of the stack’s exit isotropic semi-infinite 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 one-dimensional 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 initially-empty dictionary Spectrum.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 by Spectrum.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 dictionary Spectrum.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 p-polarisation to outgoing p-polarisation, 1d Numpy array
    • Spectrum.data["R_p_to_s"]: reflection spectrum for incoming p-polarisation to outgoing s-polarisation, 1d Numpy array
    • Spectrum.data["R_s_to_p"]: reflection spectrum for incoming s-polarisation to outgoing p-polarisation, 1d Numpy array
    • Spectrum.data["R_s_to_s"]: reflection spectrum for incoming s-polarisation to outgoing s-polarisation, 1d Numpy array
  • in the circular polarisation basis (circ=False):

    • Spectrum.data["R_R_to_R"]: reflection spectrum for incoming RCP-polarisation to outgoing RCP-polarisation, 1d Numpy array
    • Spectrum.data["R_R_to_L"]: reflection spectrum for incoming RCP-polarisation to outgoing LCP-polarisation, 1d Numpy array
    • Spectrum.data["R_L_to_R"]: reflection spectrum for incoming LCP-polarisation to outgoing RCP-polarisation, 1d Numpy array
    • Spectrum.data["R_L_to_L"]: reflection spectrum for incoming LCP-polarisation to outgoing LCP-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 (non-default) 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 of Spectrum.data and Spectrum.wl_list are exported.

Parameters:
  • path_out (string) – path of the file to save the spectrum. It must end with ".mat" (to save in MATLAB-compatible format) or ".pck" (to save with Pickles in Python-compatible format).
  • with_param (bool) – True to save the Spectrum’s model parameters in addition to the content of Spectrum.data,

False (default) to only save the content of Spectrum.data.

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.

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 semi-infinite medium
  • n_exit (float) – the refractive index of the stack’s exit isotropic semi-infinite 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 the StackModel.

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 the StackModel.

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 sub-stack from the StackModel (and return a new instance of StackModel).

Parameters:
  • index_first_layer – index of the first Layer
  • index_last_layer – index of the last Layer to extract + 1 (if index_first_layer = index_last_layer, the

sub-stack contains the Layer indexed index_first_layer) :return: a StackModel

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 rotated Layer and replaces the non-rotated Layer by the rotated Layer in the Structure.

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 is hold=True.

rotate_layers(layer_number_list, rot_angle_rad_list, rot_axis='z')

This function applies the function rotate_layer on several Layers. See rotate_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 semi-infinite medium
  • n_exit (float) – the refractive index of the stack’s exit isotropic semi-infinite 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
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 semi-infinite medium (instance of HalfSpace)
  • an isotropic exit semi-infinite medium (instance of HalfSpace)
  • the number of periods N, which means that the list of layers will be repeated N times
Parameters:
  • Kx (float) – x-component of the normalised wavevector (stays the same throughought the stack)
  • Ky (float) – y-component of the normalised wavevector (equal to 0 by construction)
  • Kz (float) – z-component of the normalised wavevector (changes in each layer)
  • k0 (float) –

    normalisation factor of the wavevector:

    \begin{bmatrix}
    k_x \\
    k_y \\
    k_z
\end{bmatrix}
=
k_0
\begin{bmatrix}
    K_x \\
    K_y \\
    K_z
\end{bmatrix}

    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 function Structure.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 function Structure.is_layer_compatible(layer)). Compatible Layers are added, non-compatible Layers 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 x-component of the normalised wavevector and its normalisation factor k_0 must stay the same in all structures.

Parameters:structures_list (list) – a list of Structures
Return bool:True if all Structures 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 sub-stacks.

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 sub-stacks.

Returns:scattering matrix, a 4x4 Numpy array
static build_scattering_matrix_to_next(layer_a, layer_b)

This function constructs the scattering matrix S_{ab} between two successive layers a and b 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 a to layer b, a 4x4 Numpy array

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 sub-stacks.

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 a, b and c by combining the scattering matrices S_{ab} from layer a to layer b and S_{bc} from layer b to layer c.

Parameters:
  • S_ab (ndarray) – the scattering matrix from layer a to layer b, a 4x4 Numpy array
  • S_bc (ndarray) – the scattering matrix from layer b to layer c, a 4x4 Numpy array
Returns:

partial scattering matrix from layer a to layer c, 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:

    \begin{bmatrix}
    r_{p \: \text{to} \: p} & r_{s \: \text{to} \: p} \\
    r_{p \: \text{to} \: s} & r_{s \: \text{to} \: s}
\end{bmatrix}

  • J_trans (ndarray) –

    2x2 Numpy array whose values correspond to:

    \begin{bmatrix}
    t_{p \: \text{to} \: p} & t_{s \: \text{to} \: p} \\
    t_{p \: \text{to} \: s} & t_{s \: \text{to} \: s}
\end{bmatrix}

Return J_refl_c:
 

2x2 Numpy array whose values correspond to:

\begin{bmatrix}
    r_{RCP \: \text{to} \: RCP} & r_{LCP \: \text{to} \: RCP} \\
    r_{RCP \: \text{to} \: LCP} & r_{LCP \: \text{to} \: LCP}
\end{bmatrix}

Return J_trans_c:
 

2x2 Numpy array whose values correspond to:

\begin{bmatrix}
    t_{RCP \: \text{to} \: RCP} & t_{LCP \: \text{to} \: RCP} \\
    t_{RCP \: \text{to} \: LCP} & t_{LCP \: \text{to} \: LCP}
\end{bmatrix}

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:

\begin{bmatrix}
    r_{p \: \text{to} \: p} & r_{s \: \text{to} \: p} \\
    r_{p \: \text{to} \: s} & r_{s \: \text{to} \: s}
\end{bmatrix}

Return J_trans:

2x2 Numpy array whose values correspond to:

\begin{bmatrix}
    t_{p \: \text{to} \: p} & t_{s \: \text{to} \: p} \\
    t_{p \: \text{to} \: s} & t_{s \: \text{to} \: s}
\end{bmatrix}

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 exit HalfSpaces will be ignored.
  • entry – instance of HalfSpace that constitutes the stack’s entry semi-infinite medium
  • exit – instance of HalfSpace that constitutes the stack’s exit semi-infinite 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:

\begin{bmatrix}
    r_{p \: \text{to} \: p} & r_{s \: \text{to} \: p} \\
    r_{p \: \text{to} \: s} & r_{s \: \text{to} \: s}
\end{bmatrix}

Return J_trans:

2x2 Numpy array whose values correspond to:

\begin{bmatrix}
    t_{p \: \text{to} \: p} & t_{s \: \text{to} \: p} \\
    t_{p \: \text{to} \: s} & t_{s \: \text{to} \: s}
\end{bmatrix}

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

    \begin{bmatrix}
    R_{p \: \text{to} \: p} & R_{s \: \text{to} \: p} \\
    R_{p \: \text{to} \: s} & R_{s \: \text{to} \: s}
\end{bmatrix}

  • in the circular polarisation basis (circ=False):

    \begin{bmatrix}
    R_{RCP \: \text{to} \: RCP} & R_{LCP \: \text{to} \: RCP} \\
    R_{RCP \: \text{to} \: LCP} & R_{LCP \: \text{to} \: LCP}
\end{bmatrix}

Returns:

transmittance: 2x2 Numpy array whose values correspond to:

  • in the linear polarisation basis (circ=False):

    \begin{bmatrix}
    T_{p \: \text{to} \: p} & T_{s \: \text{to} \: p} \\
    T_{p \: \text{to} \: s} & T_{s \: \text{to} \: s}
\end{bmatrix}

  • in the circular polarisation basis (circ=False):

    \begin{bmatrix}
    T_{RCP \: \text{to} \: RCP} & T_{LCP \: \text{to} \: RCP} \\
    T_{RCP \: \text{to} \: LCP} & T_{LCP \: \text{to} \: LCP}
\end{bmatrix}

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 exit HalfSpaces will be ignored.
  • entry – instance of HalfSpace that constitutes the stack’s entry semi-infinite medium
  • exit – instance of HalfSpace that constitutes the stack’s exit semi-infinite 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):

    \begin{bmatrix}
    R_{p \: \text{to} \: p} & R_{s \: \text{to} \: p} \\
    R_{p \: \text{to} \: s} & R_{s \: \text{to} \: s}
\end{bmatrix}

  • in the circular polarisation basis (circ=False):

    \begin{bmatrix}
    R_{RCP \: \text{to} \: RCP} & R_{LCP \: \text{to} \: RCP} \\
    R_{RCP \: \text{to} \: LCP} & R_{LCP \: \text{to} \: LCP}
\end{bmatrix}

Returns:

transmittance: 2x2 Numpy array whose values correspond to:

  • in the linear polarisation basis (circ=False):

    \begin{bmatrix}
    T_{p \: \text{to} \: p} & T_{s \: \text{to} \: p} \\
    T_{p \: \text{to} \: s} & T_{s \: \text{to} \: s}
\end{bmatrix}

  • in the circular polarisation basis (circ=False):

    \begin{bmatrix}
    T_{RCP \: \text{to} \: RCP} & T_{LCP \: \text{to} \: RCP} \\
    T_{RCP \: \text{to} \: LCP} & T_{LCP \: \text{to} \: LCP}
\end{bmatrix}

is_layer_compatible(layer)

This function checks if the layer layer is compatible with the structure: the x-component of the normalised wavevector and its normalisation factor k_0 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 the Layer at the index layer_index.

Parameters:layer_index (int) – index of the Layer to remove
replace_layer(layer_index, new_layer)

This function replaces the Layer at the index layer_index by the Layer new_layer provided it is compatible with the structure (see function Structure.is_layer_compatible(layer)).

Parameters:
  • layer_index (int) – index of the Layer to replace
  • new_layerLayer to add
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 x- (tangential) component of its normalised wavevector
Parameters:
  • epsilon (ndarray) – permittivity tensor: a 3x3 Numpy array
  • Kx (float) – x-component of the normalised wavevector
  • Ex (float) – x-component of the electric field
  • Ey (float) – y-component of the electric field
  • Hx (float) – x-component of the magnetic field
  • Hy (float) – y-component of the magnetic field
static calc_Ez_Hz(epsilon, Kx, Ex, Ey, Hy)

This function calculates the z-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 s-like and p-like 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 \psi = [E_x, H_y, E_y, -H_x], 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 \psi_0, \psi_1, \psi_2 and \psi_3 whose values correspond to:

    \begin{bmatrix}
    E_{x, \: 0} & E_{x, \: 1} & E_{x, \: 2} & E_{x, \: 3} \\
    H_{y, \: 0} & H_{y, \: 1} & H_{y, \: 2} & H_{y, \: 3} \\
    E_{y, \: 0} & E_{y, \: 1} & E_{y, \: 2} & E_{y, \: 3} \\
    -H_{x, \: 0} & -H_{x, \: 1} & -H_{x, \: 2} & -H_{x, \: 3}
\end{bmatrix}

  • epsilon (ndarray) – permittivity tensor: 3x3 Numpy array
  • Kx (float) – the x- (tangential) component of its normalised wavevector
Returns:

list of 4 corresponding Waves [w_0, w_1, w_2, w_3]

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 E_x, E_y, H_x and H_y are arranged so that the matrix can be used as a transition matrix for the layer. The function extracts a vector \psi = [E_x, H_y, E_y, -H_x] for each of the 4 waves and formats them into a matrix where each column is a \psi.

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 \psi 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 \psi_0, \psi_1, \psi_2 and \psi_3 whose values correspond to:

\begin{bmatrix}
    E_{x, \: 0} & E_{x, \: 1} & E_{x, \: 2} & E_{x, \: 3} \\
    H_{y, \: 0} & H_{y, \: 1} & H_{y, \: 2} & H_{y, \: 3} \\
    E_{y, \: 0} & E_{y, \: 1} & E_{y, \: 2} & E_{y, \: 3} \\
    -H_{x, \: 0} & -H_{x, \: 1} & -H_{x, \: 2} & -H_{x, \: 3}
\end{bmatrix}

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 one-dimensional 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

Indices and tables