Skip to content

Commit

Permalink
ENH: add set_dynamics() method for backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Mar 4, 2024
1 parent 3e26e8d commit d6ea61b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/ampform/helicity/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import logging
import operator
import sys
import warnings
from collections import OrderedDict, abc
from functools import reduce
from typing import (
Expand Down Expand Up @@ -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(

Check warning on line 390 in src/ampform/helicity/__init__.py

View check run for this annotation

Codecov / codecov/patch

src/ampform/helicity/__init__.py#L390

Added line #L390 was not covered by tests
"set_dynamics() will be removed in favor of dynamics.assign()",
category=DeprecationWarning,
stacklevel=1,
)
self.dynamics.assign(particle_name, dynamics_builder)

Check warning on line 395 in src/ampform/helicity/__init__.py

View check run for this annotation

Codecov / codecov/patch

src/ampform/helicity/__init__.py#L395

Added line #L395 was not covered by tests

def formulate(self) -> HelicityModel:
self.__ingredients.reset()
main_intensity = self.__formulate_top_expression()
Expand Down

0 comments on commit d6ea61b

Please sign in to comment.