From 994b8848a367579a915e5cbb6ae8f3ee8ba1e076 Mon Sep 17 00:00:00 2001 From: MTerwissen <49401241+MTerwissen@users.noreply.github.com> Date: Wed, 14 Oct 2026 14:50:51 +0200 Subject: [PATCH 1/7] DOC: fix typos in documentation --- docs/amplitude-analysis/analytic-continuation.ipynb | 2 +- docs/usage.ipynb | 2 +- docs/usage/basics.ipynb | 8 ++++---- docs/usage/caching.ipynb | 2 +- docs/usage/faster-lambdify.ipynb | 2 +- src/tensorwaves/estimator.py | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/amplitude-analysis/analytic-continuation.ipynb b/docs/amplitude-analysis/analytic-continuation.ipynb index c0bb6abf..11e73b03 100644 --- a/docs/amplitude-analysis/analytic-continuation.ipynb +++ b/docs/amplitude-analysis/analytic-continuation.ipynb @@ -74,7 +74,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Of the two resonances, $a_0(980)$ lies just below threshold ― it's mass is smaller than the the masses of the two decay products combined:" + "Of the two resonances, $a_0(980)$ lies just below threshold ― its mass is smaller than the masses of the two decay products combined:" ] }, { diff --git a/docs/usage.ipynb b/docs/usage.ipynb index af46a7b3..a628ac42 100644 --- a/docs/usage.ipynb +++ b/docs/usage.ipynb @@ -57,7 +57,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The most important feature of TensorWaves are the {mod}`.optimizer` and {mod}`.estimator` modules. These can be used to optimize the parameters in a {class}`.ParametrizedFunction` to a data distribution. Here is a one-dimensional example for a {obj}`~numpy.random.normal` distribution!" + "The most important features of TensorWaves are the {mod}`.optimizer` and {mod}`.estimator` modules. These can be used to optimize the parameters in a {class}`.ParametrizedFunction` to a data distribution. Here is a one-dimensional example for a {obj}`~numpy.random.normal` distribution!" ] }, { diff --git a/docs/usage/basics.ipynb b/docs/usage/basics.ipynb index ae16c143..f60d1d3b 100644 --- a/docs/usage/basics.ipynb +++ b/docs/usage/basics.ipynb @@ -316,7 +316,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "So, we now have a function $f$ of $x$ expressed in some computational backend. This function is to describe a distribution over $x$. In the real world, $x$ is an observable from a process you measure. But sometimes, it's useful to generate a 'toy' data sample for your model function as well, to try it out." + "So, we now have a function $f$ of $x$ expressed in some computational backend. This function is used to describe a distribution over $x$. In the real world, $x$ is an observable from a process you measure. But sometimes, it's useful to generate a 'toy' data sample for your model function as well, to try it out." ] }, { @@ -421,12 +421,12 @@ "source": [ "There is one problem though: _how to determine $y_\\mathrm{max}$?_ In this example, we can just read off the value of $y_\\mathrm{max}$, or even compute it analytically from the original {class}`sympy.Expr `. This is not the case generally though, so we need to apply a trick.\n", "\n", - "Since we are generating **uniformly distributed** random values values of $x$ and computing their $f(x)$ values, we can keep track of which values of $f(x)$ is the highest. Starting with $y_\\mathrm{max} = 0$ we just set $y_\\mathrm{max} = f(x)$ once $f(x) > y_\\mathrm{max}$ and _completely restart_ the generate loop. Eventually, some value of $x$ will lie near the absolute maximum of $f$ and the data generation will happily continue until the requested number of events has been reached.\n", + "Since we are generating **uniformly distributed** random values of $x$ and computing their $f(x)$ values, we can keep track of which value of $f(x)$ is the highest. Starting with $y_\\mathrm{max} = 0$ we just set $y_\\mathrm{max} = f(x)$ once $f(x) > y_\\mathrm{max}$ and _completely restart_ the generate loop. Eventually, some value of $x$ will lie near the absolute maximum of $f$ and the data generation will happily continue until the requested number of events has been reached.\n", "\n", "```{warning}\n", "There are two caveats:\n", "1. The domain sample (here: the uniformly distributed values of $x$) has to be large in order for the data sample to accurately describe the original function.\n", - "2. The the function displays narrow structures, like some sharp global maximum containing $y_\\mathrm{max}$, changes are smaller that the value of $x$ will lie within this peak. The domain sample will therefore have to be even larger. It will also take longer before $y_\\mathrm{max}$ is found.\n", + "2. If the function displays narrow structures, like some sharp global maximum containing $y_\\mathrm{max}$, chances are smaller that the value of $x$ will lie within this peak. The domain sample will therefore have to be even larger. It will also take longer before $y_\\mathrm{max}$ is found.\n", "```" ] }, @@ -884,7 +884,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The idea illustrated above works for any number of dimensions. Let's create multiply the expression we had with some $\\cos$ as a function of $y$:" + "The idea illustrated above works for any number of dimensions. Let's multiply the expression we had with some $\\cos$ as a function of $y$:" ] }, { diff --git a/docs/usage/caching.ipynb b/docs/usage/caching.ipynb index e4d54495..558f46e4 100644 --- a/docs/usage/caching.ipynb +++ b/docs/usage/caching.ipynb @@ -368,7 +368,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "How to use this 'cached' {class}`.ParametrizedFunction` and {class}`.DataTransformer`? And is the output of that function the same as the normal functions created with {func}`.create_parametrized_function`? Let's generate generate a small {obj}`.DataSample` for the domain $x, y$:" + "How to use this 'cached' {class}`.ParametrizedFunction` and {class}`.DataTransformer`? And is the output of that function the same as the normal functions created with {func}`.create_parametrized_function`? Let's generate a small {obj}`.DataSample` for the domain $x, y$:" ] }, { diff --git a/docs/usage/faster-lambdify.ipynb b/docs/usage/faster-lambdify.ipynb index 13ac8123..9b377a58 100644 --- a/docs/usage/faster-lambdify.ipynb +++ b/docs/usage/faster-lambdify.ipynb @@ -63,7 +63,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Lambdifying a SymPy expression can take rather long when an expression is complicated. Fortunately, TensorWaves offers a way to speed up the lambdify process. The idea is to split up an an expression into sub-expressions, separate those separately, and then recombining them. Let's illustrate that idea with the following simplified example:" + "Lambdifying a SymPy expression can take rather long when an expression is complicated. Fortunately, TensorWaves offers a way to speed up the lambdify process. The idea is to split up an expression into sub-expressions, lambdify those separately, and then recombine them. Let's illustrate that idea with the following simplified example:" ] }, { diff --git a/src/tensorwaves/estimator.py b/src/tensorwaves/estimator.py index 3e3ef68e..b0a92fbf 100644 --- a/src/tensorwaves/estimator.py +++ b/src/tensorwaves/estimator.py @@ -54,7 +54,7 @@ def create_cached_function( A 'cached' `.ParametrizedFunction` with only the free `~.ParametrizedFunction.parameters` that are to be optimized and a `.DataTransformer` that needs to be used to transform a data sample for the - original expresion to the cached function. + original expression to the cached function. .. seealso:: This function is an extension of :func:`.prepare_caching` and :func:`.create_parametrized_function`. :doc:`/usage/caching` shows how From 3131678f210cba0ef24a57dbb6d15029d512ce6b Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 14 Oct 2026 13:01:04 +0000 Subject: [PATCH 2/7] MAINT: implement updates from formatters --- docs/amplitude-analysis/analytic-continuation.ipynb | 2 +- docs/usage.ipynb | 2 +- docs/usage/basics.ipynb | 2 +- docs/usage/caching.ipynb | 2 +- docs/usage/faster-lambdify.ipynb | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/amplitude-analysis/analytic-continuation.ipynb b/docs/amplitude-analysis/analytic-continuation.ipynb index 11e73b03..cacf0e1b 100644 --- a/docs/amplitude-analysis/analytic-continuation.ipynb +++ b/docs/amplitude-analysis/analytic-continuation.ipynb @@ -232,7 +232,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.15" + "version": "3.13.16" } }, "nbformat": 4, diff --git a/docs/usage.ipynb b/docs/usage.ipynb index a628ac42..d5adf8ff 100644 --- a/docs/usage.ipynb +++ b/docs/usage.ipynb @@ -787,7 +787,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.15" + "version": "3.13.16" } }, "nbformat": 4, diff --git a/docs/usage/basics.ipynb b/docs/usage/basics.ipynb index f60d1d3b..419d99df 100644 --- a/docs/usage/basics.ipynb +++ b/docs/usage/basics.ipynb @@ -1263,7 +1263,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.13" + "version": "3.13.16" } }, "nbformat": 4, diff --git a/docs/usage/caching.ipynb b/docs/usage/caching.ipynb index 558f46e4..662ff58f 100644 --- a/docs/usage/caching.ipynb +++ b/docs/usage/caching.ipynb @@ -488,7 +488,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.15" + "version": "3.13.16" } }, "nbformat": 4, diff --git a/docs/usage/faster-lambdify.ipynb b/docs/usage/faster-lambdify.ipynb index 9b377a58..f610a6c9 100644 --- a/docs/usage/faster-lambdify.ipynb +++ b/docs/usage/faster-lambdify.ipynb @@ -373,7 +373,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.12" + "version": "3.13.16" } }, "nbformat": 4, From b190ebfc5d5ee38379146f095b35b105ad86a4bc Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 14 Oct 2026 15:24:40 +0200 Subject: [PATCH 3/7] DOC: fix more spelling and grammar mistakes --- docs/amplitude-analysis.ipynb | 26 +++++++++---------- .../analytic-continuation.ipynb | 4 +-- docs/install.md | 6 ++--- docs/usage.ipynb | 10 +++---- docs/usage/basics.ipynb | 20 +++++++------- docs/usage/caching.ipynb | 4 +-- docs/usage/chi-squared.ipynb | 2 +- docs/usage/faster-lambdify.ipynb | 4 +-- docs/usage/unbinned-fit.ipynb | 6 ++--- 9 files changed, 41 insertions(+), 41 deletions(-) diff --git a/docs/amplitude-analysis.ipynb b/docs/amplitude-analysis.ipynb index c29aefc1..720b6ece 100644 --- a/docs/amplitude-analysis.ipynb +++ b/docs/amplitude-analysis.ipynb @@ -238,7 +238,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Optionally, we can backup the {class}`~ampform.helicity.HelicityModel` to disk via {mod}`pickle`. The {class}`~qrules.transition.ReactionInfo` object (which takes longest to generate) can also be pickled, or it can also be serialized to JSON:" + "Optionally, we can back up the {class}`~ampform.helicity.HelicityModel` to disk via {mod}`pickle`. The {class}`~qrules.transition.ReactionInfo` object (which takes longest to generate) can also be pickled, or it can also be serialized to JSON:" ] }, { @@ -422,7 +422,7 @@ ":::\n", "\n", ":::{warning}\n", - "When using the helicity formalism, the sum of the four-momenta should be in the rest frame, that is $\\sum_i p_i = \\left(m_A, 0, 0, 0\\right)$ with $m_A$ the mass of the decaying particle $A$. This is because the helicity formalisms boosts through the decay chain starting from particle $A$. **Take care to boost your experimental data into the rest frame**, optionally following the {doc}`kinematics classes provided by AmpForm `.\n", + "When using the helicity formalism, the sum of the four-momenta should be in the rest frame, that is $\\sum_i p_i = \\left(m_A, 0, 0, 0\\right)$ with $m_A$ the mass of the decaying particle $A$. This is because the helicity formalism boosts through the decay chain starting from particle $A$. **Take care to boost your experimental data into the rest frame**, optionally following the {doc}`kinematics classes provided by AmpForm `.\n", ":::" ] }, @@ -624,7 +624,7 @@ "Check the remark about four-momentum format and rest frame of the decaying particle [here](compwa-step-2.1).\n", "::::\n", "\n", - "The {obj}`.DataSample` is a mapping of kinematic variables names to a 1-dimensional array of values. The numbers you see here are final state IDs as defined in the {class}`~ampform.helicity.HelicityModel` member of the {class}`~ampform.helicity.HelicityModel`:" + "The {obj}`.DataSample` is a mapping of kinematic variable names to a 1-dimensional array of values. The numbers you see here are final state IDs as defined in the {class}`~ampform.helicity.HelicityModel` member of the {class}`~ampform.helicity.HelicityModel`:" ] }, { @@ -817,7 +817,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "In principle, we can use the same {class}`.ParametrizedFunction` as the one that we created in [](compwa-step-2.2). However, when fitting such a function to a data distribution, an {class}`.Optimizer` will evaluate this function numerous times, so it is smart to apply some optimizations to the underlying expression tree before-hand.\n", + "In principle, we can use the same {class}`.ParametrizedFunction` as the one that we created in [](compwa-step-2.2). However, when fitting such a function to a data distribution, an {class}`.Optimizer` will evaluate this function numerous times, so it is smart to apply some optimizations to the underlying expression tree beforehand.\n", "\n", ":::{tip}\n", "\n", @@ -1028,7 +1028,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Since the final state particles $\\gamma, \\pi^0, \\pi^0$ are **stable**, we can substitute their invariant masses $m_0, m_1, m_2$ with scalar values. SymPy will then further simply the expression, so that the computation is less complex." + "Since the final state particles $\\gamma, \\pi^0, \\pi^0$ are **stable**, we can substitute their invariant masses $m_0, m_1, m_2$ with scalar values. SymPy will then further simplify the expression, so that the computation is less complex." ] }, { @@ -1074,7 +1074,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Note that some of the computed kinematic variable arrays are complex-valued. This can be useful in come cases, but in this decay channel, all kinematic variable values lie on the real axis. The fit can therefore be further optimized by casting the data arrays to real values:" + "Note that some of the computed kinematic variable arrays are complex-valued. This can be useful in some cases, but in this decay channel, all kinematic variable values lie on the real axis. The fit can therefore be further optimized by casting the data arrays to real values:" ] }, { @@ -1236,7 +1236,7 @@ "\n", "As noted under [](compwa-step-3.1), most of what is described in this section can be achieved with the function {func}`.create_cached_function`. The idea is described on {doc}`/usage/caching`, but in this section, we show how this translates to amplitude analysis.\n", "\n", - "First, note that {func}`.create_cached_function` works with mappings and iterable of {class}`sympy.Symbol ` and not with the {obj}`str` mappings that we defined in [](#determine-free-parameters). We can convert the parameter names back to {class}`~sympy.core.symbol.Symbol`s as follows:" + "First, note that {func}`.create_cached_function` works with mappings and iterables of {class}`sympy.Symbol ` and not with the {obj}`str` mappings that we defined in [](#determine-free-parameters). We can convert the parameter names back to {class}`~sympy.core.symbol.Symbol`s as follows:" ] }, { @@ -1354,7 +1354,7 @@ "source": [ "To perform a fit, you need to define an {class}`.Estimator`. This is a measure for the discrepancy between the {class}`.ParametrizedFunction` and the data distribution to which you fit it. In PWA, we usually use an **unbinned negative log likelihood estimator** ({class}`.UnbinnedNLL`).\n", "\n", - "Generally, the {class}`.ParametrizedFunction` is not normalized with regards to the data sample, while a log likelihood estimator requires a normalized function. This is where the [phase space data](compwa-step-2.1) comes into play again: the {class}`.ParametrizedFunction` is evaluated over the phase space data, so that its output can be used as a normalization factor.\n", + "Generally, the {class}`.ParametrizedFunction` is not normalized with regard to the data sample, while a log likelihood estimator requires a normalized function. This is where the [phase space data](compwa-step-2.1) comes into play again: the {class}`.ParametrizedFunction` is evaluated over the phase space data, so that its output can be used as a normalization factor.\n", "\n", "```{margin}\n", "If you want to correct for the efficiency of the detector, you should use a *detector-reconstructed* phase space sample.\n", @@ -1487,7 +1487,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Finally, we are ready to create an {class}`.Optimizer` that can {meth}`~.Minuit2.optimize` the parameters in the {class}`.ParametrizedFunction` (which is embedded in the {class}`.Estimator`). Here, we choose the {class}`.Minuit2` optimizer, which is the most common optimizer in high-energy physics (see also {ref}`usage/basics:Perform fit with different optimizers`). Since we constructed the {class}`.UnbinnedNLL` with {obj}`jax `, can an optimize the model with analytic gradient over the {class}`.ParametrizedBackendFunction`:\n", + "Finally, we are ready to create an {class}`.Optimizer` that can {meth}`~.Minuit2.optimize` the parameters in the {class}`.ParametrizedFunction` (which is embedded in the {class}`.Estimator`). Here, we choose the {class}`.Minuit2` optimizer, which is the most common optimizer in high-energy physics (see also {ref}`usage/basics:Perform fit with different optimizers`). Since we constructed the {class}`.UnbinnedNLL` with {obj}`jax `, we can optimize the model with an analytic gradient over the {class}`.ParametrizedBackendFunction`:\n", "\n", ":::{note}\n", "\n", @@ -1582,7 +1582,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "In [](compwa-step-3.3), we initialized {obj}`.Minuit2` with a {class}`.Loadable` callback. Such callback classes offer the possibility to {meth}`~.Loadable.load_latest_parameters`, so you can pick up the optimize process in case it crashes or if you pause it. Loading the latest parameters goes as follows:" + "In [](compwa-step-3.3), we initialized {obj}`.Minuit2` with a {class}`.Loadable` callback. Such callback classes offer the possibility to {meth}`~.Loadable.load_latest_parameters`, so you can pick up the optimization process in case it crashes or if you pause it. Loading the latest parameters goes as follows:" ] }, { @@ -1652,7 +1652,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Each of the {mod}`.optimizer`s offer more specific information about the fit result. This information can be accessed with {attr}`.FitResult.specifics`. A common example would be to get the {attr}`~iminuit.Minuit.covariance` matrix and {attr}`~iminuit.util.Matrix.correlation` matrix:" + "Each of the {mod}`.optimizer`s offers more specific information about the fit result. This information can be accessed with {attr}`.FitResult.specifics`. A common example would be to get the {attr}`~iminuit.Minuit.covariance` matrix and {attr}`~iminuit.util.Matrix.correlation` matrix:" ] }, { @@ -1736,7 +1736,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "As we have seen [when formulating the amplitude model](#build-amplitude-model), the helicity model is built up of an incoherent sum of real-valued intensities (one for each spin combination), which are each built up of a coherent sum of complex-valued amplitudes (one for each resonance). If we want to compute what each of these amplitudes contribute to the main intensity, we should use the optimized intensity and set coefficients or helicity couplings of amplitudes that were are not interested in to zero." + "As we have seen [when formulating the amplitude model](#build-amplitude-model), the helicity model is built up of an incoherent sum of real-valued intensities (one for each spin combination), which are each built up of a coherent sum of complex-valued amplitudes (one for each resonance). If we want to compute what each of these amplitudes contributes to the main intensity, we should use the optimized intensity and set coefficients or helicity couplings of amplitudes that we are not interested in to zero." ] }, { @@ -1868,7 +1868,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We can also use these functions to compute the decay rates for each resonance. Notice how the sum of the decay rates does not add up to a 100%. This is because of the strong constructive interference between the resonances in this model." + "We can also use these functions to compute the decay rates for each resonance. Notice how the sum of the decay rates does not add up to 100%. This is because of the strong constructive interference between the resonances in this model." ] }, { diff --git a/docs/amplitude-analysis/analytic-continuation.ipynb b/docs/amplitude-analysis/analytic-continuation.ipynb index cacf0e1b..c1c5f739 100644 --- a/docs/amplitude-analysis/analytic-continuation.ipynb +++ b/docs/amplitude-analysis/analytic-continuation.ipynb @@ -107,7 +107,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To correctly describe the dynamics for this resonance, we should use make use of {doc}`analytic continuation `. As opposed to {ref}`compwa-step-1`, we now construct a {class}`~ampform.dynamics.builder.RelativisticBreitWignerBuilder` where we set its phase space factor to {class}`~ampform.dynamics.phasespace.PhaseSpaceFactorSWave`:" + "To correctly describe the dynamics for this resonance, we should make use of {doc}`analytic continuation `. As opposed to {ref}`compwa-step-1`, we now construct a {class}`~ampform.dynamics.builder.RelativisticBreitWignerBuilder` where we set its phase space factor to {class}`~ampform.dynamics.phasespace.PhaseSpaceFactorSWave`:" ] }, { @@ -141,7 +141,7 @@ "source": [ ":::{margin}\n", "\n", - "Note that we have reduced the coupling for the sub-threshold resonance $a_0(980)^0$, so that it doesn't dominate over $a_2(1320)^0$ resonance.\n", + "Note that we have reduced the coupling for the sub-threshold resonance $a_0(980)^0$, so that it doesn't dominate over the $a_2(1320)^0$ resonance.\n", "\n", ":::\n", "\n", diff --git a/docs/install.md b/docs/install.md index f3904faf..16221c8b 100644 --- a/docs/install.md +++ b/docs/install.md @@ -85,15 +85,15 @@ TensorWaves also respects JAX's `JAX_ENABLE_X64` environment variable. An explic -Computations with are fastest on a +Computations are fastest on a [GPU](https://en.wikipedia.org/wiki/Graphics_processing_unit). To get JAX and TensorFlow -work with your graphics card, you need to install at least +to work with your graphics card, you need to install at least [CUDA Toolkit **11.2**](https://developer.nvidia.com/cuda-downloads) and [cuDNN **8.1**](https://developer.nvidia.com/cudnn). Below is an installation guide for installing TF and JAX with GPU support. These instructions may become outdated, so refer to -[this TF page](https://www.tensorflow.org/install/gpu) an +[this TF page](https://www.tensorflow.org/install/gpu) and [these JAX instructions](https://docs.jax.dev/en/latest/installation.html#supported-platforms) if you run into trouble. diff --git a/docs/usage.ipynb b/docs/usage.ipynb index d5adf8ff..364fca47 100644 --- a/docs/usage.ipynb +++ b/docs/usage.ipynb @@ -98,7 +98,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "TensorWaves can express this mathematical expression as a computation function {ref}`in different kinds of backends `, so that we can perform fast computations on large data samples. Here, we identify some of the {class}`~sympy.core.symbol.Symbol`s in the expression as parameters and create a {class}`.ParametrizedFunction`, so that we can 'fit' the function to the generated distribution." + "TensorWaves can express this mathematical expression as a computational function {ref}`in different kinds of backends `, so that we can perform fast computations on large data samples. Here, we identify some of the {class}`~sympy.core.symbol.Symbol`s in the expression as parameters and create a {class}`.ParametrizedFunction`, so that we can 'fit' the function to the generated distribution." ] }, { @@ -497,7 +497,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The {mod}`.data` module comes with tools to generate {ref}`hit-and-miss ` data samples for a given expression. In addition, instance of the {class}`.DataTransformer` interface allow transforming {obj}`.DataSample`s to a different coordinate system. An example would be to describe a distribution in polar coordinates $(r, \\phi)$:" + "The {mod}`.data` module comes with tools to generate {ref}`hit-and-miss ` data samples for a given expression. In addition, instances of the {class}`.DataTransformer` interface allow transforming {obj}`.DataSample`s to a different coordinate system. An example would be to describe a distribution in polar coordinates $(r, \\phi)$:" ] }, { @@ -532,7 +532,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "While the expression is described in polar coordinates, the input data arrays could be measured in a cartesian coordinate system. The data arrays can be converted efficiently with a {class}`.SympyDataTransformer`:" + "While the expression is described in polar coordinates, the input data arrays could be measured in a Cartesian coordinate system. The data arrays can be converted efficiently with a {class}`.SympyDataTransformer`:" ] }, { @@ -581,14 +581,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We can now generate a domain sample for the function as well as an intensity distribution based on that expression using the {mod}`tensorwaves.data` module. Again, we first express the mathematical expression a computational function." + "We can now generate a domain sample for the function as well as an intensity distribution based on that expression using the {mod}`tensorwaves.data` module. Again, we first express the mathematical expression as a computational function." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "We then define a domain generator and a hit-and-miss {class}`.IntensityDistributionGenerator` with which we can generate a data distribution **in cartesian coordinates** for this expression in polar coordinates." + "We then define a domain generator and a hit-and-miss {class}`.IntensityDistributionGenerator` with which we can generate a data distribution **in Cartesian coordinates** for this expression in polar coordinates." ] }, { diff --git a/docs/usage/basics.ipynb b/docs/usage/basics.ipynb index 419d99df..55104ff5 100644 --- a/docs/usage/basics.ipynb +++ b/docs/usage/basics.ipynb @@ -14,9 +14,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "At core, {mod}`tensorwaves` is a package that can 'fit' arbitrary mathematical expressions to a data set using different computational back-ends. It can also use those expressions to describe a distribution over which to generate data samples.\n", + "At its core, {mod}`tensorwaves` is a package that can 'fit' arbitrary mathematical expressions to a data set using different computational back-ends. It can also use those expressions to describe a distribution over which to generate data samples.\n", "\n", - "This page illustrate what's going on behind the scenes with some simple 1-dimensional and 2-dimensional expressions. The main steps are:\n", + "This page illustrates what's going on behind the scenes with some simple 1-dimensional and 2-dimensional expressions. The main steps are:\n", "\n", "1. Formulate a mathematical expression with {mod}`sympy`.\n", "2. Generate a distribution data sample for that expression.\n", @@ -133,7 +133,7 @@ "source": [ "The expression above consists of a number of {class}`~sympy.core.symbol.Symbol`s that we want to identify as **parameters** (that we want to optimize with regard to a certain data sample) and **variables** (in which the data sample is expressed). Let's say $x$ is the variable and that the rest of the {class}`~sympy.core.symbol.Symbol`s are the parameters.\n", "\n", - "Here, we'll pick some default values for the parameter and use them to plot the model with regard to the variable $x$ (see {meth}`~sympy.core.basic.Basic.subs`). The default values are used later on as well when we generate data." + "Here, we'll pick some default values for the parameters and use them to plot the model with regard to the variable $x$ (see {meth}`~sympy.core.basic.Basic.subs`). The default values are used later on as well when we generate data." ] }, { @@ -181,7 +181,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "So far, all we did was using {mod}`sympy` to symbolically formulate a mathematical expression. We now need to {func}`~sympy.utilities.lambdify.lambdify` that expression to some computational backend, so that we can efficiently generate data and/or optimize the parameters in the function to 'fit' the model to some data sample. TensorWaves can do this with the {func}`.create_parametrized_function` function:" + "So far, all we did was use {mod}`sympy` to symbolically formulate a mathematical expression. We now need to {func}`~sympy.utilities.lambdify.lambdify` that expression to some computational backend, so that we can efficiently generate data and/or optimize the parameters in the function to 'fit' the model to some data sample. TensorWaves can do this with the {func}`.create_parametrized_function` function:" ] }, { @@ -441,7 +441,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "First of all, we need to randomly generate values of $x$. In this simple, 1-dimensional example, we could just use a random generator like {class}`numpy.random.Generator` feed its output to the {meth}`.ParametrizedFunction.__call__`. Generally, though, we want to cover $n$-dimensional cases. The class {class}`.NumpyDomainGenerator` allows us to generate such a **uniform** distribution for each variable within a certain range. It requires a {class}`.RealNumberGenerator` (here we use {class}`.NumpyUniformRNG`) and it also requires us to define boundaries for each variable in the resulting {obj}`.DataSample`." + "First of all, we need to randomly generate values of $x$. In this simple, 1-dimensional example, we could just use a random generator like {class}`numpy.random.Generator` and feed its output to the {meth}`.ParametrizedFunction.__call__`. Generally, though, we want to cover $n$-dimensional cases. The class {class}`.NumpyDomainGenerator` allows us to generate such a **uniform** distribution for each variable within a certain range. It requires a {class}`.RealNumberGenerator` (here we use {class}`.NumpyUniformRNG`) and it also requires us to define boundaries for each variable in the resulting {obj}`.DataSample`." ] }, { @@ -463,7 +463,7 @@ "source": [ ":::{tip}\n", "\n", - "Set a `seed` in the {class}`.RealNumberGenerator` if you want to generate **deterministic** data sample. If you leave it unspecified, you get an **indeterministic** data sample.\n", + "Set a `seed` in the {class}`.RealNumberGenerator` if you want to generate a **deterministic** data sample. If you leave it unspecified, you get an **non-deterministic** data sample.\n", "\n", ":::\n", "\n", @@ -481,7 +481,7 @@ "\n", ":::\n", "\n", - "When we feed the sample generated domain sample to the {class}`.ParametrizedBackendFunction` and use it its output values as weights to the histogram of the uniform domain sample, we see that the domain nicely produces a distribution as expected from the {ref}`model we defined `:" + "When we feed the generated domain sample to the {class}`.ParametrizedBackendFunction` and use its output values as weights to the histogram of the uniform domain sample, we see that the domain nicely produces a distribution as expected from the {ref}`model we defined `:" ] }, { @@ -613,7 +613,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "...compare what this looks like compared to the data..." + "...see what this looks like compared to the data..." ] }, { @@ -1109,7 +1109,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "#### Scipy" + "#### SciPy" ] }, { @@ -1132,7 +1132,7 @@ "source": [ ":::{warning}\n", "\n", - "Scipy does not provide error values for the optimized parameters.\n", + "SciPy does not provide error values for the optimized parameters.\n", "\n", ":::" ] diff --git a/docs/usage/caching.ipynb b/docs/usage/caching.ipynb index 662ff58f..b0471cb2 100644 --- a/docs/usage/caching.ipynb +++ b/docs/usage/caching.ipynb @@ -36,7 +36,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Let's have a look how this works for a simple expression. Caching makes more sense in complicated expressions like the ones in {doc}`/amplitude-analysis`, but this simple expression illustrates the idea." + "Let's have a look at how this works for a simple expression. Caching makes more sense in complicated expressions like the ones in {doc}`/amplitude-analysis`, but this simple expression illustrates the idea." ] }, { @@ -95,7 +95,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Note, however, that resulting {class}`.ParametrizedFunction` will have to compute the entire expression tree on each iteration, even though we only want to optimize the blue parameters:" + "Note, however, that the resulting {class}`.ParametrizedFunction` will have to compute the entire expression tree on each iteration, even though we only want to optimize the blue parameters:" ] }, { diff --git a/docs/usage/chi-squared.ipynb b/docs/usage/chi-squared.ipynb index 72fa45f0..37d26115 100644 --- a/docs/usage/chi-squared.ipynb +++ b/docs/usage/chi-squared.ipynb @@ -58,7 +58,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Next, we uniformly generate data points $\\mathbf{x}$ a line segment. The corresponding values for $\\mathbf{y}$ are computed with the above polynomial function and smeared with a small, normally distributed offset." + "Next, we uniformly generate data points $\\mathbf{x}$ on a line segment. The corresponding values for $\\mathbf{y}$ are computed with the above polynomial function and smeared with a small, normally distributed offset." ] }, { diff --git a/docs/usage/faster-lambdify.ipynb b/docs/usage/faster-lambdify.ipynb index f610a6c9..d2c63e36 100644 --- a/docs/usage/faster-lambdify.ipynb +++ b/docs/usage/faster-lambdify.ipynb @@ -147,7 +147,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Each of the expression trees are now smaller than the original:" + "Each of the expression trees is now smaller than the original:" ] }, { @@ -212,7 +212,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Generally, the lambdify time scales exponentially with the size of an expression tree. With larger expression trees, it's therefore much faster to lambdify these sub-expressions separately and to recombine them. TensorWaves offers a function that does this for you: {func}`.fast_lambdify`. We'll use an {class}`~ampform.helicity.HelicityModel` to illustrate this:" + "Generally, the lambdify time scales exponentially with the size of an expression tree. With larger expression trees, it's therefore much faster to lambdify these sub-expressions separately and to recombine them. TensorWaves offers a function that does this for you: {func}`.fast_lambdify`. We'll use a {class}`~ampform.helicity.HelicityModel` to illustrate this:" ] }, { diff --git a/docs/usage/unbinned-fit.ipynb b/docs/usage/unbinned-fit.ipynb index a59b8126..fb2bf79b 100644 --- a/docs/usage/unbinned-fit.ipynb +++ b/docs/usage/unbinned-fit.ipynb @@ -139,7 +139,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We would like to find values for $\\mu, \\sigma_x, \\sigma_y$, so that the expression describe this distribution as best as possible. For this, we first formulate this expression as a {class}`.ParametrizedFunction` in a specific computational backend, so that we can use it to quickly compute values over a number of data points. We also provide some initial guesses for the parameter values:" + "We would like to find values for $\\mu, \\sigma_x, \\sigma_y$, so that the expression describes this distribution as well as possible. For this, we first formulate this expression as a {class}`.ParametrizedFunction` in a specific computational backend, so that we can use it to quickly compute values over a number of data points. We also provide some initial guesses for the parameter values:" ] }, { @@ -200,7 +200,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Next, we use a {class}`.UnbinnedNLL` optimize the parameters with regard to the data distribution. Note that a {class}`.UnbinnedNLL` requires a domain over which to integrate the {class}`.ParametrizedFunction`, in order to normalize the log likelihood." + "Next, we use an {class}`.UnbinnedNLL` to optimize the parameters with regard to the data distribution. Note that an {class}`.UnbinnedNLL` requires a domain over which to integrate the {class}`.ParametrizedFunction`, in order to normalize the log likelihood." ] }, { @@ -242,7 +242,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The values are indeed close to the default values for {func}`numpy.random.rayleigh` ($\\sigma_x=1$) {func}`numpy.random.normal` ($\\mu=0, \\sigma_y=1$), with which the data distribution was generated." + "The values are indeed close to the default values for {func}`numpy.random.rayleigh` ($\\sigma_x=1$) and {func}`numpy.random.normal` ($\\mu=0, \\sigma_y=1$), with which the data distribution was generated." ] }, { From 22924a6558df3dfcd1ce8eaae429698cdbd9f80c Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 14 Oct 2026 15:32:03 +0200 Subject: [PATCH 4/7] FIX: fix typos in private function names --- src/tensorwaves/function/_backend.py | 2 +- src/tensorwaves/function/sympy/__init__.py | 6 +++--- tests/function/test_sympy.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/tensorwaves/function/_backend.py b/src/tensorwaves/function/_backend.py index c1668b0e..f5cd72ee 100644 --- a/src/tensorwaves/function/_backend.py +++ b/src/tensorwaves/function/_backend.py @@ -64,7 +64,7 @@ def get_backend_modules(backend: str | tuple | dict) -> str | tuple | dict: return backend -def get_jit_compile_dectorator( +def get_jit_compile_decorator( backend: str, use_jit: bool | None ) -> Callable[[Callable[P, T]], Callable[P, T]]: if use_jit is None: diff --git a/src/tensorwaves/function/sympy/__init__.py b/src/tensorwaves/function/sympy/__init__.py index 28bcad82..3438b8c6 100644 --- a/src/tensorwaves/function/sympy/__init__.py +++ b/src/tensorwaves/function/sympy/__init__.py @@ -11,7 +11,7 @@ from tensorwaves.function import ParametrizedBackendFunction, PositionalArgumentFunction from tensorwaves.function._backend import ( get_backend_modules, - get_jit_compile_dectorator, + get_jit_compile_decorator, raise_missing_module_error, ) @@ -280,7 +280,7 @@ def tensorflow_lambdify() -> Callable: use_cse=use_cse, ) - jit_compile = get_jit_compile_dectorator(backend, use_jit) + jit_compile = get_jit_compile_decorator(backend, use_jit) modules = get_backend_modules(backend) if isinstance(backend, str): if backend == "jax": @@ -378,7 +378,7 @@ def fast_lambdify( # ruff:ignore[too-many-arguments] sub_expression, symbols, backend, use_cse=use_cse, use_jit=use_jit ) sub_functions.append(sub_function) - jit_compile = get_jit_compile_dectorator(backend, use_jit=use_jit) + jit_compile = get_jit_compile_decorator(backend, use_jit=use_jit) @jit_compile def recombined_function(*args: Any) -> Any: diff --git a/tests/function/test_sympy.py b/tests/function/test_sympy.py index f4149b9f..f574b42d 100644 --- a/tests/function/test_sympy.py +++ b/tests/function/test_sympy.py @@ -43,8 +43,8 @@ def describe_collect_constant_sub_expressions(): ) def it_collects_the_sub_expressions_without_free_symbols(free_symbols, expected): expression = a * x + b * (c * x**2 + d * x**2) - sub_expresions = _collect_constant_sub_expressions(expression, free_symbols) - assert sub_expresions == expected + sub_expressions = _collect_constant_sub_expressions(expression, free_symbols) + assert sub_expressions == expected def describe_create_function(): From 96f348be79cba142dac6d3f05e144320ab2261d9 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 14 Oct 2026 15:32:25 +0200 Subject: [PATCH 5/7] DX: disallow compound words in cspell --- .cspell.json | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.cspell.json b/.cspell.json index 05b71c61..8d55bfdf 100644 --- a/.cspell.json +++ b/.cspell.json @@ -1,5 +1,5 @@ { - "allowCompoundWords": true, + "allowCompoundWords": false, "enableFiletypes": [ "git-commit", "github-actions-workflow", @@ -43,15 +43,19 @@ "allclose", "ampform", "arange", + "argnames", + "argvalues", "aslatex", "asmermaid", "atfi", + "automethod", "autoupdate", "axhline", "axvline", "bdist", "bgcolor", "cano", + "caplog", "capsys", "celltoolbar", "classmethod", @@ -72,14 +76,17 @@ "dphi", "dtype", "eqnarray", + "errordef", "eval", "evalf", "figsize", "filterwarnings", "fmin", "fontsize", + "forceobj", "fval", "genindex", + "getfixturevalue", "getsource", "gridspec", "heli", @@ -88,6 +95,7 @@ "iloc", "imag", "iminuit", + "indentless", "indeterministic", "ioff", "ipykernel", @@ -109,10 +117,14 @@ "logdir", "macos", "mathbf", + "mathcal", "mathrm", "maxdepth", + "maxval", "meshgrid", + "migrad", "mimetype", + "minval", "modindex", "mprime", "nbconvert", @@ -129,17 +141,20 @@ "noreply", "nrows", "numba", + "numpycode", "outfile", "pandoc", "pcolormesh", "phasespace", "phsp", + "poethepoet", "prange", "precommit", "prefactor", "prek", "preorder", "prereleased", + "printmethod", "pwa's", "py's", "pygments", @@ -149,13 +164,16 @@ "pytestconfig", "qrules", "rightarrow", + "rowdict", "rtfd", "rtol", + "scimath", "scipy", "sdist", "seealso", "sharex", "sharey", + "sphinxcontrib", "startswith", "staticmethod", "subsys", @@ -167,6 +185,7 @@ "unflattened", "unnormalized", "unsubscriptable", + "usefixtures", "vstack", "waves's", "wspace", From 8d7db59c1fcb6b58a57d04360351914510b14b1c Mon Sep 17 00:00:00 2001 From: GitHub Date: Wed, 14 Oct 2026 13:46:33 +0000 Subject: [PATCH 6/7] MAINT: implement updates from formatters --- docs/amplitude-analysis.ipynb | 2 +- docs/usage/chi-squared.ipynb | 2 +- docs/usage/unbinned-fit.ipynb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/amplitude-analysis.ipynb b/docs/amplitude-analysis.ipynb index 720b6ece..281255fe 100644 --- a/docs/amplitude-analysis.ipynb +++ b/docs/amplitude-analysis.ipynb @@ -1919,7 +1919,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.15" + "version": "3.13.16" } }, "nbformat": 4, diff --git a/docs/usage/chi-squared.ipynb b/docs/usage/chi-squared.ipynb index 37d26115..f087ed73 100644 --- a/docs/usage/chi-squared.ipynb +++ b/docs/usage/chi-squared.ipynb @@ -230,7 +230,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.12" + "version": "3.13.16" } }, "nbformat": 4, diff --git a/docs/usage/unbinned-fit.ipynb b/docs/usage/unbinned-fit.ipynb index fb2bf79b..63701eeb 100644 --- a/docs/usage/unbinned-fit.ipynb +++ b/docs/usage/unbinned-fit.ipynb @@ -292,7 +292,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.13.12" + "version": "3.13.16" } }, "nbformat": 4, From f6de324e30ccd5ec2f1f62a333b6839b51c80659 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Wed, 14 Oct 2026 15:47:09 +0200 Subject: [PATCH 7/7] MAINT: unwrap hard-wrapped lines in Markdown files --- README.md | 17 ++++--------- docs/index.md | 11 +++------ docs/install.md | 63 +++++++++++++------------------------------------ 3 files changed, 24 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index a6af935a..d7c56f5b 100644 --- a/README.md +++ b/README.md @@ -21,18 +21,11 @@ [![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv) [![ty](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ty/main/assets/badge/v0.json)](https://github.com/astral-sh/ty) -TensorWaves is a fitter package that optimizes mathematical models to data samples. The -models can be any _symbolic_ mathematical expression that is then converted to any -computational backend. In addition, TensorWaves provides functionality to generate toy -Monte Carlo data samples. The package is developed in parallel with -[AmpForm](https://github.com/ComPWA/ampform), which implements physics models, but its -'lambdifying' mechanisms can in principle be used independently. - -All documentation can be found on -[tensorwaves.rtfd.io](https://tensorwaves.readthedocs.io). - -For an overview of **upcoming releases and planned functionality**, see -[here](https://github.com/ComPWA/tensorwaves/milestones?direction=asc&sort=title&state=open). +TensorWaves is a fitter package that optimizes mathematical models to data samples. The models can be any _symbolic_ mathematical expression that is then converted to any computational backend. In addition, TensorWaves provides functionality to generate toy Monte Carlo data samples. The package is developed in parallel with [AmpForm](https://github.com/ComPWA/ampform), which implements physics models, but its 'lambdifying' mechanisms can in principle be used independently. + +All documentation can be found on [tensorwaves.rtfd.io](https://tensorwaves.readthedocs.io). + +For an overview of **upcoming releases and planned functionality**, see [here](https://github.com/ComPWA/tensorwaves/milestones?direction=asc&sort=title&state=open). ## Contribute diff --git a/docs/index.md b/docs/index.md index 8ad3af5f..5bb834f2 100644 --- a/docs/index.md +++ b/docs/index.md @@ -17,14 +17,9 @@ TensorWaves originates from [`pycompwa`](https://github.com/ComPWA/pycompwa), wh ::: -TensorWaves is an optimizer package that can 'fit' mathematical models (expressed with -{mod}`sympy`) to data distributions using a variety of computational back-ends, -optimizers, and estimator functions. In addition, the {mod}`tensorwaves.data` module -helps one to generate data distributions for those mathematical expressions. - -The package is developed in parallel with {doc}`AmpForm `, which -implements physics models for amplitude analysis, but its mechanisms for creating -computational backend functions can in principle be used independently. +TensorWaves is an optimizer package that can 'fit' mathematical models (expressed with {mod}`sympy`) to data distributions using a variety of computational back-ends, optimizers, and estimator functions. In addition, the {mod}`tensorwaves.data` module helps one to generate data distributions for those mathematical expressions. + +The package is developed in parallel with {doc}`AmpForm `, which implements physics models for amplitude analysis, but its mechanisms for creating computational backend functions can in principle be used independently. ::::{grid} 1 2 2 2 diff --git a/docs/install.md b/docs/install.md index 16221c8b..f811e879 100644 --- a/docs/install.md +++ b/docs/install.md @@ -10,10 +10,7 @@ The fastest way of installing this package is through PyPI or Conda: :::{margin} -TensorWaves can work with different computational backends. They are provided through -{ref}`optional dependencies `. -[JAX](https://docs.jax.dev) is usually the fastest backend, so it's recommended to -install that as in the install examples here. +TensorWaves can work with different computational backends. They are provided through {ref}`optional dependencies `. [JAX](https://docs.jax.dev) is usually the fastest backend, so it's recommended to install that as in the install examples here. ::: @@ -24,8 +21,7 @@ install that as in the install examples here. python3 -m pip install tensorwaves[jax] ``` -To install the package with support for {doc}`amplitude analysis ` -run: +To install the package with support for {doc}`amplitude analysis ` run: ```shell python3 -m pip install tensorwaves[jax,pwa] @@ -38,8 +34,7 @@ python3 -m pip install tensorwaves[jax,pwa] conda install -c conda-forge tensorwaves jax jaxlib ``` -To install the package with support for {doc}`amplitude analysis ` -run: +To install the package with support for {doc}`amplitude analysis ` run: ```shell conda install -c conda-forge ampform phasespace @@ -48,9 +43,7 @@ conda install -c conda-forge ampform phasespace ::: :::: -This installs the [latest release](https://github.com/ComPWA/tensorwaves/releases) that -you can find on the [`stable`](https://github.com/ComPWA/tensorwaves/tree/stable) -branch. +This installs the [latest release](https://github.com/ComPWA/tensorwaves/releases) that you can find on the [`stable`](https://github.com/ComPWA/tensorwaves/tree/stable) branch. Optional dependencies can be installed as follows: @@ -85,26 +78,12 @@ TensorWaves also respects JAX's `JAX_ENABLE_X64` environment variable. An explic -Computations are fastest on a -[GPU](https://en.wikipedia.org/wiki/Graphics_processing_unit). To get JAX and TensorFlow -to work with your graphics card, you need to install at least -[CUDA Toolkit **11.2**](https://developer.nvidia.com/cuda-downloads) and -[cuDNN **8.1**](https://developer.nvidia.com/cudnn). - -Below is an installation guide for installing TF and JAX with GPU support. These -instructions may become outdated, so refer to -[this TF page](https://www.tensorflow.org/install/gpu) and -[these JAX instructions](https://docs.jax.dev/en/latest/installation.html#supported-platforms) if you -run into trouble. - -1. Download and install CUDA Toolkit **11.x** by following - [these platform-dependent instructions](https://developer.nvidia.com/cuda-downloads). - There may be dependency conflicts with existing NVIDIA packages. In that case, have a - look - [here](https://forums.developer.nvidia.com/t/cuda-install-unmet-dependencies-cuda-depends-cuda-10-0-10-0-130-but-it-is-not-going-to-be-installed/66488/6?u=user85126). -2. Tell the system where to find CUDA. In Ubuntu (or WSL-Ubuntu), this can be done by - adding the following line to your - [`.bashrc`](https://unix.stackexchange.com/a/129144) file: +Computations are fastest on a [GPU](https://en.wikipedia.org/wiki/Graphics_processing_unit). To get JAX and TensorFlow to work with your graphics card, you need to install at least [CUDA Toolkit **11.2**](https://developer.nvidia.com/cuda-downloads) and [cuDNN **8.1**](https://developer.nvidia.com/cudnn). + +Below is an installation guide for installing TF and JAX with GPU support. These instructions may become outdated, so refer to [this TF page](https://www.tensorflow.org/install/gpu) and [these JAX instructions](https://docs.jax.dev/en/latest/installation.html#supported-platforms) if you run into trouble. + +1. Download and install CUDA Toolkit **11.x** by following [these platform-dependent instructions](https://developer.nvidia.com/cuda-downloads). There may be dependency conflicts with existing NVIDIA packages. In that case, have a look [here](https://forums.developer.nvidia.com/t/cuda-install-unmet-dependencies-cuda-depends-cuda-10-0-10-0-130-but-it-is-not-going-to-be-installed/66488/6?u=user85126). +2. Tell the system where to find CUDA. In Ubuntu (or WSL-Ubuntu), this can be done by adding the following line to your [`.bashrc`](https://unix.stackexchange.com/a/129144) file: ```shell export PATH="$PATH:/usr/local/cuda/bin" @@ -112,25 +91,17 @@ run into trouble. But first, check if `/usr/local/cuda/bin` indeed exists! -3. Restart your machine. Then, launch a terminal to - [check whether CUDA is installed](https://stackoverflow.com/a/9730706): +3. Restart your machine. Then, launch a terminal to [check whether CUDA is installed](https://stackoverflow.com/a/9730706): ```shell nvcc --version ``` -4. Download and install cuDNN following - [these instructions](https://docs.nvidia.com/deeplearning/cudnn/installation/latest/index.html). - Make sure that you download cuDNN **for CUDA 11.x**! +4. Download and install cuDNN following [these instructions](https://docs.nvidia.com/deeplearning/cudnn/installation/latest/index.html). Make sure that you download cuDNN **for CUDA 11.x**! - In Ubuntu (Debian), there are two convenient options: (1) - [installing through `apt`](https://docs.nvidia.com/deeplearning/cudnn/installation/latest/linux.html#package-manager-local-installation) - or (2) - [using a local installer](https://docs.nvidia.com/deeplearning/cudnn/installation/latest/linux.html#package-manager-local-installation). + In Ubuntu (Debian), there are two convenient options: (1) [installing through `apt`](https://docs.nvidia.com/deeplearning/cudnn/installation/latest/linux.html#package-manager-local-installation) or (2) [using a local installer](https://docs.nvidia.com/deeplearning/cudnn/installation/latest/linux.html#package-manager-local-installation). -5. **[Recommended]** Install JAX with GPU binaries in your - {ref}`virtual environment ` following - [these instructions](https://docs.jax.dev/en/latest/installation.html#supported-platforms). +5. **[Recommended]** Install JAX with GPU binaries in your {ref}`virtual environment ` following [these instructions](https://docs.jax.dev/en/latest/installation.html#supported-platforms). ```shell pip install --upgrade jax[cuda] jaxlib -f https://storage.googleapis.com/jax-releases/jax_releases.html @@ -138,8 +109,7 @@ run into trouble. It doesn't matter whether you do this before or after installing TensorWaves. -6. If TensorFlow can correctly find your GPU, the following should return a non-empty - list: +6. If TensorFlow can correctly find your GPU, the following should return a non-empty list: ```shell python3 -c 'import tensorflow as tf; print(tf.config.list_physical_devices("GPU"))' @@ -156,8 +126,7 @@ run into trouble. ::::: -The latest version on the [`main`](https://github.com/ComPWA/tensorwaves/tree/main) -branch (or any other branch, tag, or commit) can be installed as follows: +The latest version on the [`main`](https://github.com/ComPWA/tensorwaves/tree/main) branch (or any other branch, tag, or commit) can be installed as follows: ```shell python3 -m pip install git+https://github.com/ComPWA/tensorwaves@main