From b5404b6a0f9533b25cd449aa031544dde9540665 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:17:58 +0200 Subject: [PATCH] MAINT: remove redundant `aslatex` dispatches (#126) * BREAK: require AmpForm v0.15.1 * DOC: remove outdated remark about private repository --- .constraints/py3.10.txt | 2 +- .constraints/py3.11.txt | 2 +- .constraints/py3.12.txt | 2 +- .constraints/py3.8.txt | 2 +- .constraints/py3.9.txt | 2 +- .cspell.json | 1 + README.md | 2 +- pyproject.toml | 2 +- src/ampform_dpd/io.py | 45 ----------------------------------------- 9 files changed, 8 insertions(+), 52 deletions(-) diff --git a/.constraints/py3.10.txt b/.constraints/py3.10.txt index 4aff8afa..8670e2e6 100644 --- a/.constraints/py3.10.txt +++ b/.constraints/py3.10.txt @@ -3,7 +3,7 @@ absl-py==2.1.0 accessible-pygments==0.0.4 alabaster==0.7.16 -ampform==0.15.0 +ampform==0.15.1 anyio==4.3.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 diff --git a/.constraints/py3.11.txt b/.constraints/py3.11.txt index 14e3000f..a1678ba0 100644 --- a/.constraints/py3.11.txt +++ b/.constraints/py3.11.txt @@ -3,7 +3,7 @@ absl-py==2.1.0 accessible-pygments==0.0.4 alabaster==0.7.16 -ampform==0.15.0 +ampform==0.15.1 anyio==4.3.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 diff --git a/.constraints/py3.12.txt b/.constraints/py3.12.txt index c8daf2ea..76386aad 100644 --- a/.constraints/py3.12.txt +++ b/.constraints/py3.12.txt @@ -3,7 +3,7 @@ absl-py==2.1.0 accessible-pygments==0.0.4 alabaster==0.7.16 -ampform==0.15.0 +ampform==0.15.1 anyio==4.3.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 diff --git a/.constraints/py3.8.txt b/.constraints/py3.8.txt index a20105f8..714772b4 100644 --- a/.constraints/py3.8.txt +++ b/.constraints/py3.8.txt @@ -3,7 +3,7 @@ absl-py==2.1.0 accessible-pygments==0.0.4 alabaster==0.7.13 -ampform==0.15.0 +ampform==0.15.1 anyio==4.3.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 diff --git a/.constraints/py3.9.txt b/.constraints/py3.9.txt index 305b87e7..66d79fd7 100644 --- a/.constraints/py3.9.txt +++ b/.constraints/py3.9.txt @@ -3,7 +3,7 @@ absl-py==2.1.0 accessible-pygments==0.0.4 alabaster==0.7.16 -ampform==0.15.0 +ampform==0.15.1 anyio==4.3.0 argon2-cffi==23.1.0 argon2-cffi-bindings==21.2.0 diff --git a/.cspell.json b/.cspell.json index 24f4d9f1..ddaae994 100644 --- a/.cspell.json +++ b/.cspell.json @@ -141,6 +141,7 @@ "helicities", "helicity", "isospin", + "JHEP", "JPAC", "lambdify", "lambdifying", diff --git a/README.md b/README.md index 7f496f47..b0eca148 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,6 @@ [![Spelling checked](https://img.shields.io/badge/cspell-checked-brightgreen.svg)](https://github.com/streetsidesoftware/cspell/tree/master/packages/cspell) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) -This repository is a (temporary) extension of [AmpForm](https://ampform.rtfd.io) and provides a symbolic implementation of Dalitz-plot decomposition ([10.1103/PhysRevD.101.034033](https://journals.aps.org/prd/abstract/10.1103/PhysRevD.101.034033)) with [SymPy](https://www.sympy.org/en/index.html). It has been extracted from the [ComPWA/polarimetry](https://github.com/ComPWA/polarimetry) repository, which is not yet public. +This repository is a (temporary) extension of [AmpForm](https://ampform.rtfd.io) and provides a symbolic implementation of Dalitz-plot decomposition ([10.1103/PhysRevD.101.034033](https://journals.aps.org/prd/abstract/10.1103/PhysRevD.101.034033)) with [SymPy](https://www.sympy.org/en/index.html). It has been extracted from the [ComPWA/polarimetry](https://github.com/ComPWA/polarimetry) repository ([10.1007/JHEP07(2023)228]()). Installation instructions can be found [here](https://compwa.github.io/ampform-dpd/#installation). diff --git a/pyproject.toml b/pyproject.toml index 5cb6e6ca..e891caaa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ classifiers = [ "Typing :: Typed", ] dependencies = [ - "ampform >=0.14.8", # Kibble and Kallen functions, perform_cached_doit, @unevaluated + "ampform >=0.15.1", # aslatex with keyword arguments "attrs >=20.1.0", # on_setattr and https://www.attrs.org/en/stable/api.html#next-gen "cloudpickle", "qrules >=0.10.0", diff --git a/src/ampform_dpd/io.py b/src/ampform_dpd/io.py index 73371d13..ab705f32 100644 --- a/src/ampform_dpd/io.py +++ b/src/ampform_dpd/io.py @@ -49,51 +49,6 @@ _LOGGER = logging.getLogger(__name__) -@aslatex.register(complex) -def _(obj: complex, **kwargs) -> str: - real = __downcast(obj.real) - imag = __downcast(obj.imag) - plus = "+" if imag >= 0 else "" - return f"{real}{plus}{imag}i" - - -def __downcast(obj: float) -> float | int: - if obj.is_integer(): - return int(obj) - return obj - - -@aslatex.register(sp.Basic) -def _(obj: sp.Basic, **kwargs) -> str: - return sp.latex(obj) - - -@aslatex.register(abc.Mapping) -def _(obj: Mapping, **kwargs) -> str: - if len(obj) == 0: - msg = "Need at least one dictionary item" - raise ValueError(msg) - latex = R"\begin{array}{rcl}" + "\n" - for lhs, rhs in obj.items(): - latex += Rf" {aslatex(lhs, **kwargs)} &=& {aslatex(rhs, **kwargs)} \\" + "\n" - latex += R"\end{array}" - return latex - - -@aslatex.register(abc.Iterable) -def _(obj: Iterable, **kwargs) -> str: - obj = list(obj) - if len(obj) == 0: - msg = "Need at least one item to render as LaTeX" - raise ValueError(msg) - latex = R"\begin{array}{c}" + "\n" - for item in obj: - item_latex = aslatex(item, **kwargs) - latex += Rf" {item_latex} \\" + "\n" - latex += R"\end{array}" - return latex - - @aslatex.register(IsobarNode) def _(obj: IsobarNode, **kwargs) -> str: def render_arrow(node: IsobarNode) -> str: