Skip to content

Commit

Permalink
MAINT: use ampform.sympy.perform_cached_doit() (#25)
Browse files Browse the repository at this point in the history
* BREAK: deprecate `perform_cached_doit` over AmpForm
* DOC: remove sub-threshold resonance N(1675)⁺
* ENH: assert that not all intensities are NaN
* MAINT: set minimal AmpForm version to v0.14.4
* MAINT: update pip constraints and pre-commit config

Co-authored-by: GitHub <noreply@github.com>
  • Loading branch information
redeboer and web-flow committed Oct 19, 2022
1 parent eae5fc8 commit f4a6cd1
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 21 deletions.
6 changes: 3 additions & 3 deletions .constraints/py3.10.txt
Expand Up @@ -6,8 +6,8 @@
#
absl-py==1.3.0
alabaster==0.7.12
ampform==0.14.3
anyio==3.6.1
ampform==0.14.4
anyio==3.6.2
aquirdturtle-collapsible-headings==3.1.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
Expand Down Expand Up @@ -108,7 +108,7 @@ pluggy==1.0.0
pre-commit==2.20.0
prometheus-client==0.15.0
prompt-toolkit==3.0.31
psutil==5.9.2
psutil==5.9.3
ptyprocess==0.7.0
pure-eval==0.2.2
py==1.11.0
Expand Down
6 changes: 3 additions & 3 deletions .constraints/py3.7.txt
Expand Up @@ -6,8 +6,8 @@
#
absl-py==1.3.0
alabaster==0.7.12
ampform==0.14.3
anyio==3.6.1
ampform==0.14.4
anyio==3.6.2
aquirdturtle-collapsible-headings==3.1.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
Expand Down Expand Up @@ -106,7 +106,7 @@ pluggy==1.0.0
pre-commit==2.20.0
prometheus-client==0.15.0
prompt-toolkit==3.0.31
psutil==5.9.2
psutil==5.9.3
ptyprocess==0.7.0
py==1.11.0
pycparser==2.21
Expand Down
6 changes: 3 additions & 3 deletions .constraints/py3.8.txt
Expand Up @@ -6,8 +6,8 @@
#
absl-py==1.3.0
alabaster==0.7.12
ampform==0.14.3
anyio==3.6.1
ampform==0.14.4
anyio==3.6.2
aquirdturtle-collapsible-headings==3.1.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
Expand Down Expand Up @@ -109,7 +109,7 @@ pluggy==1.0.0
pre-commit==2.20.0
prometheus-client==0.15.0
prompt-toolkit==3.0.31
psutil==5.9.2
psutil==5.9.3
ptyprocess==0.7.0
pure-eval==0.2.2
py==1.11.0
Expand Down
6 changes: 3 additions & 3 deletions .constraints/py3.9.txt
Expand Up @@ -6,8 +6,8 @@
#
absl-py==1.3.0
alabaster==0.7.12
ampform==0.14.3
anyio==3.6.1
ampform==0.14.4
anyio==3.6.2
aquirdturtle-collapsible-headings==3.1.0
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
Expand Down Expand Up @@ -108,7 +108,7 @@ pluggy==1.0.0
pre-commit==2.20.0
prometheus-client==0.15.0
prompt-toolkit==3.0.31
psutil==5.9.2
psutil==5.9.3
ptyprocess==0.7.0
pure-eval==0.2.2
py==1.11.0
Expand Down
10 changes: 3 additions & 7 deletions docs/jpsi2ksp.ipynb
Expand Up @@ -42,6 +42,7 @@
" create_expression,\n",
" implement_doit_method,\n",
" make_commutative,\n",
" perform_cached_doit,\n",
")\n",
"from IPython.display import Latex, Markdown\n",
"from tensorwaves.data.transform import SympyDataTransformer\n",
Expand All @@ -59,12 +60,7 @@
" ThreeBodyDecay,\n",
" ThreeBodyDecayChain,\n",
")\n",
"from ampform_dpd.io import (\n",
" as_markdown_table,\n",
" aslatex,\n",
" perform_cached_doit,\n",
" perform_cached_lambdify,\n",
")\n",
"from ampform_dpd.io import as_markdown_table, aslatex, perform_cached_lambdify\n",
"from ampform_dpd.spin import filter_parity_violating_ls, generate_ls_couplings\n",
"\n",
"simplify_latex_rendering()\n",
Expand Down Expand Up @@ -147,7 +143,6 @@
" \"Sigma(1750)~-\",\n",
" \"Sigma(1775)~-\",\n",
" \"Sigma(1910)~-\",\n",
" \"N(1675)+\",\n",
" \"N(1700)+\",\n",
" \"N(1710)+\",\n",
" \"N(1720)+\",\n",
Expand Down Expand Up @@ -856,6 +851,7 @@
"intensities = intensity_func(dalitz_data)\n",
"I_tot = jnp.nansum(intensities)\n",
"normalized_intensities = intensities / I_tot\n",
"assert not jnp.all(jnp.isnan(normalized_intensities)), \"All intensities are NaN\"\n",
"\n",
"fig, ax = plt.subplots(figsize=(14, 10))\n",
"mesh = ax.pcolormesh(X, Y, normalized_intensities)\n",
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -16,7 +16,7 @@ python_requires = >=3.7
setup_requires =
setuptools_scm
install_requires =
ampform >=0.14.1 # Kibble and Kallen functions
ampform ~=0.14.4 # Kibble and Kallen functions, perform_cached_doit
attrs >=20.1.0 # on_setattr and https://www.attrs.org/en/stable/api.html#next-gen
cloudpickle
sympy >=1.10 # module sympy.printing.numpy and array expressions with shape kwarg
Expand Down
12 changes: 11 additions & 1 deletion src/ampform_dpd/io.py
Expand Up @@ -26,6 +26,7 @@
from os.path import abspath, dirname, expanduser
from textwrap import dedent
from typing import Iterable, Mapping, Sequence, overload
from warnings import warn

import cloudpickle
import sympy as sp
Expand Down Expand Up @@ -226,7 +227,16 @@ def perform_cached_doit(
fixed value.
.. seealso:: :func:`perform_cached_lambdify`
.. deprecated:: 0.2
Use :func:`ampform.sympy.perform_cached_doit` instead. See `ComPWA/ampform#24
<https://github.com/ComPWA/ampform-dpd/issues/24>`_
"""
warn(
"Use ampform.sympy.perform_cached_doit from AmpForm-DPD v0.2 onwards. "
"See https://github.com/ComPWA/ampform-dpd/issues/24",
category=PendingDeprecationWarning,
)
if directory is None:
main_cache_dir = _get_main_cache_dir()
directory = abspath(f"{main_cache_dir}/.sympy-cache")
Expand Down Expand Up @@ -292,7 +302,7 @@ def perform_cached_lambdify(
<https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHASHSEED>`_ to a
fixed value.
.. seealso:: :func:`perform_cached_doit`
.. seealso:: :func:`ampform.sympy.perform_cached_doit`
"""
if directory is None:
main_cache_dir = _get_main_cache_dir()
Expand Down

0 comments on commit f4a6cd1

Please sign in to comment.