diff --git a/.vscode/ltex.dictionary.en-US.txt b/.vscode/ltex.dictionary.en-US.txt new file mode 100644 index 00000000..9b1509bb --- /dev/null +++ b/.vscode/ltex.dictionary.en-US.txt @@ -0,0 +1,3 @@ +dispersions +dataframes +ellipsometry diff --git a/README.md b/README.md index 1421bd6e..d5e12558 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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). diff --git a/docs/dispersions.rst b/docs/dispersions.rst index 69a32e3e..a73b004b 100644 --- a/docs/dispersions.rst +++ b/docs/dispersions.rst @@ -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 @@ -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 diff --git a/docs/index.rst b/docs/index.rst index 2a87af47..c45c3bbb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -14,8 +14,8 @@ However, pyElli comes with batteries included and already offers a wide range of :doc:`dispersion models` 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 `_ and can be accessed by using the :class:`elli.db.RII` module. @@ -54,7 +54,7 @@ but can contain arbitrary more :class:`layers` which are o The :class:`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` is plugged into an :class:`Experiment`, which contains -the experimental conditions, such as light polarizations. +the experimental conditions, such as light polarization. By evaluating the experiment a :class:`Result` class containing the calculated data is returned. The creation of an experiment can be skipped by calling the :meth:`evaluate` method directly on a :class:`Structure` class if you want to use standard experimental settings. diff --git a/docs/installation.rst b/docs/installation.rst index 392a02ff..26129fa1 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -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 `_. +The CPU variant is sufficient, if you want to save some space. A complete environment for pyElli is also available as a `Docker Container `_. diff --git a/docs/plot.rst b/docs/plot.rst index a6db1213..31acd250 100644 --- a/docs/plot.rst +++ b/docs/plot.rst @@ -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 `_. -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. @@ -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 diff --git a/docs/solvers.rst b/docs/solvers.rst index 0657bb68..39e734c3 100644 --- a/docs/solvers.rst +++ b/docs/solvers.rst @@ -16,6 +16,7 @@ pyElli provides different implementations to be used in the calculation of the t The :class:`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` 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 diff --git a/src/elli/solver4x4.py b/src/elli/solver4x4.py index 6c3a10cd..4f2610de 100644 --- a/src/elli/solver4x4.py +++ b/src/elli/solver4x4.py @@ -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)