Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Match final state IDs with input order in StateTransitionManager #143

Closed
redeboer opened this issue Jan 28, 2022 · 0 comments · Fixed by #145
Closed

Match final state IDs with input order in StateTransitionManager #143

redeboer opened this issue Jan 28, 2022 · 0 comments · Fixed by #145
Assignees
Labels
🐛 Bug Something isn't working ❔ Question Discuss this matter in the team
Milestone

Comments

@redeboer
Copy link
Member

redeboer commented Jan 28, 2022

The final state IDs that assigned to a generated ReactionInfo object do not match the order of the final_state argument in the StateTransitionManager (and therefore in generate_transitions()):

>>> import qrules
>>> reaction = qrules.generate_transitions(
...     initial_state="J/psi(1S)",
...     final_state=["K0", "Sigma+", "p~"],
...     allowed_intermediate_particles=["Sigma(1660)~-", "N(1650)+"],
...     allowed_interaction_types="strong",
... )
>>> transition = reaction.transitions[0]
>>> {i: state.particle.name for i, state in transition.final_states.items()}
{0: 'Sigma+', 1: 'K0', 2: 'p~'}

One would expect {0: 'K0', 1: 'Sigma+', 2: 'p~'}.

The ProblemSets that are created by the StateTransitionManger in between also do not always have the correct final state ID mapping:

>>> stm = StateTransitionManager(
...     initial_state=["J/psi(1S)"],
...     final_state=["K0", "Sigma+", "p~"],
...     allowed_intermediate_particles=["Sigma(1660)~-", "N(1650)+"],
... )
>>> stm.set_allowed_interaction_types([InteractionType.STRONG])
>>> problem_sets = stm.create_problem_sets()
>>> initial_facts = problem_sets[3600.0][0].initial_facts
>>> {i: prop[0].name for i, prop in initial_facts.edge_props.items()}
{-1: 'J/psi(1S)', 0: 'K0', 1: 'Sigma+', 2: 'p~'}
>>> initial_facts = problem_sets[3600.0][12].initial_facts
>>> {i: prop[0].name for i, prop in initial_facts.edge_props.items()}
{-1: 'J/psi(1S)', 0: 'Sigma+', 1: 'K0', 2: 'p~'}

The reason is probably that the kinematic permutations in the combinatorics module permutate the properties and not the edge IDs of the underlying Topology. This is better addressed through #144.

@redeboer redeboer added 🐛 Bug Something isn't working ❔ Question Discuss this matter in the team labels Jan 28, 2022
@redeboer redeboer added this to the 0.9.6 milestone Jan 28, 2022
@redeboer redeboer self-assigned this Jan 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working ❔ Question Discuss this matter in the team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant