Closed redeboer closed 4 years ago
@sebastianJaeger @Leongrim I added some snippets to the issue description :) Let me know if it you have questions!
I looked into the particle
package from scikit-hep
. There are a few problems with it.
This package does not get the information from the webpage but from a .csv
file which comes with the package which does not include all the particles that are found on the webpage.
The larger issue is not all quantum numbers are accessible. Something like Bottomness or IsospinZ are still calculable from the quarks. But regarding the lepton numbers there seems to be no a work around.
This package does not get the information from the webpage but from a .csv file which comes with the package which does not include all the particles that are found on the webpage.
Yes, this is true. But I am not aware of an official API for the PDG, so I think this package is the closest we can get, that is, 'outsource the downloading of the latest CSV file' to that package.
The larger issue is not all quantum numbers are accessible. Something like Bottomness or IsospinZ are still calculable from the quarks. But regarding the lepton numbers there seems to be no a work around.
Right, this sounds like a big problem... I had a quick look into the package and had the same impression, so glad that is confirmed.
So if I understand correctly, the particle
package does offer quark content, but you have to compute the numbers yourself... We should consider if that's feasible.
Btw, note that this issue is still independent of #152
You could work around this by a huge pile of if
statements😬
It would be possible to get the lepton numbers from the names.
You could work around this by a huge pile of if statementsgrimacing
I see. Well, it would be worth the effort, I think. Because if we manage to import all PDG info into a ParticleCollection
instance, one can do any quick search, like:
[
particle
for particle in DATABASE
if particle.state.spin == 0 and particle.state.bottom == 1
] # List[Particle]
And if you wrap put all these if
statements under some function like
def load_pdg() -> ParticleCollection:
...
then it can be refactored later on if there is a cleaner solution (possibly not using the particle
package).
It would be possible to get the lepton numbers from the names.
How so?
Through the name you can distinguish e, mu and tau and also neutrinos.
For the hadrons I get already something like
Baryonnumber=0
Strangeness = 0
Charmness = 0
Bottomness = 0
Topness = 0
isospinZ = 0
if pdg.pdgid.is_baryon:
Baryonnumber = 1
if pdg.pdgid<0:
Baryonnumber = -1
if pdg.pdgid.is_hadron:
for quark in pdg.quarks:
if quark in ["u","D"]:
isospinZ += 1/2
elif quark in ["U","d"]:
isospinZ -= 1/2
elif quark == "S":
Strangeness += 1
elif quark == "s":
Strangeness -= 1
elif quark == "c":
Charmness += 1
elif quark == "C":
Charmness -= 1
elif quark == "b":
Bottomness += 1
elif quark == "B":
Bottomness -= 1
elif quark == "t":
Topness += 1
elif quark == "T":
Topness -= 1
Hmm, it's the right direction for sure, but there's at least one worry: how to determine the magnitude of isospin?
That you can get from pdg.I
and also all the parity quantum numbers are easy accessible e.g pdg.P
.
Ah but that sounds good. Hang on, I'll create a small branch that can serve as a starting point.
Okay guys, have a look at this branch: https://github.com/ComPWA/expertsystem/tree/23-PDG-as-source-of-truth
This is where the magic should happen: https://github.com/ComPWA/expertsystem/blob/cfcdb6de052316c6e818307c34af1ea1ecace29a/expertsystem/io/_pdg.py#L17-L43
Notice that item
is a Particle
instance from the scikit-hep package
https://github.com/ComPWA/expertsystem/blob/cfcdb6de052316c6e818307c34af1ea1ecace29a/expertsystem/io/_pdg.py#L14-L16
So the challenge is to properly extract all attributes required for the expertsystem.data.Particle
instance from item
.
If you do if item.mass is not None:
the neutrinos are getting lost.
I just want to add that the lepton numbers are also of only very minor importance in this context, since we usually dont deal with leptons in pwa, and since there are a fixed number of 6 leptons, whose properties are very well tested, hardcoding them into the database should actually be a good option. The only thing that can reasonably be expected to change over time would be the tau branching fractions, but branching fractions in general are not yet included in the expertsystem i think.
Ah yeah, but that's just a detail, can be removed of course.
But yes, that is the place where the logic of those if
statements should happen.
I just want to add that the lepton numbers are also of only very minor importance in this context, since we usually don't deal with leptons in pwa, and since there are a fixed number of 6 leptons
The reason why Particle
carries attributes like these is that the expertsystem
needs those number internally to check conservation rules. So for the outside, this info is trivial, but internally it's super important :sweat_smile:
What do we do about nucleus?
They could be removed by all_pdg_particles = PdgDatabase.findall(lambda p: abs(p).pdgid<1e8)
.
Sadly something like all_pdg_particles = PdgDatabase.findall(lambda p: not p.pdgid.is_nucleus)
is not an option because this would remove protons and neutrons.
Good point. Are we sure that pdgid<1e8
does not exclude particles that are of interest?
I don´t think so but I have to check it.
[x] Investigate how to get all info required to construct a
Particle
instance from the scikit-hepParticle
package. This would be general particle info: https://github.com/ComPWA/expertsystem/blob/8b5c257c6738d3e50ff1d56a7a06714e3e2a7036/expertsystem/data.py#L176-L183 and quantum numbers: https://github.com/ComPWA/expertsystem/blob/8b5c257c6738d3e50ff1d56a7a06714e3e2a7036/expertsystem/data.py#L113-L126[x] Loop over the PDG definitions and create
Particle
instances, then add them withDATABASE.add
. This would have to be done underload_default_particle_list
, right here: https://github.com/ComPWA/expertsystem/blob/0265e9dc3b8f6cc5ae7c2d9ac834fdc28335e5ba/expertsystem/ui/__init__.py#L376 See here for a syntax example: https://github.com/ComPWA/expertsystem/blob/8b5c257c6738d3e50ff1d56a7a06714e3e2a7036/tests/io/test_particle_collection.py#L21-L33 Note: we use the template[float]
instead of[Spin]
because we are only interested in spin magnitude, not projection.[ ] Check whether definitions in
particle_list.yml
agree with the ones imported from the PDG.