From 765299dba3cb573ee98539baa86270d76baadab5 Mon Sep 17 00:00:00 2001 From: Remco de Boer Date: Thu, 7 Apr 2022 19:01:58 +0200 Subject: [PATCH] fix: return meson radius of value 1 (#275) * test: check types of HelicityModel.parameter_defaults --- src/ampform/dynamics/builder.py | 8 ++++---- tests/helicity/test_helicity.py | 9 +++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/ampform/dynamics/builder.py b/src/ampform/dynamics/builder.py index 6c169def9..25ef061a6 100644 --- a/src/ampform/dynamics/builder.py +++ b/src/ampform/dynamics/builder.py @@ -100,7 +100,7 @@ def create_non_dynamic_with_ff( ) return ( form_factor, - {meson_radius: sp.S.One}, + {meson_radius: 1}, ) @@ -205,7 +205,7 @@ def __energy_dependent_breit_wigner( parameter_defaults = { res_mass: resonance.mass, res_width: resonance.width, - meson_radius: sp.S.One, + meson_radius: 1, } return breit_wigner_expr, parameter_defaults @@ -228,9 +228,9 @@ def __create_form_factor( meson_radius=meson_radius, ) parameter_defaults = { - meson_radius: sp.S.One, + meson_radius: 1, } - return form_factor, parameter_defaults + return form_factor, parameter_defaults # type: ignore[return-value] @staticmethod def __create_symbols( diff --git a/tests/helicity/test_helicity.py b/tests/helicity/test_helicity.py index 562ac7c20..30bada78e 100644 --- a/tests/helicity/test_helicity.py +++ b/tests/helicity/test_helicity.py @@ -13,6 +13,7 @@ from ampform.helicity import ( HelicityAmplitudeBuilder, HelicityModel, + ParameterValue, ParameterValues, _generate_kinematic_variables, formulate_wigner_d, @@ -170,6 +171,14 @@ def test_use_helicity_couplings(self, reaction: ReactionInfo): class TestHelicityModel: + def test_parameter_defaults_item_types( + self, amplitude_model: tuple[str, HelicityModel] + ): + _, model = amplitude_model + for symbol, value in model.parameter_defaults.items(): + assert isinstance(symbol, sp.Symbol) + assert isinstance(value, ParameterValue.__args__) # type: ignore[attr-defined] + def test_rename_symbols_no_renames( self, amplitude_model: tuple[str, HelicityModel] ):