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

ENH: add set_dynamics() method for backward compatibility #400

Merged
merged 1 commit into from
Mar 4, 2024
Merged
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
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 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
Loading