added lethargy_bin_width test

This commit is contained in:
shimwell 2022-08-08 22:57:32 +01:00
parent 7ba45aaa35
commit 8c72e4b7b0

View file

@ -1,3 +1,4 @@
import math
import numpy as np
import openmc
from pytest import fixture, approx
@ -241,8 +242,14 @@ def test_first_moment(run_in_tmpdir, box_model):
assert first_score(sph_flux_tally) == approx(flux)
assert first_score(zernike_tally) == approx(scatter)
def test_energy():
f = openmc.EnergyFilter.from_group_structure('CCFE-709')
assert f.bins.shape == (709, 2)
assert len(f.values) == 710
def test_lethargy_bin_width():
f = openmc.EnergyFilter.from_group_structure('VITAMIN-J-175')
assert len(f.lethargy_bin_width) == 175
energy_bins = openmc.mgxs.GROUP_STRUCTURES['VITAMIN-J-175']
assert f.lethargy_bin_width[0] == math.log10(energy_bins[1]/energy_bins[0])
assert f.lethargy_bin_width[-1] == math.log10(energy_bins[-1]/energy_bins[-2])