From d6ea61b146f7651923489499c94d42f84993d787 Mon Sep 17 00:00:00 2001 From: Remco de Boer <29308176+redeboer@users.noreply.github.com> Date: Mon, 4 Mar 2024 11:12:38 +0100 Subject: [PATCH] ENH: add `set_dynamics()` method for backward compatibility --- src/ampform/helicity/__init__.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/ampform/helicity/__init__.py b/src/ampform/helicity/__init__.py index 05e46ae62..d612c3f63 100644 --- a/src/ampform/helicity/__init__.py +++ b/src/ampform/helicity/__init__.py @@ -11,6 +11,7 @@ import logging import operator import sys +import warnings from collections import OrderedDict, abc from functools import reduce from typing import ( @@ -377,6 +378,22 @@ def naming(self) -> NameGenerator: def reaction(self) -> ReactionInfo: return self.__reaction + def set_dynamics( + self, particle_name: str, dynamics_builder: ResonanceDynamicsBuilder + ) -> None: + """Assign a `.ResonanceDynamicsBuilder` for a specific resonance. + + .. deprecated:: 0.16.0 + Use the `~.DynamicsSelector.assign()` method of the `.dynamics` attribute + instead. + """ + warnings.warn( + "set_dynamics() will be removed in favor of dynamics.assign()", + category=DeprecationWarning, + stacklevel=1, + ) + self.dynamics.assign(particle_name, dynamics_builder) + def formulate(self) -> HelicityModel: self.__ingredients.reset() main_intensity = self.__formulate_top_expression()