From 6050c789cab4e074c2c4bf9e1120d3ce97ebe4fc Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Thu, 26 Feb 2026 04:14:44 +0100 Subject: [PATCH] making use of endf.get_evaluations (#3819) Co-authored-by: Paul Romano --- openmc/data/endf.py | 28 +--------------------------- openmc/data/neutron.py | 4 +--- 2 files changed, 2 insertions(+), 30 deletions(-) diff --git a/openmc/data/endf.py b/openmc/data/endf.py index e163ad4c2..c50431dc7 100644 --- a/openmc/data/endf.py +++ b/openmc/data/endf.py @@ -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 diff --git a/openmc/data/neutron.py b/openmc/data/neutron.py index 71927cbed..492cdd7f3 100644 --- a/openmc/data/neutron.py +++ b/openmc/data/neutron.py @@ -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)