diff --git a/docs/amplitude-analysis/phase-space.ipynb b/docs/amplitude-analysis/phase-space.ipynb index 4d107cc3..966943de 100644 --- a/docs/amplitude-analysis/phase-space.ipynb +++ b/docs/amplitude-analysis/phase-space.ipynb @@ -16,7 +16,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Amplitude analysis needs samples of four-momenta that are distributed uniformly over the phase space of a decay. {class}`.TFPhaseSpaceGenerator` produces such samples with [`phasespace`](https://phasespace.readthedocs.io). That package generates *weighted* events, so {class}`.TFPhaseSpaceGenerator` turns them into unweighted events with a hit-and-miss step: an event is kept if a uniform random number is below its weight. This page shows how the `adaptive_max_weight` option makes that step faster without changing the generated distribution." + "Amplitude analysis needs samples of four-momenta that are distributed uniformly over the phase space of a decay. {class}`.TFPhaseSpaceGenerator` produces such samples with [`phasespace`](https://phasespace.readthedocs.io), which can run on TensorFlow, NumPy, or JAX. `phasespace` generates *weighted* events, so {class}`.TFPhaseSpaceGenerator` turns them into unweighted events with a hit-and-miss step: an event is kept if a uniform random number is below its weight. {class}`.TFWeightedPhaseSpaceGenerator` returns the weighted events instead. This page shows how to select a backend and how the `adaptive_max_weight` option makes the hit-and-miss step faster without changing the generated distribution." ] }, { @@ -35,17 +35,13 @@ }, "outputs": [], "source": [ - "import logging\n", "import os\n", "\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", - "import tensorflow as tf\n", "from matplotlib_inline.backend_inline import set_matplotlib_formats\n", "\n", "os.environ[\"TF_CPP_MIN_LOG_LEVEL\"] = \"3\"\n", - "logging.getLogger(\"tensorwaves\").setLevel(logging.ERROR)\n", - "tf.get_logger().setLevel(logging.ERROR)\n", "set_matplotlib_formats(\"svg\")" ] }, @@ -53,7 +49,115 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Hit-and-miss against an estimated maximum weight\n", + "## Backends\n", + "\n", + "The backend is selected with the `backend` argument of the generator. All backends return a {obj}`.DataSample` of NumPy arrays with the same structure, so they can be swapped without changing the rest of an analysis." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from tensorwaves.data import (\n", + " NumpyUniformRNG,\n", + " TFPhaseSpaceGenerator,\n", + " TFUniformRealNumberGenerator,\n", + ")\n", + "\n", + "initial_state_mass = 3.0969\n", + "final_state_masses = {0: 0.1350, 1: 0.1396, 2: 0.4937}\n", + "generators = {\n", + " \"numpy\": (\n", + " TFPhaseSpaceGenerator(initial_state_mass, final_state_masses, backend=\"numpy\"),\n", + " NumpyUniformRNG(seed=0),\n", + " ),\n", + " \"tensorflow\": (\n", + " TFPhaseSpaceGenerator(\n", + " initial_state_mass, final_state_masses, backend=\"tensorflow\"\n", + " ),\n", + " TFUniformRealNumberGenerator(seed=0),\n", + " ),\n", + " \"jax\": (\n", + " TFPhaseSpaceGenerator(initial_state_mass, final_state_masses, backend=\"jax\"),\n", + " NumpyUniformRNG(seed=0),\n", + " ),\n", + "}\n", + "for generator, _ in generators.values():\n", + " generator.show_progress = False" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "| `backend` | Extra | Use of the {class}`.RealNumberGenerator` |\n", + "| --- | --- | --- |\n", + "| `\"tensorflow\"` (default) | `phsp` | {class}`.TFUniformRealNumberGenerator` is used directly, any other type only provides a seed |\n", + "| `\"numpy\"` | `phsp` | {class}`.NumpyUniformRNG` is used directly, any other type only provides a seed |\n", + "| `\"jax\"` | `phsp,jax` | any type only provides a seed |\n", + "\n", + "The NumPy and JAX backends require `phasespace` 2.0 or higher. The installation of these extras is described on {doc}`/install`." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Every backend is used through the same {meth}`~.TFPhaseSpaceGenerator.generate` method. The events of different backends are not identical, not even with the same seed, but they follow the same distribution: a uniform phase space sample shows up as a flat Dalitz plot within the kinematic boundary." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "tags": [ + "hide-input" + ] + }, + "outputs": [], + "source": [ + "def invariant_mass_squared(*momenta: np.ndarray) -> np.ndarray:\n", + " p = np.sum(momenta, axis=0)\n", + " return p[:, 0] ** 2 - np.sum(p[:, 1:] ** 2, axis=1)\n", + "\n", + "\n", + "backend_samples = {\n", + " name: generator.generate(100_000, rng)\n", + " for name, (generator, rng) in generators.items()\n", + "}\n", + "fig, axes = plt.subplots(\n", + " ncols=len(backend_samples), figsize=(4 * len(backend_samples), 3.5), sharey=True\n", + ")\n", + "for ax, (name, sample) in zip(axes, backend_samples.items(), strict=True):\n", + " s01 = invariant_mass_squared(sample[\"p0\"], sample[\"p1\"])\n", + " s12 = invariant_mass_squared(sample[\"p1\"], sample[\"p2\"])\n", + " ax.hist2d(s01, s12, bins=60, cmin=1, rasterized=True)\n", + " ax.set_title(name)\n", + " ax.set_xlabel(R\"$m_{01}^2$ [GeV$^2$]\")\n", + "axes[0].set_ylabel(R\"$m_{12}^2$ [GeV$^2$]\")\n", + "fig.tight_layout()\n", + "plt.show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "TensorFlow is the default, because it reproduces the samples of earlier TensorWaves versions, when combined with a {class}`.TFUniformRealNumberGenerator`. NumPy needs no compilation, so it is the fastest choice for a few small samples. TensorFlow and JAX compile functions on the first call, but are several times faster afterwards, so they are worth it when generating large or many samples for the same decay. JAX can be useful if the rest of the analysis already uses it. {doc}`TR-039 ` benchmarks the backends and compares their distributions for three-body and four-body decays.\n", + "\n", + "There are two things to keep in mind:\n", + "\n", + "- The same seed gives a different sample on each backend. Samples are only reproducible within one backend.\n", + "- `phasespace` selects its backend per process, and a generator activates its backend each time it generates. Each switch makes `phasespace` recompile, so alternating between backends is slow, and generators with different backends should not be used concurrently in threads." + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Adaptive maximum weight\n", "\n", "By default, the random numbers of the hit-and-miss step are drawn up to $1$, the upper bound of the normalized weights that `phasespace` guarantees. The weights that actually occur are often far below that bound, especially for decays into many particles, so most events are rejected. With `adaptive_max_weight=True`, the random numbers are drawn up to an estimate of the maximum weight instead. The estimate is the largest weight seen so far plus a margin of 5%. If a later bunch contains a larger weight, the estimate is raised and the sample is generated anew, so that the result remains unbiased.\n", "\n", @@ -83,7 +187,7 @@ }, "outputs": [], "source": [ - "from tensorwaves.data import TFUniformRealNumberGenerator, TFWeightedPhaseSpaceGenerator\n", + "from tensorwaves.data import TFWeightedPhaseSpaceGenerator\n", "\n", "n_particles = list(range(3, 9))\n", "weights = {}\n", @@ -91,8 +195,9 @@ " weighted_generator = TFWeightedPhaseSpaceGenerator(\n", " initial_state_mass=5.0,\n", " final_state_masses=dict.fromkeys(range(n), 0.13957),\n", + " backend=\"numpy\",\n", " )\n", - " rng = TFUniformRealNumberGenerator(seed=0)\n", + " rng = NumpyUniformRNG(seed=0)\n", " weights[n] = weighted_generator.generate(100_000, rng)[\"weights\"]\n", "\n", "fig, (ax1, ax2) = plt.subplots(ncols=2, figsize=(10, 3.8), layout=\"constrained\")\n", @@ -126,7 +231,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Usage\n", + "### Usage\n", "\n", "The option is a keyword argument of {class}`.TFPhaseSpaceGenerator`. The following example generates a sample of a three-body decay with both settings. The events differ, because the hit-and-miss step consumes the random numbers differently, but both samples are distributed uniformly over phase space: the events fill the kinematically allowed region of the Dalitz plot evenly." ] @@ -137,8 +242,6 @@ "metadata": {}, "outputs": [], "source": [ - "from tensorwaves.data import TFPhaseSpaceGenerator, TFUniformRealNumberGenerator\n", - "\n", "initial_state_mass = 3.0969\n", "final_state_masses = {0: 0.1350, 1: 0.1396, 2: 0.4937}\n", "default_generator = TFPhaseSpaceGenerator(initial_state_mass, final_state_masses)\n", @@ -180,11 +283,6 @@ }, "outputs": [], "source": [ - "def invariant_mass_squared(*momenta: np.ndarray) -> np.ndarray:\n", - " p = np.sum(momenta, axis=0)\n", - " return p[:, 0] ** 2 - np.sum(p[:, 1:] ** 2, axis=1)\n", - "\n", - "\n", "variables = {\n", " label: (\n", " invariant_mass_squared(sample[\"p0\"], sample[\"p1\"]),\n", @@ -207,7 +305,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## When to use the option\n", + "### When to use it\n", "\n", "The option pays off for decays into five or more particles, where the default setting rejects most events. Keep the default when samples have to be identical to those of earlier versions for the same seed, for instance when tests compare against stored values. A small `bunch_size` makes the estimate of the maximum weight less accurate and leads to more restarts, so the option works best with the default bunch size." ] diff --git a/docs/conf.py b/docs/conf.py index eb1a952e..a59bdc70 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -259,6 +259,7 @@ def get_tensorflow_url() -> str: nb_render_markdown_format = "myst" nitpick_ignore = [ ("std:doc", "compwa-report:038/index"), + ("std:doc", "compwa-report:039/index"), ("py:class", "tensorflow.keras.losses.Loss"), ("py:class", "tensorflow.python.keras.losses.Loss"), ("py:obj", "Loss"), diff --git a/pyproject.toml b/pyproject.toml index 049c7d39..d041a6cf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,6 +108,7 @@ style = [ { include-group = "types" }, ] test = [ + "phasespace>=2.0.0", "pyarrow", "pytest-benchmark", "pytest-cov", diff --git a/src/tensorwaves/data/phasespace.py b/src/tensorwaves/data/phasespace.py index 1de7ddd5..473def33 100644 --- a/src/tensorwaves/data/phasespace.py +++ b/src/tensorwaves/data/phasespace.py @@ -3,7 +3,7 @@ from __future__ import annotations import logging -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Literal import numpy as np from tqdm.auto import tqdm @@ -17,17 +17,26 @@ merge_events, select_events, ) -from .rng import TFUniformRealNumberGenerator +from .rng import NumpyUniformRNG, TFUniformRealNumberGenerator if TYPE_CHECKING: from collections.abc import Mapping import tensorflow as tf +Backend = Literal["numpy", "tensorflow", "jax"] +"""Computational backend used by the phase space generators.""" + _LOGGER = logging.getLogger(__name__) _MAX_PHASESPACE_WEIGHT = 1.0 """Upper bound of the normalized weights that `phasespace` generates.""" +_BACKEND_EXTRAS: dict[str, tuple[str, str]] = { + "numpy": ("numpy", ""), + "tensorflow": ("tensorflow", "tf"), + "jax": ("jax", "jax"), +} + class TFPhaseSpaceGenerator(DataGenerator): """Implements a phase space generator using tensorflow. @@ -45,6 +54,7 @@ class TFPhaseSpaceGenerator(DataGenerator): `.IntensityDistributionGenerator`. The generated distribution stays the same, but the events differ from those that are generated without this option for the same seed. See :doc:`/amplitude-analysis/phase-space`. + :param backend: Computational backend of `TFWeightedPhaseSpaceGenerator`. """ def __init__( @@ -54,9 +64,10 @@ def __init__( bunch_size: int = 50_000, *, adaptive_max_weight: bool = False, + backend: Backend = "tensorflow", ) -> None: self.__phsp_generator = TFWeightedPhaseSpaceGenerator( - initial_state_mass, final_state_masses + initial_state_mass, final_state_masses, backend=backend ) self.__bunch_size = bunch_size self.__adaptive_max_weight = adaptive_max_weight @@ -122,6 +133,12 @@ class TFWeightedPhaseSpaceGenerator(DataGenerator): :param initial_state_mass: Mass of the decaying state. :param final_state_masses: Masses keyed by final-state ID. + :param backend: Computational backend that `phasespace + `_ uses to generate the sample. The + ``"numpy"`` and ``"jax"`` backends require ``phasespace`` 2.0 or higher, and + ``"jax"`` also requires the ``jax`` extra. The generated arrays are always NumPy + arrays. A `.RealNumberGenerator` that does not belong to the backend provides a + seed, so samples stay reproducible. .. seealso:: @@ -132,11 +149,16 @@ def __init__( self, initial_state_mass: float, final_state_masses: Mapping[int, float], + *, + backend: Backend = "tensorflow", ) -> None: - try: - import phasespace # ruff:ignore[import-outside-top-level] - except ImportError: # pragma: no cover - raise_missing_module_error("phasespace", extras_require="phsp") + if backend not in _BACKEND_EXTRAS: + msg = f'Backend must be one of {sorted(_BACKEND_EXTRAS)}, got "{backend}"' + raise ValueError(msg) + self.__backend = backend + _activate_backend(backend) + import phasespace # ruff:ignore[import-outside-top-level] + sorted_ids = sorted(final_state_masses) self.__phsp_gen = phasespace.nbody_decay( mass_top=initial_state_mass, @@ -151,23 +173,48 @@ def generate(self, size: int, rng: RealNumberGenerator) -> DataSample: A `tuple` of a `.DataSample` (**four-momenta**) with an event-wise sequence of weights. The four-momenta are arrays of shape :math:`n \times 4`. """ - if not isinstance(rng, TFUniformRealNumberGenerator): - msg = ( - f"{type(self).__name__} requires a" - f" {TFUniformRealNumberGenerator.__name__}, but got a" - f" {type(rng).__name__}" - ) - raise TypeError(msg) - weights, particles = self.__phsp_gen.generate(n_events=size, seed=rng.generator) + _activate_backend(self.__backend) + weights, particles = self.__phsp_gen.generate( + n_events=size, seed=_get_seed(rng, self.__backend) + ) phsp_momenta = { - f"p{label}": _to_numpy(momenta)[:, [3, 0, 1, 2]] + f"p{label}": np.asarray(momenta)[:, [3, 0, 1, 2]] for label, momenta in particles.items() } return { - "weights": _to_numpy(weights), + "weights": np.asarray(weights), **phsp_momenta, } -def _to_numpy(tensor: tf.Tensor) -> np.ndarray: - return tensor.numpy() +def _activate_backend(backend: Backend) -> None: + """Select the process-wide `phasespace` backend. + + The previous backend is deliberately not restored afterwards, because each switch + makes `phasespace` recompile its functions, which would happen for every bunch. + Versions of `phasespace` before 2.0 only support TensorFlow. + """ + try: + import phasespace # ruff:ignore[import-outside-top-level] + except ImportError: # pragma: no cover + raise_missing_module_error("phasespace", extras_require="phsp") + if not hasattr(phasespace, "set_backend"): # pragma: no cover + if backend != "tensorflow": + msg = f'Backend "{backend}" requires phasespace 2.0 or higher' + raise ValueError(msg) + return + try: + phasespace.set_backend(backend) + except ImportError: # pragma: no cover + module_name, extra = _BACKEND_EXTRAS[backend] + raise_missing_module_error(module_name, extras_require=extra) + + +def _get_seed( + rng: RealNumberGenerator, backend: Backend +) -> int | np.random.Generator | tf.random.Generator: + if backend == "numpy" and isinstance(rng, NumpyUniformRNG): + return rng.generator + if backend == "tensorflow" and isinstance(rng, TFUniformRealNumberGenerator): + return rng.generator + return int(rng(1, min_value=0, max_value=2**31 - 1)[0]) diff --git a/tests/data/test_phasespace.py b/tests/data/test_phasespace.py index ebac2ce2..80ae7fe7 100644 --- a/tests/data/test_phasespace.py +++ b/tests/data/test_phasespace.py @@ -8,6 +8,7 @@ import pytest from tensorwaves.data import ( + NumpyUniformRNG, TFPhaseSpaceGenerator, TFUniformRealNumberGenerator, TFWeightedPhaseSpaceGenerator, @@ -291,3 +292,42 @@ def it_generates_deterministic_four_momenta_and_weights(pdg: ParticleCollection) 0.456160360696799, 0.475480297190723, ] + + +def describe_backend(): + masses = {0: 0.135, 1: 0.135, 2: 0.135} + + @pytest.mark.parametrize("backend", ["numpy", "tensorflow", "jax"]) + @pytest.mark.parametrize( + "rng_type", [NumpyUniformRNG, TFUniformRealNumberGenerator] + ) + def it_returns_reproducible_numpy_arrays(backend, rng_type): + generator = TFPhaseSpaceGenerator(3.0, masses, backend=backend) + generator.show_progress = False + sample1 = generator.generate(10, rng_type(seed=0)) + sample2 = generator.generate(10, rng_type(seed=0)) + assert set(sample1) == {"p0", "p1", "p2"} + for key, momenta in sample1.items(): + assert isinstance(momenta, np.ndarray) + assert momenta.shape == (10, 4) + assert pytest.approx(momenta) == sample2[key] + total_energy = sum(p[:, 0] for p in sample1.values()) + assert pytest.approx(total_energy) == np.full(10, 3.0) + + def it_uses_tensorflow_by_default(): + import phasespace + + TFWeightedPhaseSpaceGenerator(3.0, masses) + assert phasespace.get_backend().name == "TENSORFLOW" + + def it_advances_the_stream_of_an_rng_with_a_foreign_backend(): + generator = TFWeightedPhaseSpaceGenerator(3.0, masses) + rng = NumpyUniformRNG(seed=0) + sample1 = generator.generate(5, rng) + sample2 = generator.generate(5, rng) + with pytest.raises(AssertionError): + assert pytest.approx(sample1["p0"]) == sample2["p0"] + + def it_rejects_unknown_backends(): + with pytest.raises(ValueError, match="Backend must be one of"): + TFWeightedPhaseSpaceGenerator(3.0, masses, backend="torch") # ty:ignore[invalid-argument-type] diff --git a/uv.lock b/uv.lock index faead12e..0ca8a46a 100644 --- a/uv.lock +++ b/uv.lock @@ -3,22 +3,22 @@ revision = 5 requires-python = ">=3.11" resolution-markers = [ "python_full_version >= '3.15' and sys_platform == 'win32'", - "python_full_version == '3.14.*' and sys_platform == 'win32'", "python_full_version >= '3.15' and sys_platform == 'emscripten'", - "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version == '3.13.*' and sys_platform == 'win32'", - "python_full_version == '3.12.*' and sys_platform == 'win32'", "python_full_version == '3.13.*' and sys_platform == 'emscripten'", - "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.13.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'", - "python_full_version < '3.11.5' and sys_platform == 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'", - "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version < '3.11.5' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] @@ -592,10 +592,10 @@ version = "1.3.3" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'", - "python_full_version < '3.11.5' and sys_platform == 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'", - "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version < '3.11.5' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] dependencies = [ @@ -682,16 +682,16 @@ version = "1.4.0" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.15' and sys_platform == 'win32'", - "python_full_version == '3.14.*' and sys_platform == 'win32'", "python_full_version >= '3.15' and sys_platform == 'emscripten'", - "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version == '3.13.*' and sys_platform == 'win32'", - "python_full_version == '3.12.*' and sys_platform == 'win32'", "python_full_version == '3.13.*' and sys_platform == 'emscripten'", - "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.13.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] dependencies = [ @@ -1011,10 +1011,10 @@ resolution-markers = [ "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'", - "python_full_version < '3.11.5' and sys_platform == 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'", - "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version < '3.11.5' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] sdist = { url = "https://files.pythonhosted.org/packages/ae/b6/03bb70946330e88ffec97aefd3ea75ba575cb2e762061e0e62a213befee8/docutils-0.22.4.tar.gz", hash = "sha256:4db53b1fde9abecbb74d91230d32ab626d94f6badfc575d6db9194a49df29968", size = 2291750, upload-time = "2025-12-18T19:00:26.443Z" } @@ -1028,10 +1028,10 @@ version = "0.23" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.15' and sys_platform == 'win32'", - "python_full_version == '3.14.*' and sys_platform == 'win32'", "python_full_version >= '3.15' and sys_platform == 'emscripten'", - "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version == '3.13.*' and sys_platform == 'win32'", "python_full_version == '3.13.*' and sys_platform == 'emscripten'", @@ -1580,10 +1580,10 @@ version = "0.10.2" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'", - "python_full_version < '3.11.5' and sys_platform == 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'", - "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version < '3.11.5' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] dependencies = [ @@ -1604,16 +1604,16 @@ version = "0.12.0.1" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.15' and sys_platform == 'win32'", - "python_full_version == '3.14.*' and sys_platform == 'win32'", "python_full_version >= '3.15' and sys_platform == 'emscripten'", - "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version == '3.13.*' and sys_platform == 'win32'", - "python_full_version == '3.12.*' and sys_platform == 'win32'", "python_full_version == '3.13.*' and sys_platform == 'emscripten'", - "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.13.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] dependencies = [ @@ -1634,10 +1634,10 @@ version = "0.10.2" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'", - "python_full_version < '3.11.5' and sys_platform == 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'", - "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version < '3.11.5' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] dependencies = [ @@ -1676,16 +1676,16 @@ version = "0.12.0.1" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.15' and sys_platform == 'win32'", - "python_full_version == '3.14.*' and sys_platform == 'win32'", "python_full_version >= '3.15' and sys_platform == 'emscripten'", - "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version == '3.13.*' and sys_platform == 'win32'", - "python_full_version == '3.12.*' and sys_platform == 'win32'", "python_full_version == '3.13.*' and sys_platform == 'emscripten'", - "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.13.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] dependencies = [ @@ -2838,10 +2838,10 @@ version = "2.4.6" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'", - "python_full_version < '3.11.5' and sys_platform == 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'", - "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version < '3.11.5' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] sdist = { url = "https://files.pythonhosted.org/packages/d0/ad/fed0499ce6a338d2a03ebae59cd15093910c8875328855781952abf6c2fe/numpy-2.4.6.tar.gz", hash = "sha256:f3a3570c4a2a16746ac2c31a7c7c7b0c186b95ce902e33db6f28094ed7387dda", size = 20735807, upload-time = "2026-05-18T23:37:14.07Z" } @@ -2925,16 +2925,16 @@ version = "2.5.4" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.15' and sys_platform == 'win32'", - "python_full_version == '3.14.*' and sys_platform == 'win32'", "python_full_version >= '3.15' and sys_platform == 'emscripten'", - "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version == '3.13.*' and sys_platform == 'win32'", - "python_full_version == '3.12.*' and sys_platform == 'win32'", "python_full_version == '3.13.*' and sys_platform == 'emscripten'", - "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.13.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] sdist = { url = "https://files.pythonhosted.org/packages/95/b0/c7453d0b6e2073c3264468b106ee1563750cecc910965e67357e3698c83e/numpy-2.5.4.tar.gz", hash = "sha256:9a94cf751c9ad8ebaa835bcd3d40dacf8534ad086b88c38029b65123c7999d2a", size = 20866315, upload-time = "2026-10-10T20:05:31.422Z" } @@ -3284,15 +3284,15 @@ wheels = [ [[package]] name = "phasespace" -version = "1.10.4" +version = "2.0.0" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "tensorflow" }, - { name = "tensorflow-probability" }, + { name = "numpy", version = "2.4.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.12'" }, + { name = "numpy", version = "2.5.4", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version >= '3.12'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/2c/6f/1ea52957f9a464d269ba03af646de9403827c86536f267de180a062dab15/phasespace-1.10.4.tar.gz", hash = "sha256:5e1aaf42e06890d7a04b09493015dfc3f0585ffab4f1d8a03c3c9f01a942aca9", size = 54567, upload-time = "2026-04-16T12:34:27.413Z" } +sdist = { url = "https://files.pythonhosted.org/packages/ae/55/826c688d59dbf33341e4ad2704d9811d7fe2062de693746bebb067264660/phasespace-2.0.0.tar.gz", hash = "sha256:f07e9bec3ad5036d86c52bf62f5c7ac3dd5e76a71113f9c015fd14712eac3436", size = 60565, upload-time = "2026-11-17T19:51:09.023Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/8e/05/593592fd765ac7f0146e0838b7de9f74154294da6be1a3dc8da7deb0ff15/phasespace-1.10.4-py3-none-any.whl", hash = "sha256:f391f1f6abeb1c9b2d532c11395bb108875f06e3d68a1f2fb3df9aec8f3eedb0", size = 25090, upload-time = "2026-04-16T12:34:25.825Z" }, + { url = "https://files.pythonhosted.org/packages/b4/49/644fc9fc98513577f9f89d722c09d3677ee08755a25b016ee58d48683a2c/phasespace-2.0.0-py3-none-any.whl", hash = "sha256:be9dee4dbda99f34310d2fff3263783679a550f27a043764dc9fafcff7704aa8", size = 29352, upload-time = "2026-11-17T19:51:07.696Z" }, ] [package.optional-dependencies] @@ -4251,10 +4251,10 @@ version = "1.17.1" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'", - "python_full_version < '3.11.5' and sys_platform == 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'", - "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version < '3.11.5' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] dependencies = [ @@ -4330,16 +4330,16 @@ version = "1.18.1" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.15' and sys_platform == 'win32'", - "python_full_version == '3.14.*' and sys_platform == 'win32'", "python_full_version >= '3.15' and sys_platform == 'emscripten'", - "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version == '3.13.*' and sys_platform == 'win32'", - "python_full_version == '3.12.*' and sys_platform == 'win32'", "python_full_version == '3.13.*' and sys_platform == 'emscripten'", - "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.13.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] dependencies = [ @@ -4474,16 +4474,16 @@ version = "4.1" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.15' and sys_platform == 'win32'", - "python_full_version == '3.14.*' and sys_platform == 'win32'", "python_full_version >= '3.15' and sys_platform == 'emscripten'", - "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version == '3.13.*' and sys_platform == 'win32'", - "python_full_version == '3.12.*' and sys_platform == 'win32'", "python_full_version == '3.13.*' and sys_platform == 'emscripten'", - "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.13.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'win32'", + "python_full_version == '3.12.*' and sys_platform == 'emscripten'", "python_full_version == '3.12.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'", @@ -4500,10 +4500,10 @@ version = "9.0.4" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'win32'", - "python_full_version < '3.11.5' and sys_platform == 'win32'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform == 'emscripten'", - "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version >= '3.11.5' and python_full_version < '3.12' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'win32'", + "python_full_version < '3.11.5' and sys_platform == 'emscripten'", "python_full_version < '3.11.5' and sys_platform != 'emscripten' and sys_platform != 'win32'", ] dependencies = [ @@ -4569,10 +4569,10 @@ version = "9.2.0" source = { registry = "https://pypi.org/simple" } resolution-markers = [ "python_full_version >= '3.15' and sys_platform == 'win32'", - "python_full_version == '3.14.*' and sys_platform == 'win32'", "python_full_version >= '3.15' and sys_platform == 'emscripten'", - "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version >= '3.15' and sys_platform != 'emscripten' and sys_platform != 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'win32'", + "python_full_version == '3.14.*' and sys_platform == 'emscripten'", "python_full_version == '3.14.*' and sys_platform != 'emscripten' and sys_platform != 'win32'", "python_full_version == '3.13.*' and sys_platform == 'win32'", "python_full_version == '3.13.*' and sys_platform == 'emscripten'", @@ -5079,6 +5079,7 @@ dev = [ { name = "myst-nb" }, { name = "numba" }, { name = "pandas" }, + { name = "phasespace" }, { name = "pyarrow" }, { name = "pytest" }, { name = "pytest-benchmark" }, @@ -5179,6 +5180,7 @@ style = [ ] test = [ { name = "ipython" }, + { name = "phasespace" }, { name = "pyarrow" }, { name = "pytest" }, { name = "pytest-benchmark" }, @@ -5247,6 +5249,7 @@ dev = [ { name = "myst-nb" }, { name = "numba" }, { name = "pandas" }, + { name = "phasespace", specifier = ">=2.0.0" }, { name = "pyarrow" }, { name = "pytest" }, { name = "pytest-benchmark" }, @@ -5343,6 +5346,7 @@ style = [ ] test = [ { name = "ipython" }, + { name = "phasespace", specifier = ">=2.0.0" }, { name = "pyarrow" }, { name = "pytest" }, { name = "pytest-benchmark" },