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)
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)
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
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
def main(): logging.basicConfig(level=logging.INFO) # initialize the graph edges (initial and final state) initial_state = [("EpEm", [-1, 1])] final_state = [("Chic1", [-1, 1]), ("pi+", [0]), ("pi-", [0])] tbd_manager = StateTransitionManager(initial_state, final_state, [], {}, "canonical") tbd_manager.add_final_state_grouping([["Chic1", "pi+"]]) tbd_manager.set_allowed_interaction_types([InteractionTypes.EM]) graph_node_setting_pairs = tbd_manager.prepare_graphs() (solutions, violated_rules) = tbd_manager.find_solutions(graph_node_setting_pairs) print("found " + str(len(solutions)) + " solutions!") if len(solutions) == 0: print("violated rules: " + str(violated_rules)) print("intermediate states:") for g in solutions: print(g.edge_props[1]["@Name"])
from pycompwa.expertsystem.ui.system_control import (StateTransitionManager, InteractionTypes) from pycompwa.expertsystem.amplitude.helicitydecay import ( HelicityDecayAmplitudeGeneratorXML) logging.basicConfig(level=logging.INFO) # initialize the graph edges (initial and final state) initial_state = [("J/psi", [1])] final_state = [("pi0", [0]), ("pi+", [0]), ("pi-", [0])] tbd_manager = StateTransitionManager(initial_state, final_state, ['rho']) # tbd_manager.number_of_threads = 1 tbd_manager.add_final_state_grouping(['pi+', 'pi-']) tbd_manager.set_allowed_interaction_types([InteractionTypes.EM]) graph_interaction_settings_groups = tbd_manager.prepare_graphs() (solutions, violated_rules ) = tbd_manager.find_solutions(graph_interaction_settings_groups) print("found " + str(len(solutions)) + " solutions!") print("intermediate states:") for g in solutions: print(g.edge_props[1]['@Name']) xml_generator = HelicityDecayAmplitudeGeneratorXML() xml_generator.generate(solutions) xml_generator.write_to_file('test.xml')
def test_script_full(): # initialize the graph edges (intial and final state) initial_state = [("Y", [-1, 1])] final_state = ["D0", "D0bar", "pi0", "pi0"] # because the amount of solutions is too big we change the default domains formalism_type = 'canonical-helicity' int_settings = create_default_interaction_settings(formalism_type) change_qn_domain(int_settings[InteractionTypes.Strong], InteractionQuantumNumberNames.L, create_spin_domain([0, 1, 2, 3], True)) change_qn_domain(int_settings[InteractionTypes.Strong], InteractionQuantumNumberNames.S, create_spin_domain([0, 1, 2], True)) tbd_manager = StateTransitionManager( initial_state, final_state, ['D*'], interaction_type_settings=int_settings, formalism_type=formalism_type) tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong]) tbd_manager.add_final_state_grouping([['D0', 'pi0'], ['D0bar', 'pi0']]) tbd_manager.number_of_threads = 2 graph_node_setting_pairs = tbd_manager.prepare_graphs() (solutions, violated_rules) = tbd_manager.find_solutions(graph_node_setting_pairs) print("found " + str(len(solutions)) + " solutions!") canonical_xml_generator = CanonicalDecayAmplitudeGeneratorXML() canonical_xml_generator.generate(solutions) # because the amount of solutions is too big we change the default domains formalism_type = 'helicity' int_settings = create_default_interaction_settings(formalism_type) change_qn_domain(int_settings[InteractionTypes.Strong], InteractionQuantumNumberNames.L, create_spin_domain([0, 1, 2, 3], True)) change_qn_domain(int_settings[InteractionTypes.Strong], InteractionQuantumNumberNames.S, create_spin_domain([0, 1, 2], True)) tbd_manager = StateTransitionManager( initial_state, final_state, ['D*'], interaction_type_settings=int_settings, formalism_type=formalism_type) tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong]) tbd_manager.add_final_state_grouping([['D0', 'pi0'], ['D0bar', 'pi0']]) tbd_manager.number_of_threads = 2 graph_node_setting_pairs = tbd_manager.prepare_graphs() (solutions, violated_rules) = tbd_manager.find_solutions(graph_node_setting_pairs) print("found " + str(len(solutions)) + " solutions!") helicity_xml_generator = HelicityDecayAmplitudeGeneratorXML() helicity_xml_generator.generate(solutions) #print(helicity_xml_generator.fit_parameters, # canonical_xml_generator.fit_parameters) assert (len(helicity_xml_generator.fit_parameters) == len( canonical_xml_generator.fit_parameters))
def test_script_full(): # initialize the graph edges (intial and final state) initial_state = [("Y", [-1, 1])] final_state = ["D0", "D0bar", "pi0", "pi0"] # because the amount of solutions is too big we change the default domains formalism_type = 'canonical-helicity' int_settings = create_default_interaction_settings(formalism_type) change_qn_domain(int_settings[InteractionTypes.Strong], InteractionQuantumNumberNames.L, create_spin_domain([0, 1, 2, 3], True) ) change_qn_domain(int_settings[InteractionTypes.Strong], InteractionQuantumNumberNames.S, create_spin_domain([0, 1, 2], True) ) tbd_manager = StateTransitionManager(initial_state, final_state, ['D*'], interaction_type_settings=int_settings, formalism_type=formalism_type) tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong]) tbd_manager.add_final_state_grouping([['D0', 'pi0'], ['D0bar', 'pi0']]) tbd_manager.number_of_threads = 2 graph_node_setting_pairs = tbd_manager.prepare_graphs() (solutions, violated_rules) = tbd_manager.find_solutions( graph_node_setting_pairs) print("found " + str(len(solutions)) + " solutions!") canonical_xml_generator = CanonicalAmplitudeGeneratorXML() canonical_xml_generator.generate(solutions) # because the amount of solutions is too big we change the default domains formalism_type = 'helicity' int_settings = create_default_interaction_settings(formalism_type) change_qn_domain(int_settings[InteractionTypes.Strong], InteractionQuantumNumberNames.L, create_spin_domain([0, 1, 2, 3], True) ) change_qn_domain(int_settings[InteractionTypes.Strong], InteractionQuantumNumberNames.S, create_spin_domain([0, 1, 2], True) ) tbd_manager = StateTransitionManager(initial_state, final_state, ['D*'], interaction_type_settings=int_settings, formalism_type=formalism_type) tbd_manager.set_allowed_interaction_types([InteractionTypes.Strong]) tbd_manager.add_final_state_grouping([['D0', 'pi0'], ['D0bar', 'pi0']]) tbd_manager.number_of_threads = 2 graph_node_setting_pairs = tbd_manager.prepare_graphs() (solutions, violated_rules) = tbd_manager.find_solutions( graph_node_setting_pairs) print("found " + str(len(solutions)) + " solutions!") helicity_xml_generator = HelicityAmplitudeGeneratorXML() helicity_xml_generator.generate(solutions) assert (len(helicity_xml_generator.get_fit_parameters()) == len(canonical_xml_generator.get_fit_parameters()))
import logging from pycompwa.expertsystem.ui.system_control import ( StateTransitionManager, InteractionTypes) logging.basicConfig(level=logging.INFO) # initialize the graph edges (initial and final state) initial_state = [("EpEm", [-1, 1])] final_state = [("Chic1", [-1, 1]), ("pi+", [0]), ("pi-", [0])] tbd_manager = StateTransitionManager(initial_state, final_state, [], {}, 'canonical') tbd_manager.add_final_state_grouping([["Chic1", "pi+"]]) tbd_manager.set_allowed_interaction_types([InteractionTypes.EM]) graph_node_setting_pairs = tbd_manager.prepare_graphs() (solutions, violated_rules) = tbd_manager.find_solutions( graph_node_setting_pairs) print("found " + str(len(solutions)) + " solutions!") if len(solutions) == 0: print("violated rules: " + str(violated_rules)) print("intermediate states:") for g in solutions: print(g.edge_props[1]['@Name'])
from pycompwa.expertsystem.ui.system_control import ( StateTransitionManager, InteractionTypes) from pycompwa.expertsystem.amplitude.helicitydecay import ( HelicityDecayAmplitudeGeneratorXML) logging.basicConfig(level=logging.INFO) # initialize the graph edges (initial and final state) initial_state = [("J/psi", [1])] final_state = [("pi0", [0]), ("pi+", [0]), ("pi-", [0])] tbd_manager = StateTransitionManager(initial_state, final_state, ['rho']) #tbd_manager.number_of_threads = 1 tbd_manager.add_final_state_grouping(['pi+', 'pi-']) tbd_manager.set_allowed_interaction_types( [InteractionTypes.EM]) graph_interaction_settings_groups = tbd_manager.prepare_graphs() (solutions, violated_rules) = tbd_manager.find_solutions( graph_interaction_settings_groups) print("found " + str(len(solutions)) + " solutions!") print("intermediate states:") for g in solutions: print(g.edge_props[1]['@Name']) xml_generator = HelicityDecayAmplitudeGeneratorXML() xml_generator.generate(solutions)