Skip to content

Commit

Permalink
ENH: auto-normalize edge IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
redeboer committed Apr 26, 2024
1 parent 80e3e6d commit f1a245f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/ampform_dpd/adapter/qrules.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import logging
from collections import abc, defaultdict
from functools import singledispatch
from pathlib import Path
Expand All @@ -19,17 +20,25 @@
ThreeBodyDecayChain,
)

_LOGGER = logging.getLogger(__name__)


def to_three_body_decay(
transitions: Iterable[FrozenTransition],
min_ls: bool = False,
) -> ThreeBodyDecay:
transitions = convert_edges_and_nodes(transitions)
if min_ls:
transitions = filter_min_ls(transitions)
transitions = tuple(transitions)
if not transitions:
msg = "Need at least one transition object"
raise ValueError(msg)
if set(transitions[0].initial_states) != {0} or set(
transitions[0].final_states
) != {1, 2, 3}:
transitions = normalize_state_ids(transitions)
_LOGGER.warning("Relabeled initial state to 0 and final states to 1, 2, 3")
transitions = convert_edges_and_nodes(transitions)
if min_ls:
transitions = filter_min_ls(transitions)
some_transition = transitions[0]
initial_state, *_ = some_transition.initial_states.values()
final_states = {
Expand Down

0 comments on commit f1a245f

Please sign in to comment.