reaction

Definition and solving of particle reaction problems.

This is the core component of the expertsystem: it defines the StateTransitionGraph data structure that represents a specific particle reaction. The solving submodule is responsible for finding solutions for particle reaction problems.

class ProblemSet(topology: expertsystem.reaction.topology.Topology, initial_facts: expertsystem.reaction.combinatorics.InitialFacts, solving_settings: expertsystem.reaction.solving.GraphSettings)[source]

Bases: object

Particle reaction problem set, defined as a graph like data structure.

Parameters
  • topologyTopology that contains the structure of the reaction.

  • initial_factsInitialFacts that contain the info of initial and final state in connection with the topology.

  • solving_settings – Solving related settings such as the conservation rules and the quantum number domains.

__eq__(other)

Method generated by attrs for class ProblemSet.

initial_facts: expertsystem.reaction.combinatorics.InitialFacts
solving_settings: expertsystem.reaction.solving.GraphSettings
topology: expertsystem.reaction.topology.Topology
class Result(solutions: Optional[List[expertsystem.reaction.topology.StateTransitionGraph[Tuple[expertsystem.particle.Particle, float]]]] = None, not_executed_node_rules: Optional[Dict[int, Set[str]]] = None, violated_node_rules: Optional[Dict[int, Set[str]]] = None, not_executed_edge_rules: Optional[Dict[int, Set[str]]] = None, violated_edge_rules: Optional[Dict[int, Set[str]]] = None, formalism_type: Optional[str] = None)[source]

Bases: object

Defines a result of a ProblemSet.

Returned by the StateTransitionManager

collapse_graphs() → List[expertsystem.reaction.topology.StateTransitionGraph[expertsystem.particle.ParticleCollection]][source]
extend(other_result: expertsystem.reaction.Result, intersect_violations: bool = False)None[source]
property formalism_type
get_final_state() → List[expertsystem.particle.Particle][source]
get_initial_state() → List[expertsystem.particle.Particle][source]
get_intermediate_particles()expertsystem.particle.ParticleCollection[source]

Extract the names of the intermediate state particles.

get_particle_graphs() → List[expertsystem.reaction.topology.StateTransitionGraph[expertsystem.particle.Particle]][source]

Strip list of StateTransitionGraph s of the spin projections.

Extract a list of StateTransitionGraph instances with only particles on the edges.

property not_executed_edge_rules
property not_executed_node_rules
property solutions
property violated_edge_rules
property violated_node_rules
class SolvingMode(value)[source]

Bases: enum.Enum

Types of modes for solving.

Fast = 1

find “likeliest” solutions only

Full = 2

find all possible solutions

class StateTransitionManager(initial_state: Sequence[Union[str, Tuple[str, Sequence[float]]]], final_state: Sequence[Union[str, Tuple[str, Sequence[float]]]], particles: Optional[expertsystem.particle.ParticleCollection] = None, allowed_intermediate_particles: Optional[List[str]] = None, interaction_type_settings: Optional[Dict[expertsystem.reaction.default_settings.InteractionTypes, Tuple[expertsystem.reaction.solving.EdgeSettings, expertsystem.reaction.solving.NodeSettings]]] = None, formalism_type: str = 'helicity', topology_building: str = 'isobar', number_of_threads: Optional[int] = None, solving_mode: expertsystem.reaction.SolvingMode = <SolvingMode.Fast: 1>, reload_pdg: bool = False)[source]

Bases: object

Main handler for decay topologies.

add_final_state_grouping(fs_group: List[Union[str, List[str]]])None[source]
create_problem_sets() → Dict[float, List[expertsystem.reaction.ProblemSet]][source]
find_solutions(problem_sets: Dict[float, List[expertsystem.reaction.ProblemSet]])expertsystem.reaction.Result[source]

Check for solutions for a specific set of interaction settings.

property formalism_type
set_allowed_interaction_types(allowed_interaction_types: List[expertsystem.reaction.default_settings.InteractionTypes])None[source]
set_allowed_intermediate_particles(particle_names: List[str])None[source]
set_topology_builder(topology_builder: expertsystem.reaction.topology.SimpleStateTransitionTopologyBuilder)None[source]
check_reaction_violations(initial_state: Union[str, Tuple[str, Sequence[float]], Sequence[Union[str, Tuple[str, Sequence[float]]]]], final_state: Sequence[Union[str, Tuple[str, Sequence[float]]]]) → Set[FrozenSet[str]][source]

Determine violated interaction rules for a given particle reaction.

Warning

This function does only guarantees to find P, C and G parity violations, if it’s a two body decay. If all initial and final states have the C/G parity defined, then these violations are also determined correctly.

Parameters
  • initial_state – Shortform description of the initial state w/o spin projections.

  • final_state – Shortform description of the final state w/o spin projections.

Returns

Set of least violating rules. The set can have multiple entries, as several quantum numbers can be violated. Each entry in the frozenset represents a group of rules that together violate all possible quantum number configurations.

generate(initial_state: Union[str, Tuple[str, Sequence[float]], Sequence[Union[str, Tuple[str, Sequence[float]]]]], final_state: Sequence[Union[str, Tuple[str, Sequence[float]]]], allowed_intermediate_particles: Optional[List[str]] = None, allowed_interaction_types: Optional[Union[str, List[str]]] = None, formalism_type: str = 'helicity', particles: Optional[expertsystem.particle.ParticleCollection] = None, topology_building: str = 'isobar', number_of_threads: Optional[int] = None)expertsystem.reaction.Result[source]

Generate allowed transitions between an initial and final state.

Serves as a facade to the StateTransitionManager (see Create amplitude models).

Parameters
  • initial_state (list) – A list of particle names in the initial state. You can specify spin projections for these particles with a tuple, e.g. ("J/psi(1S)", [-1, 0, +1]). If spin projections are not specified, all projections are taken, so the example here would be equivalent to "J/psi(1S)".

  • final_state (list) – Same as initial_state, but for final state particles.

  • allowed_intermediate_particles (list, optional) – A list of particle states that you want to allow as intermediate states. This helps (1) filter out resonances in the eventual AmplitudeModel and (2) speed up computation time.

  • allowed_interaction_types (str, optional) – Interaction types you want to consider. For instance, both "strong and EM" and ["s", "em"] results in EM and Strong.

  • formalism_type (str, optional) – Formalism that you intend to use in the eventual AmplitudeModel.

  • particles (ParticleCollection, optional) – The particles that you want to be involved in the reaction. Uses load_default_particles by default. It’s better to use a subset for larger reactions, because of the computation times. This argument is especially useful when you want to use your own particle definitions (see Particle database).

  • topology_building (str) –

    Technique with which to build the Topology instances. Allowed values are:

    • "isobar": Isobar model (each state decays into two states)

    • "nbody": Use one central node and connect initial and final states to it

  • number_of_threads (int) – Number of cores with which to compute the allowed transitions. Defaults to all cores on the system.

An example (where, for illustrative purposes only, we specify all arguments) would be:

>>> import expertsystem as es
>>> result = es.reaction.generate(
...     initial_state="D0",
...     final_state=["K~0", "K+", "K-"],
...     allowed_intermediate_particles=["a(0)(980)", "a(2)(1320)-"],
...     allowed_interaction_types="ew",
...     formalism_type="helicity",
...     particles=es.io.load_pdg(),
...     topology_building="isobar",
... )
>>> len(result.solutions)
4
load_default_particles()expertsystem.particle.ParticleCollection[source]

Load the default particle list that comes with the expertsystem.

Runs load_pdg and supplements its output definitions from the file additional_particle_definitions.yml.

Submodules and Subpackages