Explore the structure of OpenMC neutron HDF5 files, inspect groups and attributes, extract temperatures, and compare temperature availability across nuclear-data libraries.
Revisit HDF5 and extract temperatures
├── 1. Inspect HDF5 structure
├── 2. Inspect attributes
└── 3. Get metadataimport h5py
import pandas as pd
from openmc_workbench_config import DATA_ROOT
df = pd.read_feather('0_2_catalog_nuclear_data_libraries_df.feather')
dfLoading...
1. Inspect HDF5 structure¶
def get_name_types(filename):
with h5py.File(DATA_ROOT / filename) as ff:
nuclide_name = list(ff.keys())[0]
nuclide = ff[nuclide_name]
return {
(name, type(obj).__name__)
for name, obj in nuclide.items()
}
name_types = set()
for filename in df['path'].unique():
name_types.update(get_name_types(filename))
name_types{('energy', 'Group'),
('fission_energy_release', 'Group'),
('kTs', 'Group'),
('reactions', 'Group'),
('total_nu', 'Group'),
('urr', 'Group')}| Group name | Definition |
|---|---|
kTs | Temperatures expressed as , in eV |
energy | Incident neutron energy grids at different temperatures |
reactions | Nuclear reaction data, organized by MT number |
urr | Unresolved resonance probability tables, if available |
total_nu | Total number of neutrons per fission, when present |
fission_energy_release | Fission energy release components, when present |
source:
2. Inspect attributes¶
def get_attrs(filename):
with h5py.File(DATA_ROOT / filename) as ff:
nuclide = next(iter(ff.values()))
return set(nuclide.attrs)
attrs = set()
for filename in df['path'].unique():
attrs.update(get_attrs(filename))
attrs{'A', 'Z', 'atomic_weight_ratio', 'metastable'}3. Get metadata¶
def get_temperatures(filename):
with h5py.File(DATA_ROOT / filename) as ff:
nuclide = next(iter(ff.values()))
temperatures = sorted(
nuclide['kTs'],
key=lambda t: int(t.removesuffix('K')),
)
return temperatures
# Read each unique HDF5 file only once, then map the results
# back to every row of the catalog.
paths = df['path'].drop_duplicates()
temperatures = paths.map(get_temperatures)
path2temperature = dict(zip(paths, temperatures))
df['temperatures'] = df['path'].map(path2temperature)
dfLoading...
All nuclear-data libraries in our collection provide cross sections at six temperatures: 250, 294, 600, 900, 1200, and 2500 K.
The exception is FENDL-3.2c, which provides data only at 294 K.
This is because the distributed FENDL-3.2c ACE files were processed at 293.6 K (rounded to 294 K by OpenMC). Additional temperatures would require Doppler broadening.
df['temperatures'].map(tuple).unique()array([('250K', '294K', '600K', '900K', '1200K', '2500K'), ('294K',)],
dtype=object)reference_temperatures = set(df['temperatures'].iloc[0])
different = df['temperatures'].map(
lambda temperatures: set(temperatures) != reference_temperatures,
)
df.loc[different, 'library'].unique()<ArrowStringArray>
['fendl-3.2c']
Length: 1, dtype: str