io#

Input-output functions for ampform and sympy objects.

This module extends AmpForm’s aslatex() function. You can register more implementations as follows:

>>> from ampform_dpd.io import aslatex
>>> @aslatex.register(int)
... def _(obj: int) -> str:
...     return "my custom rendering"
>>> aslatex(1)
'my custom rendering'
>>> aslatex(3.4 - 2j)
'3.4-2i'

This code originates from ComPWA/ampform#280.

unfold_definitions(expr: Expr) dict[Expr, Expr][source]#

Recursively unfold one representative definition per expression class.

Instances of the same class are grouped before they are unfolded. Arguments that are identical across the group are retained. Different atomic arguments, such as channel-indexed symbols, use the first instance as their representative. Different composite arguments are replaced by a symbol named after the corresponding class parameter, so that special cases such as h(1) are rendered as h(z).

as_markdown_table(obj: ThreeBodyDecay | ThreeBodyDecayChain | Sequence[Particle]) str[source]#

Render objects a str suitable for generating a table.

mute_ampform_warnings() None[source]#

Mute logging and warnings of AmpForm and AmpForm-DPD.

simplify_latex_rendering() None[source]#

Improve LaTeX rendering of an Indexed object.

Submodules and Subpackages