endf-python
endf-python copied to clipboard
KeyError when accessing `section_text` for certain sections
Description
I encountered a KeyError
while trying to access specific sections of an ENDF material. Below is a summary of the issue:
Steps to Reproduce:
-
Load a material using
endf.Material()
, for example:import endf mat = endf.Material('n-092_U_235.endf')
-
The following warnings appear:
/path/to/venv/lib/python3.12/site-packages/endf/material.py:228: UserWarning: MF=31, MT=452 ignored warn(f"{MF=}, {MT=} ignored") /path/to/venv/lib/python3.12/site-packages/endf/material.py:228: UserWarning: MF=31, MT=456 ignored warn(f"{MF=}, {MT=} ignored") /path/to/venv/lib/python3.12/site-packages/endf/material.py:228: UserWarning: MF=35, MT=18 ignored warn(f"{MF=}, {MT=} ignored")
-
Attempt to access a specific section:
print(mat.section_text[12, 75])
This raises the following error:
KeyError: (12, 75)
-
Attempting to access other sections like:
mat.section_data[3, 16]
works as expected and returns data.
Expected Behavior:
mat.section_text[12, 75]
should return the corresponding section data, or provide a clearer error if this section is not available.
Actual Behavior:
A KeyError
is raised when trying to access section_text
for certain sections.
System Information:
- Python version: 3.12
- endf version: 0.1.4 through pip
- ENDF file used:
n-092_U_235.endf
Additional Context:
The warnings related to MF=31 and MF=35 might be linked to the issue, but it's unclear if this is the cause.