Exemplo n.º 1
0
def test_external_edge_identical_particle_combinatorics(
        initial_state, final_state, final_state_groupings, result_graph_count):
    tbd_manager = StateTransitionManager(initial_state,
                                         final_state, [],
                                         formalism_type="helicity")

    tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong])
    for x in final_state_groupings:
        tbd_manager.add_final_state_grouping(x)
    tbd_manager.number_of_threads = 1

    topology_graphs = tbd_manager.build_topologies()

    init_graphs = tbd_manager.create_seed_graphs(topology_graphs)
    match_external_edges(init_graphs)

    comb_graphs = []
    for x in init_graphs:
        comb_graphs.extend(
            perform_external_edge_identical_particle_combinatorics(x))
    assert len(comb_graphs) == result_graph_count

    ref_mapping_fs = create_edge_id_particle_mapping(comb_graphs[0],
                                                     get_final_state_edges)
    ref_mapping_is = create_edge_id_particle_mapping(comb_graphs[0],
                                                     get_initial_state_edges)

    for x in comb_graphs[1:]:
        assert ref_mapping_fs == create_edge_id_particle_mapping(
            x, get_final_state_edges)
        assert ref_mapping_is == create_edge_id_particle_mapping(
            x, get_initial_state_edges)
Exemplo n.º 2
0
def test_external_edge_identical_particle_combinatorics(initial_state,
                                                        final_state,
                                                        final_state_groupings,
                                                        result_graph_count):
    tbd_manager = StateTransitionManager(initial_state, final_state, [],
                                         formalism_type='helicity')

    tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong])
    for x in final_state_groupings:
        tbd_manager.add_final_state_grouping(x)
    tbd_manager.number_of_threads = 1

    topology_graphs = tbd_manager.build_topologies()

    init_graphs = tbd_manager.create_seed_graphs(topology_graphs)
    match_external_edges(init_graphs)

    comb_graphs = []
    for x in init_graphs:
        comb_graphs.extend(
            perform_external_edge_identical_particle_combinatorics(x))
    assert len(comb_graphs) == result_graph_count

    ref_mapping_fs = create_edge_id_particle_mapping(comb_graphs[0],
                                                     get_final_state_edges)
    ref_mapping_is = create_edge_id_particle_mapping(comb_graphs[0],
                                                     get_initial_state_edges)

    for x in comb_graphs[1:]:
        assert ref_mapping_fs == create_edge_id_particle_mapping(
            x, get_final_state_edges)
        assert ref_mapping_is == create_edge_id_particle_mapping(
            x, get_initial_state_edges)
Exemplo n.º 3
0
def test_edge_swap(initial_state, final_state):
    tbd_manager = StateTransitionManager(initial_state,
                                         final_state, [],
                                         formalism_type="helicity")

    tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong])
    tbd_manager.number_of_threads = 1

    topology_graphs = tbd_manager.build_topologies()
    init_graphs = tbd_manager.create_seed_graphs(topology_graphs)

    for x in init_graphs:
        ref_mapping = create_edge_id_particle_mapping(x, get_final_state_edges)
        edge_keys = list(ref_mapping.keys())
        edge1 = edge_keys[0]
        edge1_val = x.edges[edge1]
        edge1_props = x.edge_props[edge1]
        edge2 = edge_keys[1]
        edge2_val = x.edges[edge2]
        edge2_props = x.edge_props[edge2]
        x.swap_edges(edge1, edge2)
        assert x.edges[edge1] == edge2_val
        assert x.edges[edge2] == edge1_val
        assert x.edge_props[edge1] == edge2_props
        assert x.edge_props[edge2] == edge1_props
Exemplo n.º 4
0
def test_external_edge_initialization(initial_state, final_state,
                                      final_state_groupings,
                                      result_graph_count):
    tbd_manager = StateTransitionManager(initial_state, final_state, [],
                                         formalism_type='helicity')

    tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong])
    for x in final_state_groupings:
        tbd_manager.add_final_state_grouping(x)
    tbd_manager.number_of_threads = 1

    topology_graphs = tbd_manager.build_topologies()

    init_graphs = tbd_manager.create_seed_graphs(topology_graphs)
    assert len(init_graphs) == result_graph_count
Exemplo n.º 5
0
def test_external_edge_initialization(initial_state, final_state,
                                      final_state_groupings,
                                      result_graph_count):
    tbd_manager = StateTransitionManager(initial_state, final_state, [],
                                         formalism_type='helicity')

    tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong])
    for x in final_state_groupings:
        tbd_manager.add_final_state_grouping(x)
    tbd_manager.number_of_threads = 1

    topology_graphs = tbd_manager.build_topologies()

    init_graphs = tbd_manager.create_seed_graphs(topology_graphs)
    assert len(init_graphs) == result_graph_count
Exemplo n.º 6
0
def test_match_external_edges(initial_state, final_state):
    tbd_manager = StateTransitionManager(initial_state, final_state, [],
                                         formalism_type='helicity')

    tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong])
    tbd_manager.number_of_threads = 1

    topology_graphs = tbd_manager.build_topologies()
    init_graphs = tbd_manager.create_seed_graphs(topology_graphs)

    match_external_edges(init_graphs)

    ref_mapping_fs = create_edge_id_particle_mapping(init_graphs[0],
                                                     get_final_state_edges)
    ref_mapping_is = create_edge_id_particle_mapping(init_graphs[0],
                                                     get_initial_state_edges)

    for x in init_graphs[1:]:
        assert ref_mapping_fs == create_edge_id_particle_mapping(
            x, get_final_state_edges)
        assert ref_mapping_is == create_edge_id_particle_mapping(
            x, get_initial_state_edges)
Exemplo n.º 7
0
def test_match_external_edges(initial_state, final_state):
    tbd_manager = StateTransitionManager(initial_state, final_state, [],
                                         formalism_type='helicity')

    tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong])
    tbd_manager.number_of_threads = 1

    topology_graphs = tbd_manager.build_topologies()
    init_graphs = tbd_manager.create_seed_graphs(topology_graphs)

    match_external_edges(init_graphs)

    ref_mapping_fs = create_edge_id_particle_mapping(init_graphs[0],
                                                     get_final_state_edges)
    ref_mapping_is = create_edge_id_particle_mapping(init_graphs[0],
                                                     get_initial_state_edges)

    for x in init_graphs[1:]:
        assert ref_mapping_fs == create_edge_id_particle_mapping(
            x, get_final_state_edges)
        assert ref_mapping_is == create_edge_id_particle_mapping(
            x, get_initial_state_edges)
Exemplo n.º 8
0
def test_edge_swap(initial_state, final_state):
    tbd_manager = StateTransitionManager(initial_state, final_state, [],
                                         formalism_type='helicity')

    tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong])
    tbd_manager.number_of_threads = 1

    topology_graphs = tbd_manager.build_topologies()
    init_graphs = tbd_manager.create_seed_graphs(topology_graphs)

    for x in init_graphs:
        ref_mapping = create_edge_id_particle_mapping(x, get_final_state_edges)
        edge_keys = list(ref_mapping.keys())
        edge1 = edge_keys[0]
        edge1_val = x.edges[edge1]
        edge1_props = x.edge_props[edge1]
        edge2 = edge_keys[1]
        edge2_val = x.edges[edge2]
        edge2_props = x.edge_props[edge2]
        x.swap_edges(edge1, edge2)
        assert x.edges[edge1] == edge2_val
        assert x.edges[edge2] == edge1_val
        assert x.edge_props[edge1] == edge2_props
        assert x.edge_props[edge2] == edge1_props