Skip to content

Commit

Permalink
FIX: use AmpForm's FormFactor (#148)
Browse files Browse the repository at this point in the history
* MAINT: update lock file to 0.2.1
* MAINT: upgrade Jupyter kernels
  • Loading branch information
redeboer authored Dec 24, 2024
1 parent b57ee47 commit 182d69b
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 41 deletions.
7 changes: 4 additions & 3 deletions docs/jpsi2ksp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"import matplotlib.pyplot as plt\n",
"import qrules\n",
"import sympy as sp\n",
"from ampform.dynamics import BlattWeisskopfSquared, EnergyDependentWidth\n",
"from ampform.dynamics import EnergyDependentWidth\n",
"from ampform.dynamics.form_factor import BlattWeisskopfSquared, FormFactor\n",
"from ampform.sympy import perform_cached_doit\n",
"from IPython.display import Latex, Markdown\n",
"from tensorwaves.data.transform import SympyDataTransformer\n",
Expand All @@ -45,7 +46,7 @@
"from ampform_dpd import DalitzPlotDecompositionBuilder\n",
"from ampform_dpd.adapter.qrules import normalize_state_ids, to_three_body_decay\n",
"from ampform_dpd.decay import State\n",
"from ampform_dpd.dynamics import FormFactor, RelativisticBreitWigner\n",
"from ampform_dpd.dynamics import RelativisticBreitWigner\n",
"from ampform_dpd.dynamics.builder import formulate_breit_wigner_with_form_factor\n",
"from ampform_dpd.io import (\n",
" as_markdown_table,\n",
Expand Down Expand Up @@ -575,7 +576,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.19"
"version": "3.12.8"
}
},
"nbformat": 4,
Expand Down
5 changes: 2 additions & 3 deletions docs/serialization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import sympy as sp\n",
"from ampform.dynamics import BlattWeisskopfSquared\n",
"from ampform.dynamics.form_factor import BlattWeisskopfSquared, FormFactor\n",
"from ampform.dynamics.phasespace import BreakupMomentumSquared\n",
"from ampform.kinematics.phasespace import Kallen\n",
"from ampform.sympy import perform_cached_doit\n",
Expand All @@ -63,7 +63,6 @@
" BuggBreitWigner,\n",
" ChannelArguments,\n",
" EnergyDependentWidth,\n",
" FormFactor,\n",
" MultichannelBreitWigner,\n",
" P,\n",
" SimpleBreitWigner,\n",
Expand Down Expand Up @@ -980,7 +979,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.19"
"version": "3.12.8"
}
},
"nbformat": 4,
Expand Down
7 changes: 4 additions & 3 deletions docs/xib2pkk.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"import matplotlib.pyplot as plt\n",
"import qrules\n",
"import sympy as sp\n",
"from ampform.dynamics import BlattWeisskopfSquared, EnergyDependentWidth\n",
"from ampform.dynamics import EnergyDependentWidth\n",
"from ampform.dynamics.form_factor import BlattWeisskopfSquared, FormFactor\n",
"from ampform.sympy import perform_cached_doit\n",
"from IPython.display import Latex, Markdown\n",
"from tensorwaves.data.transform import SympyDataTransformer\n",
Expand All @@ -50,7 +51,7 @@
" to_three_body_decay,\n",
")\n",
"from ampform_dpd.decay import State\n",
"from ampform_dpd.dynamics import FormFactor, RelativisticBreitWigner\n",
"from ampform_dpd.dynamics import RelativisticBreitWigner\n",
"from ampform_dpd.dynamics.builder import formulate_breit_wigner_with_form_factor\n",
"from ampform_dpd.io import (\n",
" as_markdown_table,\n",
Expand Down Expand Up @@ -585,7 +586,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.19"
"version": "3.12.8"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
"Typing :: Typed",
]
dependencies = [
"ampform >=0.15.1", # aslatex with keyword arguments
"ampform >=0.15.4", # aslatex with keyword arguments
"attrs >=20.1.0", # on_setattr and https://www.attrs.org/en/stable/api.html#next-gen
"cloudpickle",
"numpy",
Expand Down
23 changes: 1 addition & 22 deletions src/ampform_dpd/dynamics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import TYPE_CHECKING, Any

import sympy as sp
from ampform.dynamics import formulate_form_factor
from ampform.dynamics.form_factor import FormFactor
from ampform.kinematics.phasespace import Kallen
from ampform.sympy import unevaluated

Expand Down Expand Up @@ -195,27 +195,6 @@ def evaluate(self) -> sp.Piecewise:
])


@unevaluated
class FormFactor(sp.Expr):
s: Any
m1: Any
m2: Any
angular_momentum: Any
meson_radius: Any

_latex_repr_ = R"\mathcal{{F}}_{{{angular_momentum}}}\left({s}, {m1}, {m2}\right)"

def evaluate(self):
s, m1, m2, angular_momentum, meson_radius = self.args
return formulate_form_factor(
s=s,
m_a=m1,
m_b=m2,
angular_momentum=angular_momentum,
meson_radius=meson_radius,
)


@unevaluated
class MultichannelBreitWigner(sp.Expr):
s: Any
Expand Down
3 changes: 2 additions & 1 deletion src/ampform_dpd/dynamics/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from __future__ import annotations

import sympy as sp
from ampform.dynamics.form_factor import FormFactor

from ampform_dpd import to_particle
from ampform_dpd.decay import (
Expand All @@ -18,7 +19,7 @@
State,
ThreeBodyDecayChain,
)
from ampform_dpd.dynamics import FormFactor, RelativisticBreitWigner
from ampform_dpd.dynamics import RelativisticBreitWigner


def formulate_breit_wigner_with_form_factor(
Expand Down
8 changes: 2 additions & 6 deletions src/ampform_dpd/io/serialization/dynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@
from typing import TYPE_CHECKING, Callable, Protocol, TypeVar, cast

import sympy as sp
from ampform.dynamics.form_factor import FormFactor

from ampform_dpd import DefinedExpression
from ampform_dpd.dynamics import (
BreitWigner,
ChannelArguments,
FormFactor,
MultichannelBreitWigner,
)
from ampform_dpd.dynamics import BreitWigner, ChannelArguments, MultichannelBreitWigner
from ampform_dpd.io.serialization.decay import get_initial_state
from ampform_dpd.io.serialization.format import (
BlattWeisskopfDefinition,
Expand Down
4 changes: 2 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 182d69b

Please sign in to comment.