OpenMC/tests/regression_tests/sourcepoint_batch/test.py

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

32 lines
929 B
Python
Raw Permalink Normal View History

2015-09-14 21:42:25 -04:00
import glob
from openmc import StatePoint
2014-03-11 18:59:37 -04:00
from tests.testing_harness import TestHarness
2014-03-11 18:59:37 -04:00
class SourcepointTestHarness(TestHarness):
def _test_output_created(self):
"""Make sure statepoint files have been created."""
statepoint = glob.glob('statepoint.*.h5')
assert len(statepoint) == 5, 'Five statepoint files must exist.'
def _get_results(self):
2015-06-28 00:06:33 -06:00
"""Digest info in the statepoint and return as a string."""
# Get the eigenvalue information.
outstr = TestHarness._get_results(self)
# Read the statepoint file.
with StatePoint(self._sp_name) as sp:
# Add the source information.
xyz = sp.source[0]['r']
outstr += ' '.join(['{0:12.6E}'.format(x) for x in xyz])
outstr += "\n"
2015-06-28 00:06:33 -06:00
return outstr
def test_sourcepoint_batch():
harness = SourcepointTestHarness('statepoint.08.h5')
harness.main()