naming#

import ampform.helicity.naming

Generate descriptions used in the helicity formalism.

class NameGenerator[source]#

Bases: ABC

Name generator for amplitudes and coefficients in a HelicityModel.

abstract generate_amplitude_name(transition: StateTransition, node_id: int | None = None) str[source]#

Generates a unique name for the amplitude corresponding.

That is, corresponging to the given Transition. If node_id is given, it generates a unique name for the partial amplitude corresponding to the interaction node of the given Transition.

abstract generate_sequential_amplitude_suffix(transition: StateTransition) str[source]#

Generate unique suffix for a sequential amplitude transition.

abstract generate_two_body_decay_suffix(transition: StateTransition, node_id: int) str[source]#

Generate partial amplitude coefficient name suffix.

abstract property parity_partner_coefficient_mapping: dict[str, str][source]#
class HelicityAmplitudeNameGenerator(transitions: ReactionInfo | Iterable[StateTransition], insert_parent_helicities: bool = False, insert_child_helicities: bool = True)[source]#

Bases: NameGenerator

property parity_partner_coefficient_mapping: dict[str, str][source]#
property insert_parent_helicities: bool[source]#

Insert helicities of each parent state in the coefficient names.

property insert_child_helicities: bool[source]#

Embed the helicity of each decay product in the coefficients.

generate_amplitude_name(transition: StateTransition, node_id: int | None = None) str[source]#

Generates a unique name for the amplitude corresponding.

That is, corresponging to the given Transition. If node_id is given, it generates a unique name for the partial amplitude corresponding to the interaction node of the given Transition.

generate_two_body_decay_suffix(transition: StateTransition, node_id: int) str[source]#

Generate partial amplitude coefficient name suffix.

generate_sequential_amplitude_suffix(transition: StateTransition) str[source]#

Generate unique suffix for a sequential amplitude transition.

class CanonicalAmplitudeNameGenerator(transitions: ReactionInfo | Iterable[StateTransition], insert_parent_helicities: bool = False, insert_child_helicities: bool = False, insert_ls_combinations: bool = True)[source]#

Bases: HelicityAmplitudeNameGenerator

property insert_ls_combinations: bool[source]#

Embed each \(LS\)-combination in the coefficient names.

generate_amplitude_name(transition: StateTransition, node_id: int | None = None) str[source]#

Generates a unique name for the amplitude corresponding.

That is, corresponging to the given Transition. If node_id is given, it generates a unique name for the partial amplitude corresponding to the interaction node of the given Transition.

create_amplitude_symbol(transition: StateTransition) Indexed[source]#
create_amplitude_base(topology: Topology) IndexedBase[source]#
generate_transition_label(transition: StateTransition) str[source]#

Generate a label for a coherent intensity, including spin projection.

>>> import qrules
>>> reaction = qrules.generate_transitions(
...     initial_state="J/psi(1S)",
...     final_state=["gamma", "pi0", "pi0"],
...     allowed_intermediate_particles=["f(0)(980)"],
... )
>>> print(generate_transition_label(reaction.transitions[0]))
J/\psi(1S)_{-1} \to \gamma_{-1} \pi^{0}_{0} \pi^{0}_{0}
>>> print(generate_transition_label(reaction.transitions[-1]))
J/\psi(1S)_{+1} \to \gamma_{+1} \pi^{0}_{0} \pi^{0}_{0}
get_helicity_angle_symbols(topology: Topology, state_id: int) tuple[Symbol, Symbol][source]#

Generate a nested helicity angle label for \(\phi,\theta\).

See get_boost_chain_suffix() for the meaning of the suffix.

get_boost_chain_suffix(topology: Topology, state_id: int) str[source]#

Generate a subscript-superscript to identify a chain of Lorentz boosts.

The generated subscripts describe the decay sequence from the right to the left, separated by commas. Resonance edge IDs are expressed as a sum of the final state IDs that lie below them (see determine_attached_final_state()). The generated label does not state the top-most edge (the initial state).

Example

The following two allowed isobar topologies for a 1-to-5-body decay illustrates how the naming scheme results in a unique label for each of the eight edges in the decay topology. Note that label only uses final state IDs, but still reflects the internal decay topology.

>>> from qrules.topology import create_isobar_topologies
>>> from ampform._qrules import get_qrules_version
>>> topologies = create_isobar_topologies(5)
>>> topology = topologies[0 if get_qrules_version() < (0, 10) else 3]
>>> for i in topology.intermediate_edge_ids | topology.outgoing_edge_ids:
...     suffix = get_boost_chain_suffix(topology, i)
...     print(f"{i}: 'phi{suffix}'")
0: 'phi_0^034'
1: 'phi_1^12'
2: 'phi_2^12'
3: 'phi_3^34,034'
4: 'phi_4^34,034'
5: 'phi_034'
6: 'phi_12'
7: 'phi_34^034'
>>> topology = topologies[1 if get_qrules_version() < (0, 10) else 2]
>>> for i in topology.intermediate_edge_ids | topology.outgoing_edge_ids:
...     suffix = get_boost_chain_suffix(topology, i)
...     print(f"{i}: 'phi{suffix}'")
0: 'phi_0^01'
1: 'phi_1^01'
2: 'phi_2^234'
3: 'phi_3^34,234'
4: 'phi_4^34,234'
5: 'phi_01'
6: 'phi_234'
7: 'phi_34^234'

Some labels explained:

  • phi_12: edge 6 on the left topology, because for this topology, we have \(p_6=p_1+p_2\).

  • phi_234: edge 6 right, because for this topology, \(p_6=p_2+p_3+p_4\).

  • phi_1^12: edge 1 left, because 1 decays from \(p_6=p_1+p_2\).

  • phi_1^01: edge 1 right, because it decays from \(p_5=p_0+p_1\).

  • phi_4^34,234: edge 4 right, because it decays from edge 7 (\(p_7=p_3+p_4\)), which comes from edge 6 (\(p_7=p_2+p_3+p_4\)).

As noted, the top-most parent (initial state) is not listed in the label.

../../_images/graphviz_2.svg

topologies[0]#

../../_images/graphviz_3.svg

topologies[1]#

get_helicity_suffix(topology: Topology, state_id: int) str[source]#

Create an identifier suffix for a topology.

Used in Spin alignment. Comparable to get_boost_chain_suffix().

get_topology_identifier(topology: Topology) str[source]#

Create an identifier str for a Topology.

natural_sorting(text: str) list[float | str][source]#

Function that can be used for natural sort order in sorted().

See natural sort order.

>>> sorted(["z11", "z2"], key=natural_sorting)
['z2', 'z11']
create_helicity_symbol(topology: Topology, state_id: int, root: str = 'lambda') Symbol[source]#
create_spin_projection_symbol(state_id: int) Symbol[source]#
collect_spin_projections(reaction: ReactionInfo) dict[Symbol, set[Rational]][source]#