Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/ltex.dictionary.en-US.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dispersions
dataframes
ellipsometry
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ pip install pyElli[fitting]
```

This installs pyElli with the additional fitting capabilities and interactive widgets.
If don't want to have this functionality just drop the `[fitting]` in the end.
If you don't want to have this functionality just drop the `[fitting]` in the end.

To increase performance of the 4x4 Solver, it is recommended to
install PyTorch manually, as it is too big to include in the standard installation.
Installation information can be found at the [PyTorch Website](https://pytorch.org/get-started/locally/).
The CPU variant is sufficient, if you want to save some space.

A complete environment for pyElli is also available as a [Docker Container](https://hub.docker.com/r/domna/pyelli).
To pull and run it directly just execute
Expand Down Expand Up @@ -74,4 +79,4 @@ pip install -e ".[fitting]"
- Solver2x2 based on Steve Byrnes' [tmm](https://github.com/sbyrnes321/tmm)
- Mikhail Polyanskiy's [refractiveindex.info database](https://github.com/polyanskiy/refractiveindex.info-database) and Pavel Dmitriev's [pyTMM](https://github.com/kitchenknif/PyTMM) for his importer script for the database

[@MarJMue](https://github.com/MarJMue) recieves financial support by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation), grant No. 398143140 (FOR 2824).
[@MarJMue](https://github.com/MarJMue) receives financial support by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation), grant No. 398143140 (FOR 2824).
4 changes: 2 additions & 2 deletions docs/dispersions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ DispersionSum
This object can be used to add an arbitrary number of dispersions.
The overloaded `+` operator of the dispersion base class creates an instance
of this object with two classes as parameters.
If you want to chain a lot of dispersions it may be more performant to use
If you want to chain a lot of dispersions, it may be more performant to use
this class directly.

.. autoclass:: elli.dispersions.base_dispersion.DispersionSum
Expand All @@ -274,6 +274,6 @@ this class directly.

InvalidParameters
-----------------
This exception is thrown whenever a dispersions got invalid parameters.
This exception is thrown whenever a dispersion got invalid parameters.

.. autoexception:: elli.dispersions.base_dispersion.InvalidParameters
6 changes: 3 additions & 3 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ However, pyElli comes with batteries included and already offers a wide range
of :doc:`dispersion models<dispersions>` and the material database of Refractiveindex.info.

Most of the models presented in the
comprehensive book of Fujiwara and Colllins [1]_ are present and additionally
a lot of other models used by ellipsometry vendor softwares are included.
comprehensive book of Fujiwara and Collins [1]_ are present and additionally
a lot of other models used by ellipsometry vendor software are included.

The material database offers the dispersions seen on the `website <https://refractiveindex.info/>`_
and can be accessed by using the :class:`elli.db.RII<elli.db.RII>` module.
Expand Down Expand Up @@ -54,7 +54,7 @@ but can contain arbitrary more :class:`layers<elli.structure.Layer>` which are o
The :class:`VaryingMixtureLayer<elli.structure.VaryingMixtureLayer>` class can also account for gradient changes of materials in z-direction
of a layer, which is useful for gradient layers or roughness modeling.
As the last step the :class:`Structure<elli.structure.Structure>` is plugged into an :class:`Experiment<elli.experiment.Experiment>`, which contains
the experimental conditions, such as light polarizations.
the experimental conditions, such as light polarization.
By evaluating the experiment a :class:`Result<elli.result.Result>` class containing the calculated data is returned.
The creation of an experiment can be skipped by calling the :meth:`evaluate<elli.structure.Structure.evaluate>` method directly
on a :class:`Structure<elli.structure.Structure>` class if you want to use standard experimental settings.
Expand Down
10 changes: 9 additions & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,15 @@ To install the package in your current virtual environment execute

.. code-block:: shell

pip install pyElli
pip install pyElli[fitting]

This installs pyElli with the additional fitting capabilities and interactive widgets.
If you don't want to have this functionality just drop the `[fitting]` in the end.

To increase performance of the 4x4 Solver, it is recommended to
install PyTorch manually, as it is too big to include in the standard installation.
Installation information can be found at the `PyTorch Website <https://pytorch.org/get-started/locally/>`_.
The CPU variant is sufficient, if you want to save some space.

A complete environment for pyElli is also available as a
`Docker Container <https://hub.docker.com/r/domna/pyelli>`_.
Expand Down
4 changes: 2 additions & 2 deletions docs/plot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Interactive fitting
PyElli offers several classes and decorators to make fitting easy.
The central idea is to construct a class containing the measurement data and an optical model
which is fitted to the data with `lmfit <https://lmfit.github.io/lmfit-py/index.html>`_.
Since pyElli uses lmfit under the hood you may take advantage of it's vast capabilities.
Since pyElli uses lmfit under the hood you may take advantage of its vast capabilities.

To make creation of the fitting classes as easy as possible pyElli contains decorators to
automatically instantiate the class by providing a function containing the optical model.
Expand Down Expand Up @@ -56,7 +56,7 @@ be inherited from in additional fitting classes.

Parameter class
---------------
The parameter class extending lmfits Parameter class by a history
The parameter class extending lmfit's Parameter class by a history
of parameter changes.

.. automodule:: elli.fitting.params_hist
Expand Down
1 change: 1 addition & 0 deletions docs/solvers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pyElli provides different implementations to be used in the calculation of the t
The :class:`PropagatorEig<elli.solver4x4.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 :class:`PropagatorExpm<elli.solver4x4.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.

.. rubric:: References

Expand Down
8 changes: 8 additions & 0 deletions src/elli/solver4x4.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ class PropagatorExpm(Propagator):
"""Propagator class using the Padé approximation of the matrix exponential."""

def __init__(self, backend: Literal["torch", "scipy", "automatic"] = "automatic"):
"""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/.

Args:
backend (Literal["torch", "scipy", "automatic"], optional): Setting to change the linear algebra provider. Defaults to "automatic".
"""
backends = {
"torch": lambda mats: torch.linalg.matrix_exp(
torch.from_numpy(mats)
Expand Down