Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: remove redundant aslatex dispatches #126

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .constraints/py3.10.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .constraints/py3.11.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .constraints/py3.12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .constraints/py3.8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .constraints/py3.9.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@
"helicities",
"helicity",
"isospin",
"JHEP",
"JPAC",
"lambdify",
"lambdifying",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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](<https://doi.org/10.1007/JHEP07(2023)228>)).

Installation instructions can be found [here](https://compwa.github.io/ampform-dpd/#installation).
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
45 changes: 0 additions & 45 deletions src/ampform_dpd/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading