Repository navigation
Conversation
* NC-type sub-subsections with LTY=0 were appended to
'nc_subsections' twice (once inside the LTY=0 branch and again after
the if/else).
* For NI-type sub-subsections with LB=0-4, the list was split into the
{Ek,Fk} and {El,Fl} tables at NT - NP = NP values. Per ENDF-102
Section 33.2.2.2, NP is the total number of pairs, NT = 2*NP, and LT
is the number of pairs in the second table, so the first table holds
NP - LT pairs, i.e. 2*(NP - LT) values. With LT=0 (always the case for
LB=0, 1, 2) half of the Ek-table ended up in the El-table.
Add regression tests built from a hand-written MF=33 section.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
This PR fixes two problems in
parse_mf33_subsection(src/endf/mf33.py). The function is also used byparse_mf40, so both bugs affect MF=33 and MF=40.1. LTY=0 NC-type sub-subsections are appended twice
The
LTY == 0branch appendssubsubtosubsection['nc_subsections'], and the unconditional append after theif/elseadds it a second time. As a result,len(subsection['nc_subsections'])can exceedNC. This PR removes the append inside the branch.2. LB=0-4 tables are split at the wrong index
ENDF-102 (BNL-224854-2023-INRE), Section 33.2.2.2, gives the record layout for LB=0 to 4:
The manual defines these quantities:
NPis the total number of pairs in the arrays {Ek,Fk}{El,Fl}.NTis the total number of values in the LIST record, soNT = 2*NP.LTis the number of pairs in the second array {El,Fl}. IfLT = 0, the table contains only {Ek,Fk}; otherwise {Ek,Fk} hasNP - LTpairs.The {Ek,Fk} table is therefore
values[:2*(NP - LT)]. The current code slices atNT - NP, which equalsNPvalues, or onlyNP/2pairs. WhenLT = 0, which always holds for LB=0, 1 and 2, the second half of the Ek-table ends up inEl/Fl. WhenLT > 0, the split is correct only by coincidence, whenNP = 2*LT.Tests
The new file
tests/test_mf33.pybuilds a small MF=33 section by hand. It contains:The tests check that each NC sub-subsection appears exactly once, with the right contents, and that every pair lands in the correct E-table. Both tests fail on
mainand pass with this change. The full suite passes:python -m pytest -ra testsreports 26 passed.🤖 Generated with Claude Code