-
Notifications
You must be signed in to change notification settings - Fork 16
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
Add several methods to handle decay descriptors #331
Add several methods to handle decay descriptors #331
Conversation
Thanks very much for this @admorris. Let me add some quick/trivial comments ... |
Co-authored-by: Eduardo Rodrigues <eduardo.rodrigues@cern.ch>
Hey @admorris, I fixed a trivial comment from MyPy but there are more pre-commit issues. Let me know if you need help and/or the timescale from your side to finalise matters. Thanks. |
Co-authored-by: Eduardo Rodrigues <eduardo.rodrigues@cern.ch>
… into print_descriptors
Co-authored-by: Eduardo Rodrigues <eduardo.rodrigues@cern.ch>
… into print_descriptors
Co-authored-by: Eduardo Rodrigues <eduardo.rodrigues@cern.ch>
… into print_descriptors
Your comment "NB: this implicitly reverts aliases back to the original (EvtGen) names" above seems relevant to have in the related docstring. Once you deal with these 2 things I reckon we can move towards a final test + merging. |
I have pushed commits that address your comments. I think it's ready to merge |
I see the CI fails because of some of the type hints you added/adapted. Did you look further into this and/or need help? |
I think you need to use Dict in both DecayModeDict and DecayChainDict type hint defs, though I do not fully understand why, to sort out the remaining issues. Can you give this a try? |
The python 3.7 and 3.8 checks are failing also on files not touched by this PR:
|
Yup, because the touched files are imported all over ;-). |
5d78060
to
c84198a
Compare
You're almost there ... |
Super 👍! I'm going to merge and likely make a release soon. There are plenty of tests to add for added functionality, but that can be a follow-up (in fact I already started collecting some files from LHCb that contained the new keywords and models). Thank you. |
Closes #332
Partly implements #200
Features
_expand_decay_modes
to thedecay
module: it takes aDecayChainDict
and returns a list of strings corresponding to all possible decay descriptors in the dict.DecayChain.to_string()
which represents the full decay chain as a single-line string, e.g.:DecFileParser.expand_decay_modes(particle)
which returns single-line strings for all full decay chains of the given particle, e.g.:Tests
tests/decay/test_descriptor.py
which checks the functionality ofDecayChain.to_string()
test_expand_decay_chains
totests/dec/test_dec.py
which testsDecFileParser.expand_decay_modes()
usingtests/data/test_example_Dst.dec
Other changes:
DecayModeDict
asDecayChainDict
and use in more places withindecay.py
DecayModeDict = dict[str, Union[float, str, list[Any]]]
was more suited to the "inner" dict that contained the keys "bf", "fs" etc...DecayChainDict
is now defined asdict[str, list[DecayModeDict]]
DecayModeDict
was only internal todecay.py
I think this is fine, although it could possibly break anything outside this package that might use it (can't imagine what or why)decay.py
oftyping.Dict
andtyping.List
with builtindict
andlist