OpenMC/tests/regression_tests/entropy/test.py

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
842 B
Python
Raw Permalink Normal View History

2015-09-14 21:42:25 -04:00
import glob
import os
from openmc import StatePoint
from tests.testing_harness import TestHarness
class EntropyTestHarness(TestHarness):
def _get_results(self):
2015-06-28 00:06:33 -06:00
"""Digest info in the statepoint and return as a string."""
# Read the statepoint file.
statepoint = glob.glob(os.path.join(os.getcwd(), self._sp_name))[0]
with StatePoint(statepoint) as sp:
# Write out k-combined.
outstr = 'k-combined:\n'
outstr += '{:12.6E} {:12.6E}\n'.format(sp.keff.n, sp.keff.s)
# Write out entropy data.
outstr += 'entropy:\n'
results = ['{:12.6E}'.format(x) for x in sp.entropy]
outstr += '\n'.join(results) + '\n'
2015-06-28 00:06:33 -06:00
return outstr
def test_entropy():
harness = EntropyTestHarness('statepoint.10.h5')
harness.main()