making use of endf.get_evaluations (#3819)

Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
Jonathan Shimwell 2026-02-26 04:14:44 +01:00 committed by GitHub
parent 3ba8a9f078
commit 6050c789ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 30 deletions

View file

@ -12,7 +12,7 @@ import re
from .data import gnds_name
from .function import Tabulated1D
from endf.material import _LIBRARY, _SUBLIBRARY
from endf.material import _LIBRARY, _SUBLIBRARY, get_materials as get_evaluations
from endf.incident_neutron import SUM_RULES
from endf.records import (
float_endf,
@ -39,32 +39,6 @@ def get_tab1_record(file_obj):
return params, Tabulated1D(tab.x, tab.y, tab.breakpoints, tab.interpolation)
def get_evaluations(filename):
"""Return a list of all evaluations within an ENDF file.
Parameters
----------
filename : str
Path to ENDF-6 formatted file
Returns
-------
list
A list of :class:`openmc.data.endf.Evaluation` instances.
"""
evaluations = []
with open(str(filename), 'r') as fh:
while True:
pos = fh.tell()
line = fh.readline()
if line[66:70] == ' -1':
break
fh.seek(pos)
evaluations.append(Evaluation(fh))
return evaluations
class Evaluation:
"""ENDF material evaluation with multiple files/sections

View file

@ -805,9 +805,7 @@ class IncidentNeutron(EqualityMixin):
# Helper function to get a cross section from an ENDF file on a
# given energy grid
def get_file3_xs(ev, mt, E):
file_obj = StringIO(ev.section[3, mt])
get_head_record(file_obj)
_, xs = get_tab1_record(file_obj)
xs = ev.section_data[3, mt]['sigma']
return xs(E)
heating_local = Reaction(901)