Skip to content
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

Make sure neutron, proton and their anti-particles compare equal #622

Merged
merged 14 commits into from
Sep 7, 2024

Conversation

maxnoe
Copy link
Contributor

@maxnoe maxnoe commented Sep 6, 2024

I added two dicts that are build at import time, one mapping one pdgid to the alternative representation to implement the comparison and one with the "preferred" pdgid used for __hash__ and to make from_name work and always return the same pdgid.

I chose the "bag of quarks" ids for the "preferred" options, for no particular reason.

Edit: that's actually the official recommendation:

To avoid ambiguities, nuclear codes should not be applied to a single hadron, like p, n or Λ0, where quark-contents-based codes already exist.

From that I infer though, that neutron and proton are not the only cases, also the delta resonance at least.

Closes #620.

@codecov-commenter
Copy link

codecov-commenter commented Sep 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.20%. Comparing base (4f8e0cb) to head (bb574cc).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #622      +/-   ##
==========================================
+ Coverage   96.07%   96.20%   +0.13%     
==========================================
  Files          32       32              
  Lines        1324     1343      +19     
==========================================
+ Hits         1272     1292      +20     
+ Misses         52       51       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maxnoe maxnoe force-pushed the cmp_duplicate_pdgids branch from 248d6a0 to e96c95a Compare September 6, 2024 11:49
@maxnoe maxnoe force-pushed the cmp_duplicate_pdgids branch from 3855a0a to f7fd799 Compare September 6, 2024 11:51
@eduardo-rodrigues eduardo-rodrigues self-assigned this Sep 6, 2024
@maxnoe maxnoe force-pushed the cmp_duplicate_pdgids branch 2 times, most recently from 20a1817 to b727c65 Compare September 6, 2024 13:23
@eduardo-rodrigues
Copy link
Member

Thanks very much @maxnoe for the speedy action 👍! I've got something urgent to finish today but will get back to this really soon.

I hope this also handles the feature #620.

Oh, I see you got those quotes from the docstring for nuclei, which I probably got from somewhere such as periodictable when including the nuclei. It would be easier if no nucleus codes existed for the proton and neutron, but ...

Indeed the scheme can also handle hypernuclei with a p or n being replaced by a Lambda. Some are known, and for example have been studied by ALICE and LHCb :-).

@maxnoe maxnoe force-pushed the cmp_duplicate_pdgids branch from b727c65 to 314d754 Compare September 6, 2024 13:29
@maxnoe
Copy link
Contributor Author

maxnoe commented Sep 6, 2024

I hope this also handles the feature #620.

Yes, see the tests

Copy link
Member

@eduardo-rodrigues eduardo-rodrigues left a comment

Choose a reason for hiding this comment

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

Many thanks for this great PR. I believe you are done, but kindly confirm and I will merge. Thank you 👍!

Closes #620.

@maxnoe
Copy link
Contributor Author

maxnoe commented Sep 6, 2024

Yes, from my side this is ready

@eduardo-rodrigues
Copy link
Member

Thank you again.

@eduardo-rodrigues eduardo-rodrigues merged commit 4bd0784 into scikit-hep:master Sep 7, 2024
13 checks passed
@maxnoe maxnoe deleted the cmp_duplicate_pdgids branch September 7, 2024 11:47
@eduardo-rodrigues
Copy link
Member

@all-contributors please add @maxnoe for code

Copy link
Contributor

@eduardo-rodrigues

I've put up a pull request to add @maxnoe! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix ⚙️ enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

from_nucleus_info and from_name inconsitency
3 participants