Repository navigation
Conversation
EXFOR's light-particle codes (N, P, D, T, A) are only legal in the incident and outgoing slots of a reaction string; targets and residuals are always nuclides. get_exfor_particle_symbol ignored the slot, so querying with a proton, deuteron, triton or alpha target sent target='P' etc. to x4i3, whose index only has 'H-1', 'H-2', 'H-3', 'HE-4' -- every such query came back empty (#17). Split it in two: - get_exfor_nuclide_symbol: Sym-A, for target and residual; raises on Z=0. - get_exfor_particle_symbol: light-particle code, else Z-Sym-A, for projectile and product. The projectile slot had the mirror-image bug: the x4i3 index spells 3He as HE3 and heavy ions as Z-SYM-A (6-C-12), so 3He and heavy-ion projectiles also returned nothing. HE3 is added to the particle codes, which is only safe now that 3He targets go through the nuclide function. Tests pin entries for n+p, p+p, d+d, a+4He, p+3He, p+4He, 3He+58Ni and 12C+12C against x4i3_X4-2023-04-29, and check that heavy-target queries still return the entries they did before. Fixes #17 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A0192, A1003 and A1146 carry both DATA-ERR and ERR-1, which exfor_tools correctly refuses to attribute on its own. Pass the attribution read from each entry's ERR-ANALYSIS so every query case also checks parsing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #17.
Problem
get_exfor_particle_symbolspelled every nucleus the same way regardless of where it sits in the reaction string. EXFOR's light-particle codes (N,P,D,T,A) are only legal in the incident and outgoing slots (SF2/SF3); targets and residuals (SF1/SF4) are always nuclides. So a proton target was sent to x4i3 astarget='P', but the index only knowsH-1— and the same for d, t and α targets. Every such query came back empty.The projectile slot had the mirror-image problem: the x4i3 index spells ³He as
HE3and heavy ions asZ-SYM-A(e.g.6-C-12), whereas we sentHe-3/C-12, so ³He and heavy-ion projectiles (and ³He / heavy ejectiles in thereaction=string) also matched nothing.Fix
Split the function by slot:
get_exfor_nuclide_symbol(A, Z)→Sym-A(H-1,He-4,Fe-0), for target and residual. Raises on Z=0: a neutron is never a target or residual, andN-1would read as nitrogen.get_exfor_particle_symbol(A, Z)→N/P/D/T/HE3/A, elseZ-Sym-A, for projectile and product.Adding
HE3to the particle codes is only safe because ³He targets now go through the nuclide function.is_matchand parsing are untouched: they compare (A, Z) tuples, and work unchanged once the query returns the right entries.reaction_stringchanges for light targets and heavy-ion projectiles, e.g.P(N,el)→H-1(N,el)andC-12(C-12,el)→C-12(6-C-12,el). Anything keyed on that string will shift, but those reactions returned no data before.Tests
tests/test_light_nuclides.py:reaction_stringfor light targets and a ³He projectile.10036), p+p (A0192), d+d (A1003), α+⁴He (A1146), p+³He (A1022), p+⁴He (A0925), ³He+⁵⁸Ni (C1976) and ¹²C+¹²C (A0842). These assert membership, not counts, so they survive database updates. A0192, A1003 and A1146 carry bothDATA-ERRandERR-1, so their error attribution is passed explicitly, read from each entry's ERR-ANALYSIS.dXS/dA,dXS/dRuthandAy, and they are identical.All 35 tests pass.
Generated by Claude Code