From 8c72e4b7b0b8ecbb05ff085e8c859575dd764a00 Mon Sep 17 00:00:00 2001 From: shimwell Date: Mon, 8 Aug 2022 22:57:32 +0100 Subject: [PATCH] added lethargy_bin_width test --- tests/unit_tests/test_filters.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/unit_tests/test_filters.py b/tests/unit_tests/test_filters.py index 6b344b827e..f50a57fa59 100644 --- a/tests/unit_tests/test_filters.py +++ b/tests/unit_tests/test_filters.py @@ -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])