ComPWA / qrules

Rule-based particle reaction problem solver on a quantum number level
https://qrules.rtfd.io
Apache License 2.0
9 stars 5 forks source link

Let TopologyBuilder handle 2-to-n transition #29

Open redeboer opened 4 years ago

redeboer commented 4 years ago

There seems to be a bug in the SimpleStateTransitionTopologyBuilder: it doesn't correctly handle a list of InteractionNodes:

from expertsystem.reaction.topology import (
    InteractionNode,
    SimpleStateTransitionTopologyBuilder,
)

int_nodes = [
    InteractionNode("TwoBodyDecay", 1, 2),
    InteractionNode("TwoBodyProduction", 2, 1),
]
topology_builder = SimpleStateTransitionTopologyBuilder(int_nodes)
topology_builder.build_graphs(2, 3)
    149             connected_nodes = edge.get_connected_nodes()
    150             if not connected_nodes:
--> 151                 raise ValueError(
    152                     f"Edge nr. {edge_id} is not connected to any node ({edge})"
    153                 )

ValueError: Edge nr. 1 is not connected to any node (Edge(ending_node_id=None, originating_node_id=None))

If I understand correctly, the above snippet should handle a 2-to-3 transition that should look like this:

image

Code to create the figure ```python import graphviz import expertsystem as es from expertsystem.reaction.topology import Edge, Topology topology = Topology( nodes={0, 1, 2}, edges={ 0: Edge(0, None), 1: Edge(0, None), 2: Edge(1, 0), 3: Edge(2, 1), 4: Edge(None, 1), 5: Edge(None, 2), 6: Edge(None, 2), }, ) dot = es.io.convert_to_dot(topology) graphviz.Source(dot) ```
redeboer commented 2 months ago

@grayson-helmholz this also needs to cover $t$ channels image