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

FIX: fix problems in ampform_dpd.io.serialization module #136

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
5 changes: 3 additions & 2 deletions docs/jpsi2ksp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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 @@ -47,7 +48,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
3 changes: 1 addition & 2 deletions docs/serialization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,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 @@ -67,7 +67,6 @@
" BuggBreitWigner,\n",
" ChannelArguments,\n",
" EnergyDependentWidth,\n",
" FormFactor,\n",
" MultichannelBreitWigner,\n",
" P,\n",
" SimpleBreitWigner,\n",
Expand Down
5 changes: 3 additions & 2 deletions docs/xib2pkk.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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 @@ -52,7 +53,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
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.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",
"qrules >=0.10.0",
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
Loading