From d88648634e0d9f84ab2642fc77ee20053ef33f65 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 29 Jul 2022 23:49:58 -0500 Subject: [PATCH] Adding check for round-trip of spec for eff --- .../regression_tests/filter_energyfun/test.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/regression_tests/filter_energyfun/test.py b/tests/regression_tests/filter_energyfun/test.py index ba5a9b16fd..b5ab1387cc 100644 --- a/tests/regression_tests/filter_energyfun/test.py +++ b/tests/regression_tests/filter_energyfun/test.py @@ -61,6 +61,24 @@ class FilterEnergyFunHarness(PyAPITestHarness): # Output the tally in a Pandas DataFrame. return br_tally.get_pandas_dataframe().to_string() + '\n' + def _compare_results(self): + super()._compare_results() + + # Read the statepoint file. + sp = openmc.StatePoint(self._sp_name) + + # check that values are round-tripped correctly from + # the statepoint file + sp_tally = sp.get_tally(id=2) + sp_filt = sp_tally.find_filter(openmc.EnergyFunctionFilter) + + model_tally = self._model.tallies[1] + model_filt = model_tally.find_filter(openmc.EnergyFunctionFilter) + + assert sp_filt.interpolation == model_filt.interpolation + assert all(sp_filt.energy == model_filt.energy) + assert all(sp_filt.y == model_filt.y) + def test_filter_energyfun(model): harness = FilterEnergyFunHarness('statepoint.5.h5', model)