-
Notifications
You must be signed in to change notification settings - Fork 62
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
use particle
package to get PDG data
#114
Conversation
flavio/parameters.py
Outdated
sub = m.group(2) | ||
sup = (m.group(3) or '') + (m.group(5) or '') | ||
par = m.group(4) | ||
if sub or name in 'W Z H e \\mu \\tau': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be name in ["W", "Z", ...]
? I think "\\mu" in "\\mu"
is False
since it iterates character by characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"\\mu" in "\\mu"
is True
since in
tests for substring containment (cf. https://docs.python.org/3/reference/expressions.html#membership-test-details).
But I agree that it's maybe not a good idea to just test for substring containment since e.g. also names a
, u
, and au
would be in '\\tau'
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you're right, sorry! But yeah, list might still be better.
flavio/parameters.py
Outdated
if sub or name in 'W Z H e \\mu \\tau': | ||
# remove superscripts +-0 and keep only * | ||
sup = '*' if '*' in sup else '' | ||
if not sub and par and par.upper().isupper() and par not in '1S': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not in "1S"
matches everything except 1
and S
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, I think this should maybe better be ... and name != 'J/\\psi'
.
The idea was to add a subscript with what is inside the parentheses of the latex name in case this is more than just a number (usually corresponding to the mass) and if there is no other subscript. So e.g. 'D^{*}(2007)^{0}'
becomes'D^{*0}'
since the parentheses contain only a number, but '\\psi(2S)'
becomes '\\psi_{2S}'
since the parentheses do not contain only a number. (Checking the content of the parentheses is currently done using par.upper().isupper()
but should probably better be done by not par.isdigit()
)
The only exception from this rule is 'J/\\psi(1S)'
, which should become 'J/\\psi'
. So I guess it's clearer to apply this exception only to 'J/\\psi'
and not to anything contained 1S
.
Great! Possibly all the particle-specific stuff could be collected in a class (e.g. |
This is a very good idea and I have now moved everything to the new |
Nice!
I think it's fine...
It's a constant and it's only needed by the class, so I think it naturally fits as a class attribute: class FlavioParticle(Particle):
"""..."""
PDG_PARTICLES = {...} which can be accessed as |
Yes, I agree and have implemented this in 0582522. This now looks quite complete and I would merge this PR soon. |
This PR replaces the functions for reading PDG data files by an interface to the python package
particle
as suggested and discussed in isse #112.The main changes are:
flavio_name
, which is the name used e.g. in the mass parameters, and by their PDG IDs. Translating the former into the latter is done using thepdg_particles
dictionary, replacing the old listspdg_include
andpdg_translate
.particle
. PDG data files and the old function_read_pdg_masswidth
are removed.particle
, but simplified using the new_pdg_tex_simplify
function. The result is equivalent to the one of the old_pdg_particle_string_to_tex
function, which is removed.pdg_particles
.