-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: match final state IDs with final state order (#145)
* fix: switch order ABCs and Generic This is a problem identified by newer versions of Pyright * fix: match final state IDs in ReactionInfo to argument order * test: assert final state ID matches order
- Loading branch information
Showing
3 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pytest | ||
|
||
from qrules import generate_transitions | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"resonance_names", | ||
[ | ||
["Sigma(1660)~-"], | ||
["N(1650)+"], | ||
["K*(1680)~0"], | ||
["Sigma(1660)~-", "N(1650)+"], | ||
["Sigma(1660)~-", "K*(1680)~0"], | ||
["N(1650)+", "K*(1680)~0"], | ||
["Sigma(1660)~-", "N(1650)+", "K*(1680)~0"], | ||
], | ||
) | ||
def test_generate_transitions(resonance_names): | ||
final_state_names = ["K0", "Sigma+", "p~"] | ||
reaction = generate_transitions( | ||
initial_state="J/psi(1S)", | ||
final_state=final_state_names, | ||
allowed_intermediate_particles=resonance_names, | ||
allowed_interaction_types="strong", | ||
) | ||
assert len(reaction.transition_groups) == len(resonance_names) | ||
final_state = dict(enumerate(final_state_names)) | ||
for transition in reaction.transitions: | ||
this_final_state = { | ||
i: state.particle.name | ||
for i, state in transition.final_states.items() | ||
} | ||
assert final_state == this_final_state |