Skip to content
This repository has been archived by the owner on Oct 11, 2021. It is now read-only.

fix!: update PDG values in particle_list #202

Merged
merged 18 commits into from
Aug 13, 2020
Merged

fix!: update PDG values in particle_list #202

merged 18 commits into from
Aug 13, 2020

Conversation

redeboer
Copy link
Member

No description provided.

@redeboer redeboer added Bug Something isn't working 🔨 Maintenance Refactoring that doesn't affect the interface labels Aug 12, 2020
@redeboer redeboer self-assigned this Aug 12, 2020
@codecov
Copy link

codecov bot commented Aug 13, 2020

Codecov Report

Merging #202 into master will increase coverage by 0.34%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #202      +/-   ##
==========================================
+ Coverage   88.28%   88.62%   +0.34%     
==========================================
  Files          22       22              
  Lines        2851     2858       +7     
  Branches      663      665       +2     
==========================================
+ Hits         2517     2533      +16     
+ Misses        190      184       -6     
+ Partials      144      141       -3     
Flag Coverage Δ
#unittests 88.62% <100.00%> (+0.34%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
expertsystem/data.py 98.34% <100.00%> (+5.81%) ⬆️
expertsystem/io/xml/_build.py 85.96% <0.00%> (-3.51%) ⬇️
expertsystem/state/particle.py 88.61% <0.00%> (+0.22%) ⬆️

@redeboer
Copy link
Member Author

redeboer commented Aug 13, 2020

@spflueger I'm only worried about 6226f16 because of the required changes in tests/channels/test_d0_to_kskpkm.py

@spflueger
Copy link
Member

@spflueger I'm only worried about 6226f16 because of the required changes in tests/channels/test_d0_to_kskpkm.py

Hmm I can take a look.

@redeboer redeboer changed the title fix!: update PDG values in particle_list.*xml fix!: update PDG values in particle_list.*ml Aug 13, 2020
@redeboer redeboer changed the title fix!: update PDG values in particle_list.*ml fix!: update PDG values in particle_list Aug 13, 2020
Copy link
Member

@spflueger spflueger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A faulty definition of the charged a0(980) particles make the D decay test fail. Currently a warning message is print out in such a case (quantum number solutions are found, but no matching particle can be inserted, due to a wrongly defined particle). I opened issue #205 to avoid having faulty particles in general. It would be a good options to include such a test in this PR, to ensure all particle definitions are correct.

expertsystem/particle_list.yml Outdated Show resolved Hide resolved
expertsystem/particle_list.yml Show resolved Hide resolved
@spflueger
Copy link
Member

So implementing the test as requested by #205 is to tedious currently. Once we switch the rules to use QuantumState like objects it will be much easier. So I would postpone #205 until later

@redeboer
Copy link
Member Author

So implementing the test as requested by #205 is to tedious currently.

Why is it tedious? I propose to:

  1. add a hypercharge property to QuantumState (works for both QuantumState[float] and QuantumState[Spin]
  2. do the Gell-Mann–Nishijima formula check in the constructor of Particle.

@wgradl
Copy link

wgradl commented Aug 13, 2020 via email

@spflueger
Copy link
Member

spflueger commented Aug 13, 2020

So implementing the test as requested by #205 is to tedious currently.

Why is it tedious? I propose to:

You have to convert the Particle to a dict of Enums etc

  1. add a hypercharge property to QuantumState (works for both QuantumState[float] and QuantumState[Spin]

Since hypercharge can be calculated from the other QN already, this info is redundant and just adds one more point of inconsistency. Hence I oppose that

  1. do the Gell-Mann–Nishijima formula check in the constructor of Particle.

That is a good point.

@spflueger
Copy link
Member

hmmm ... consider the decay D0 --> a0(980)+ K- on the quark level: [c ubar] --> [s ubar] W+ --> [s ubar] [u dbar] ~ K- a0+ the a0+ then decays like this: [u dbar] --> [u (sbar s) dbar] --> [u sbar] [s dbar] ~ K+ K0_bar so, the correct decay to consider would be D0 --> K0_bar K+ K-. No?

@wgradl Maybe there is slight misunderstanding. We are currently testing D0 --> K0_bar K+ K-. Just the isospin of a0(980)+/- were defined incorrectly in this PR, which made the test fail. So everything is ok.

@wgradl
Copy link

wgradl commented Aug 13, 2020 via email

@spflueger
Copy link
Member

hmmm ... consider the decay D0 --> a0(980)+ K- on the quark level: [c ubar] --> [s ubar] W+ --> [s ubar] [u dbar] ~ K- a0+ the a0+ then decays like this: [u dbar] --> [u (sbar s) dbar] --> [u sbar] [s dbar] ~ K+ K0_bar so, the correct decay to consider would be D0 --> K0_bar K+ K-. No? @wgradl Maybe there is slight misunderstanding. We are currently testing D0 --> K0_bar K+ K-. Just the isospin of a0(980)+/- were defined incorrectly in this PR, which made the test fail. So everything is ok.
@spflueger: ok, I see. Your inital comment mentioned D0 --> K0 K+ K-, so I was a bit puzzled. Nevertheless, the isospin projection of the a0+ should be +1, just as for the pi+ (because it has identical quark contents). If that makes the tests fail, then something else has gone awry.

Ah I see, very valuable comment. Currently the test just checks if this is generally possible. Since it will also try pure weak interactions (for both vertices/nodes) it will also work with a K0. Hence I used the terms K0 and K0_bar abit sloppy here.

I conclude two important points from your comment:

  • we should make the second decay vertex strong interaction only. This would actually forbid a K0.
  • we can think about implementing CKM matrix (roughly) to further rate different decay channels based on their probability or strength

@@ -215,6 +216,37 @@ def __repr__(self) -> str:
return f"{self.__class__.__name__}{self.name, self.pid, self.state, self.mass, self.width}"


def compute_gellmann_nishijima(state: QuantumState) -> Optional[float]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better change this to return a int

Copy link
Member Author

@redeboer redeboer Aug 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that at first, but then figured the cast to int that would be required here is implicit behaviour. Afaik formula itself holds just as well for float charges.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the charge from the QuantumState or your tests are using int. So then a potential cast to int will be done at that point of comparison. Hence I would rather put it in that function. It might hold for float charges, but actually measurable particle has float charge. So you could also filter this problem there. if (charge).is_integer(): return int(charge)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the filtering should take place here:

if (
state.isospin is not None
and compute_gellmann_nishijima(state) != state.charge
):

This check will fail if the GM fomula returned a float that is not an integer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (charge).is_integer(): return int(charge)

To be clear: this would also mean raising an exception if the charge is not castable to int. For me that is unexpected behaviour in a function that is just supposed to compute the Gell-Mann–Nishijima formula (as its name states).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, you have a point. So I think you are right, we do not have to put any more assumptions in there. I just want to make sure we are actually catching out the ill defined particles.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think because particle.charge is of type int, we are on the safe side.

Copy link
Member Author

@redeboer redeboer Aug 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Particle instances with non-castable float charge raise an exception, even if they comply with the Gell-Mann–Nishijima formula. QuantumState instances with weird charges are allowed, but there's no check on GM formula there anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And mypy would fish out float charges anyways right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but mypy isn't checked on outside scripts, it's only used as a consistency check for the framework and tests themselves. But for a user running, say, a Jupyter notebook, an exception would be raised for any Particle that has unphysical charge (as per Gell-Mann–Nishijima formula + cast check). QuantumState remains an internal matter, however.

tests/data/test_particle.py Show resolved Hide resolved
tests/data/test_particle.py Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working 🔨 Maintenance Refactoring that doesn't affect the interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants