mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Merge pull request #204 from mit-crpg/tests
Updated test suite to compare results
This commit is contained in:
commit
643d793ed3
191 changed files with 225810 additions and 92 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -24,3 +24,6 @@ src/xml-fortran/xmlreader
|
|||
|
||||
# Modules built from XML templates
|
||||
src/templates/*.f90
|
||||
|
||||
# Test results error file
|
||||
results_error.dat
|
||||
72
src/utils/particle_restart.py
Normal file
72
src/utils/particle_restart.py
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
#!/usr/bin/env python2
|
||||
|
||||
import struct
|
||||
|
||||
class Particle(object):
|
||||
def __init__(self, filename):
|
||||
if filename.endswith('.h5'):
|
||||
import h5py
|
||||
self._f = h5py.File(filename, 'r')
|
||||
self._hdf5 = True
|
||||
else:
|
||||
self._f = open(filename, 'rb')
|
||||
self._hdf5 = False
|
||||
|
||||
# Read all metadata
|
||||
self._read_data()
|
||||
|
||||
def _read_data(self):
|
||||
# Read filetype
|
||||
self.filetype = self._get_int(path='filetype')[0]
|
||||
|
||||
# Read statepoint revision
|
||||
self.revision = self._get_int(path='revision')[0]
|
||||
|
||||
# Read current batch
|
||||
self.current_batch = self._get_int(path='current_batch')[0]
|
||||
|
||||
# Read run information
|
||||
self.gen_per_batch = self._get_int(path='gen_per_batch')[0]
|
||||
self.current_gen = self._get_int(path='current_gen')[0]
|
||||
self.n_particles = self._get_long(path='n_particles')[0]
|
||||
|
||||
# Read particle properties
|
||||
self.id = self._get_long(path='id')[0]
|
||||
self.weight = self._get_double(path='weight')[0]
|
||||
self.energy = self._get_double(path='energy')[0]
|
||||
self.xyz = self._get_double(3, path='xyz')
|
||||
self.uvw = self._get_double(3, path='uvw')
|
||||
|
||||
def _get_data(self, n, typeCode, size):
|
||||
return list(struct.unpack('={0}{1}'.format(n,typeCode),
|
||||
self._f.read(n*size)))
|
||||
|
||||
def _get_int(self, n=1, path=None):
|
||||
if self._hdf5:
|
||||
return [int(v) for v in self._f[path].value]
|
||||
else:
|
||||
return [int(v) for v in self._get_data(n, 'i', 4)]
|
||||
|
||||
def _get_long(self, n=1, path=None):
|
||||
if self._hdf5:
|
||||
return [long(v) for v in self._f[path].value]
|
||||
else:
|
||||
return [long(v) for v in self._get_data(n, 'q', 8)]
|
||||
|
||||
def _get_float(self, n=1, path=None):
|
||||
if self._hdf5:
|
||||
return [float(v) for v in self._f[path].value]
|
||||
else:
|
||||
return [float(v) for v in self._get_data(n, 'f', 4)]
|
||||
|
||||
def _get_double(self, n=1, path=None):
|
||||
if self._hdf5:
|
||||
return [float(v) for v in self._f[path].value]
|
||||
else:
|
||||
return [float(v) for v in self._get_data(n, 'd', 8)]
|
||||
|
||||
def _get_string(self, n=1, path=None):
|
||||
if self._hdf5:
|
||||
return str(self._f[path].value)
|
||||
else:
|
||||
return str(self._get_data(n, 's', 1)[0])
|
||||
22
tests/test_basic/results.py
Normal file
22
tests/test_basic/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_basic/results_true.dat
Normal file
2
tests/test_basic/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
0.30078030 0.00343315
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -18,8 +19,15 @@ def test_run():
|
|||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
34
tests/test_confidence_intervals/results.py
Normal file
34
tests/test_confidence_intervals/results.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
results = sp.tallies[0].results
|
||||
shape = results.shape
|
||||
size = (np.product(shape))
|
||||
results = np.reshape(results, size)
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write out tally results
|
||||
outstr += 'tallies:\n'
|
||||
for item in results:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
5
tests/test_confidence_intervals/results_true.dat
Normal file
5
tests/test_confidence_intervals/results_true.dat
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
k-combined:
|
||||
0.29618376 0.01254762
|
||||
tallies:
|
||||
63.10626773
|
||||
503.50685224
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -21,8 +22,16 @@ def test_created_statepoint():
|
|||
def test_created_output():
|
||||
assert os.path.exists(pwd + '/tallies.out')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
|
||||
pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_density_atombcm/results.py
Normal file
22
tests/test_density_atombcm/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_density_atombcm/results_true.dat
Normal file
2
tests/test_density_atombcm/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
1.73665099 0.01507851
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_density_atomcm3/results.py
Normal file
22
tests/test_density_atomcm3/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_density_atomcm3/results_true.dat
Normal file
2
tests/test_density_atomcm3/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
1.08199949 0.01359101
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_density_kgm3/results.py
Normal file
22
tests/test_density_kgm3/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_density_kgm3/results_true.dat
Normal file
2
tests/test_density_kgm3/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
0.81819931 0.00497052
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_density_sum/results.py
Normal file
22
tests/test_density_sum/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_density_sum/results_true.dat
Normal file
2
tests/test_density_sum/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
0.32042881 0.00165656
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -18,8 +19,15 @@ def test_run():
|
|||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_eigenvalue_genperbatch/results.py
Normal file
22
tests/test_eigenvalue_genperbatch/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.7.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_eigenvalue_genperbatch/results_true.dat
Normal file
2
tests/test_eigenvalue_genperbatch/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
0.29182788 0.00487636
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -18,8 +19,15 @@ def test_run():
|
|||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.7.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.7.binary']
|
||||
output = [pwd + '/statepoint.7.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_eigenvalue_no_inactive/results.py
Normal file
22
tests/test_eigenvalue_no_inactive/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_eigenvalue_no_inactive/results_true.dat
Normal file
2
tests/test_eigenvalue_no_inactive/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
0.30737879 0.00683022
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -18,8 +19,15 @@ def test_run():
|
|||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_energy_grid/results.py
Normal file
22
tests/test_energy_grid/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_energy_grid/results_true.dat
Normal file
2
tests/test_energy_grid/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
0.31693311 0.00336656
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
28
tests/test_entropy/results.py
Normal file
28
tests/test_entropy/results.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write out tally results
|
||||
outstr += 'entropy:\n'
|
||||
for item in sp.entropy:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
13
tests/test_entropy/results_true.dat
Normal file
13
tests/test_entropy/results_true.dat
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
k-combined:
|
||||
0.30078030 0.00343315
|
||||
entropy:
|
||||
6.42970620
|
||||
6.39285931
|
||||
6.64491815
|
||||
6.58470936
|
||||
6.53553278
|
||||
6.67552398
|
||||
6.69709001
|
||||
6.71408313
|
||||
6.55064371
|
||||
6.52434363
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -18,8 +19,15 @@ def test_run():
|
|||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
34
tests/test_filter_cell/results.py
Normal file
34
tests/test_filter_cell/results.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
results = sp.tallies[0].results
|
||||
shape = results.shape
|
||||
size = (np.product(shape))
|
||||
results = np.reshape(results, size)
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write out tally results
|
||||
outstr += 'tallies:\n'
|
||||
for item in results:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
11
tests/test_filter_cell/results_true.dat
Normal file
11
tests/test_filter_cell/results_true.dat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
k-combined:
|
||||
1.63626998 0.13749537
|
||||
tallies:
|
||||
0.00000000
|
||||
0.00000000
|
||||
14.61025046
|
||||
42.83560866
|
||||
3.02756209
|
||||
1.85367509
|
||||
43.03081152
|
||||
373.87004631
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -21,8 +22,16 @@ def test_statepoint_exists():
|
|||
def test_output_exists():
|
||||
assert os.path.exists(pwd + '/tallies.out')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
|
||||
pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
34
tests/test_filter_cellborn/results.py
Normal file
34
tests/test_filter_cellborn/results.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
results = sp.tallies[0].results
|
||||
shape = results.shape
|
||||
size = (np.product(shape))
|
||||
results = np.reshape(results, size)
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write out tally results
|
||||
outstr += 'tallies:\n'
|
||||
for item in results:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
11
tests/test_filter_cellborn/results_true.dat
Normal file
11
tests/test_filter_cellborn/results_true.dat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
k-combined:
|
||||
1.63626998 0.13749537
|
||||
tallies:
|
||||
0.00000000
|
||||
0.00000000
|
||||
70.51534006
|
||||
1005.98848688
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -21,8 +22,16 @@ def test_statepoint_exists():
|
|||
def test_output_exists():
|
||||
assert os.path.exists(pwd + '/tallies.out')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
|
||||
pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
34
tests/test_filter_energy/results.py
Normal file
34
tests/test_filter_energy/results.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
results = sp.tallies[0].results
|
||||
shape = results.shape
|
||||
size = (np.product(shape))
|
||||
results = np.reshape(results, size)
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write out tally results
|
||||
outstr += 'tallies:\n'
|
||||
for item in results:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
11
tests/test_filter_energy/results_true.dat
Normal file
11
tests/test_filter_energy/results_true.dat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
k-combined:
|
||||
1.63626998 0.13749537
|
||||
tallies:
|
||||
25.74196069
|
||||
133.03240675
|
||||
43.64898460
|
||||
381.13934139
|
||||
49.33108948
|
||||
487.94654213
|
||||
10.19385040
|
||||
21.01729435
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -21,8 +22,16 @@ def test_statepoint_exists():
|
|||
def test_output_exists():
|
||||
assert os.path.exists(pwd + '/tallies.out')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
|
||||
pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
34
tests/test_filter_energyout/results.py
Normal file
34
tests/test_filter_energyout/results.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
results = sp.tallies[0].results
|
||||
shape = results.shape
|
||||
size = (np.product(shape))
|
||||
results = np.reshape(results, size)
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write out tally results
|
||||
outstr += 'tallies:\n'
|
||||
for item in results:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
11
tests/test_filter_energyout/results_true.dat
Normal file
11
tests/test_filter_energyout/results_true.dat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
k-combined:
|
||||
1.63626998 0.13749537
|
||||
tallies:
|
||||
25.70000000
|
||||
132.50500000
|
||||
43.69000000
|
||||
382.00870000
|
||||
50.51000000
|
||||
511.00830000
|
||||
7.29000000
|
||||
10.77570000
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -21,8 +22,16 @@ def test_statepoint_exists():
|
|||
def test_output_exists():
|
||||
assert os.path.exists(pwd + '/tallies.out')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
|
||||
pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
34
tests/test_filter_group_transfer/results.py
Normal file
34
tests/test_filter_group_transfer/results.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
results = sp.tallies[0].results
|
||||
shape = results.shape
|
||||
size = (np.product(shape))
|
||||
results = np.reshape(results, size)
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write out tally results
|
||||
outstr += 'tallies:\n'
|
||||
for item in results:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
67
tests/test_filter_group_transfer/results_true.dat
Normal file
67
tests/test_filter_group_transfer/results_true.dat
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
k-combined:
|
||||
1.63626998 0.13749537
|
||||
tallies:
|
||||
23.25000000
|
||||
108.58030000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.04000000
|
||||
0.00060000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.90510047
|
||||
0.18059702
|
||||
0.00000000
|
||||
0.00000000
|
||||
1.98972892
|
||||
0.82131425
|
||||
2.44000000
|
||||
1.20220000
|
||||
0.00000000
|
||||
0.00000000
|
||||
39.14000000
|
||||
306.60460000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.40588342
|
||||
0.03640636
|
||||
0.00000000
|
||||
0.00000000
|
||||
1.09242018
|
||||
0.25050799
|
||||
0.01000000
|
||||
0.00010000
|
||||
0.00000000
|
||||
0.00000000
|
||||
4.51000000
|
||||
4.06950000
|
||||
0.00000000
|
||||
0.00000000
|
||||
47.16000000
|
||||
445.44060000
|
||||
0.06122379
|
||||
0.00151503
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.15018808
|
||||
0.00921578
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
3.35000000
|
||||
2.25490000
|
||||
0.14107661
|
||||
0.00423825
|
||||
7.29000000
|
||||
10.77570000
|
||||
0.47841947
|
||||
0.05293898
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -21,8 +22,16 @@ def test_statepoint_exists():
|
|||
def test_output_exists():
|
||||
assert os.path.exists(pwd + '/tallies.out')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
|
||||
pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
34
tests/test_filter_material/results.py
Normal file
34
tests/test_filter_material/results.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
results = sp.tallies[0].results
|
||||
shape = results.shape
|
||||
size = (np.product(shape))
|
||||
results = np.reshape(results, size)
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write out tally results
|
||||
outstr += 'tallies:\n'
|
||||
for item in results:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
11
tests/test_filter_material/results_true.dat
Normal file
11
tests/test_filter_material/results_true.dat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
k-combined:
|
||||
1.63626998 0.13749537
|
||||
tallies:
|
||||
27.90283654
|
||||
156.04281895
|
||||
6.49484348
|
||||
8.44894829
|
||||
51.28129429
|
||||
530.26885468
|
||||
41.25744302
|
||||
345.89946671
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -21,8 +22,16 @@ def test_statepoint_exists():
|
|||
def test_output_exists():
|
||||
assert os.path.exists(pwd + '/tallies.out')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
|
||||
pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
34
tests/test_filter_mesh_2d/results.py
Normal file
34
tests/test_filter_mesh_2d/results.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
results = sp.tallies[0].results
|
||||
shape = results.shape
|
||||
size = (np.product(shape))
|
||||
results = np.reshape(results, size)
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write out tally results
|
||||
outstr += 'tallies:\n'
|
||||
for item in results:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
581
tests/test_filter_mesh_2d/results_true.dat
Normal file
581
tests/test_filter_mesh_2d/results_true.dat
Normal file
|
|
@ -0,0 +1,581 @@
|
|||
k-combined:
|
||||
1.63626998 0.13749537
|
||||
tallies:
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.74472191
|
||||
0.48415133
|
||||
1.07230723
|
||||
0.63947485
|
||||
0.01468382
|
||||
0.00021561
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.69375275
|
||||
0.27938164
|
||||
0.03732162
|
||||
0.00139290
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.09463872
|
||||
0.00895649
|
||||
0.37654782
|
||||
0.10977332
|
||||
0.18150317
|
||||
0.03294340
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.86806631
|
||||
0.40595616
|
||||
0.11621475
|
||||
0.01350587
|
||||
0.00155887
|
||||
0.00000243
|
||||
0.35916061
|
||||
0.12899634
|
||||
0.09416182
|
||||
0.00886645
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.12565322
|
||||
0.01578873
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.51743466
|
||||
0.08773882
|
||||
2.23251355
|
||||
1.30172211
|
||||
1.48995876
|
||||
0.76671676
|
||||
0.21954538
|
||||
0.04820018
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
2.84411701
|
||||
2.10746075
|
||||
1.73928674
|
||||
0.75261879
|
||||
0.35109881
|
||||
0.06875410
|
||||
0.33100566
|
||||
0.06581549
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.20203442
|
||||
0.04081791
|
||||
2.14589720
|
||||
1.30673604
|
||||
1.04409600
|
||||
0.55136268
|
||||
0.15536029
|
||||
0.02413682
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00513180
|
||||
0.00002634
|
||||
0.07855383
|
||||
0.00617070
|
||||
0.03875096
|
||||
0.00150164
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00780257
|
||||
0.00006088
|
||||
1.00575506
|
||||
0.22150470
|
||||
0.60010441
|
||||
0.10130221
|
||||
0.01309371
|
||||
0.00017145
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.37908147
|
||||
0.14370276
|
||||
1.79568135
|
||||
0.97362404
|
||||
0.52713813
|
||||
0.15711720
|
||||
2.01208278
|
||||
1.44662466
|
||||
0.51864206
|
||||
0.12992534
|
||||
0.09434319
|
||||
0.00810502
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.10419829
|
||||
0.01085728
|
||||
0.54172701
|
||||
0.26622227
|
||||
2.42479802
|
||||
1.71667857
|
||||
0.27493570
|
||||
0.02825591
|
||||
0.51225326
|
||||
0.09119064
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.09358292
|
||||
0.00875776
|
||||
2.05048252
|
||||
0.97499136
|
||||
0.77723197
|
||||
0.20948225
|
||||
3.64937855
|
||||
3.37346600
|
||||
2.10034559
|
||||
1.14562791
|
||||
2.15067765
|
||||
1.17838886
|
||||
0.10058305
|
||||
0.00509728
|
||||
1.11245884
|
||||
0.39389784
|
||||
0.05371565
|
||||
0.00288537
|
||||
2.72011298
|
||||
1.79114629
|
||||
2.80563673
|
||||
3.20603706
|
||||
1.56560089
|
||||
1.03725516
|
||||
0.00000000
|
||||
0.00000000
|
||||
1.42467052
|
||||
1.01691768
|
||||
0.02534426
|
||||
0.00064233
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.10967184
|
||||
0.01202791
|
||||
0.16773827
|
||||
0.01894693
|
||||
1.91479726
|
||||
0.78757483
|
||||
2.41935507
|
||||
1.29538357
|
||||
0.36430513
|
||||
0.07349228
|
||||
1.40713814
|
||||
0.61086928
|
||||
4.54764589
|
||||
4.35761936
|
||||
1.83828726
|
||||
0.85551667
|
||||
3.08761795
|
||||
2.73522382
|
||||
1.57971747
|
||||
0.70597082
|
||||
0.96473671
|
||||
0.52496554
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.16158527
|
||||
0.02610980
|
||||
0.72141422
|
||||
0.17801309
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.23549827
|
||||
0.05545943
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.05554385
|
||||
0.00205221
|
||||
0.69435360
|
||||
0.18927613
|
||||
0.58611724
|
||||
0.10989826
|
||||
1.60379118
|
||||
0.80637857
|
||||
4.65562049
|
||||
4.63027782
|
||||
0.60478168
|
||||
0.14355354
|
||||
0.15101575
|
||||
0.01467227
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.46360700
|
||||
0.10779299
|
||||
1.10169619
|
||||
0.63759013
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.43827225
|
||||
0.10338742
|
||||
0.54484882
|
||||
0.29686024
|
||||
0.15425169
|
||||
0.01266291
|
||||
1.26762031
|
||||
0.44060322
|
||||
2.09024150
|
||||
0.94471998
|
||||
1.13935875
|
||||
0.35699140
|
||||
0.68636832
|
||||
0.34703673
|
||||
0.30149553
|
||||
0.09089955
|
||||
0.02907163
|
||||
0.00084516
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.98220821
|
||||
0.37392273
|
||||
0.37748063
|
||||
0.05413146
|
||||
0.04691481
|
||||
0.00220100
|
||||
0.82835415
|
||||
0.28793825
|
||||
2.81424519
|
||||
1.70212902
|
||||
3.95394912
|
||||
4.40509457
|
||||
1.30726660
|
||||
0.81132828
|
||||
0.04413060
|
||||
0.00194751
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.13853735
|
||||
0.01919260
|
||||
0.16517048
|
||||
0.02728129
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
1.45408713
|
||||
0.70652243
|
||||
1.72907180
|
||||
0.78497986
|
||||
0.64459053
|
||||
0.09719184
|
||||
3.31664285
|
||||
3.11297340
|
||||
2.68352188
|
||||
2.15648607
|
||||
0.73300980
|
||||
0.21098135
|
||||
0.10557112
|
||||
0.01114526
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.04819227
|
||||
0.00232249
|
||||
3.78428408
|
||||
3.03646716
|
||||
0.72513650
|
||||
0.20773606
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.74369161
|
||||
0.19301837
|
||||
3.05242967
|
||||
2.33710198
|
||||
0.78556672
|
||||
0.22606852
|
||||
0.35911920
|
||||
0.04642426
|
||||
1.20587602
|
||||
0.65712804
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
2.01675496
|
||||
1.11467055
|
||||
0.30880200
|
||||
0.09518932
|
||||
0.04423921
|
||||
0.00195711
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.58068425
|
||||
0.12617857
|
||||
0.76146083
|
||||
0.36729056
|
||||
0.06851630
|
||||
0.00469448
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.03752577
|
||||
0.00140818
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
1.97392057
|
||||
3.89636241
|
||||
2.22472504
|
||||
2.25625720
|
||||
2.71251096
|
||||
1.57130187
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.25824375
|
||||
0.06668984
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
0.00000000
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -21,8 +22,16 @@ def test_statepoint_exists():
|
|||
def test_output_exists():
|
||||
assert os.path.exists(pwd + '/tallies.out')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
|
||||
pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
34
tests/test_filter_mesh_3d/results.py
Normal file
34
tests/test_filter_mesh_3d/results.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
results = sp.tallies[0].results
|
||||
shape = results.shape
|
||||
size = (np.product(shape))
|
||||
results = np.reshape(results, size)
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write out tally results
|
||||
outstr += 'tallies:\n'
|
||||
for item in results:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
9829
tests/test_filter_mesh_3d/results_true.dat
Normal file
9829
tests/test_filter_mesh_3d/results_true.dat
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -21,8 +22,16 @@ def test_statepoint_exists():
|
|||
def test_output_exists():
|
||||
assert os.path.exists(pwd + '/tallies.out')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
|
||||
pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
34
tests/test_filter_universe/results.py
Normal file
34
tests/test_filter_universe/results.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
results = sp.tallies[0].results
|
||||
shape = results.shape
|
||||
size = (np.product(shape))
|
||||
results = np.reshape(results, size)
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write out tally results
|
||||
outstr += 'tallies:\n'
|
||||
for item in results:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
11
tests/test_filter_universe/results_true.dat
Normal file
11
tests/test_filter_universe/results_true.dat
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
k-combined:
|
||||
1.63626998 0.13749537
|
||||
tallies:
|
||||
58.88788583
|
||||
698.82477708
|
||||
7.36606228
|
||||
11.28273141
|
||||
48.41813539
|
||||
477.46899859
|
||||
5.65702668
|
||||
6.56676259
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -21,8 +22,16 @@ def test_statepoint_exists():
|
|||
def test_output_exists():
|
||||
assert os.path.exists(pwd + '/tallies.out')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
|
||||
pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
30
tests/test_fixed_source/results.py
Normal file
30
tests/test_fixed_source/results.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import numpy as np
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# extract tally results and convert to vector
|
||||
results = sp.tallies[0].results
|
||||
shape = results.shape
|
||||
size = (np.product(shape))
|
||||
results = np.reshape(results, size)
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out tally results
|
||||
outstr += 'tallies:\n'
|
||||
for item in results:
|
||||
outstr += "{0:10.8f}\n".format(item)
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
3
tests/test_fixed_source/results_true.dat
Normal file
3
tests/test_fixed_source/results_true.dat
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
tallies:
|
||||
471.58945263
|
||||
22414.09099170
|
||||
8
tests/test_fixed_source/tallies.xml
Normal file
8
tests/test_fixed_source/tallies.xml
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
<tallies>
|
||||
|
||||
<tally id="1">
|
||||
<scores>flux</scores>
|
||||
</tally>
|
||||
|
||||
</tallies>
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,11 +16,22 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
def test_statepoint_exists():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_output_exists():
|
||||
assert os.path.exists(pwd + '/tallies.out')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out',
|
||||
pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<plots>
|
||||
|
||||
<!--
|
||||
===============================================================
|
||||
Description: Rectangular Array of Water-Moderated MOX Fuel Rods
|
||||
Case: MIX-COMP-THERM-002, PNL-30
|
||||
Written By: Paul Romano
|
||||
Date: 9/6/2012
|
||||
===============================================================
|
||||
-->
|
||||
|
||||
<plot id="1" color="mat">
|
||||
<basis>xy</basis>
|
||||
<origin>25. 25. 4.5</origin>
|
||||
<width>50. 50.</width>
|
||||
<pixels>1000 1000</pixels>
|
||||
</plot>
|
||||
|
||||
</plots>
|
||||
22
tests/test_lattice/results.py
Normal file
22
tests/test_lattice/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_lattice/results_true.dat
Normal file
2
tests/test_lattice/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
0.97864897 0.03395480
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_lattice_multiple/results.py
Normal file
22
tests/test_lattice_multiple/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_lattice_multiple/results_true.dat
Normal file
2
tests/test_lattice_multiple/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
1.63626998 0.13749537
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_natural_element/results.py
Normal file
22
tests/test_natural_element/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_natural_element/results_true.dat
Normal file
2
tests/test_natural_element/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
1.01010427 0.02527489
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -18,8 +19,15 @@ def test_run():
|
|||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_output/results.py
Normal file
22
tests/test_output/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_output/results_true.dat
Normal file
2
tests/test_output/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
0.30078030 0.00343315
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -24,9 +25,16 @@ def test_cross_sections_exists():
|
|||
def test_statepoint_exists():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + i for i in ['/statepoint.10.binary', '/summary.out',
|
||||
'/cross_sections.out']]
|
||||
'/cross_sections.out', '/results_test.dat']]
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
33
tests/test_particle_restart/results.py
Normal file
33
tests/test_particle_restart/results.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import particle restart
|
||||
sys.path.append('../../src/utils')
|
||||
import particle_restart as pr
|
||||
|
||||
# read in particle restart file
|
||||
p = pr.Particle('particle_10_638.binary')
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out properties
|
||||
outstr += 'current batch:\n'
|
||||
outstr += "{0:10.8f}\n".format(p.current_batch)
|
||||
outstr += 'current gen:\n'
|
||||
outstr += "{0:10.8f}\n".format(p.current_gen)
|
||||
outstr += 'particle id:\n'
|
||||
outstr += "{0:10.8f}\n".format(p.id)
|
||||
outstr += 'particle weight:\n'
|
||||
outstr += "{0:10.8f}\n".format(p.weight)
|
||||
outstr += 'particle energy:\n'
|
||||
outstr += "{0:10.8f}\n".format(p.energy)
|
||||
outstr += 'particle xyz:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f} {2:10.8f}\n".format(p.xyz[0],p.xyz[1],p.xyz[2])
|
||||
outstr += 'particle uvw:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f} {2:10.8f}\n".format(p.uvw[0],p.uvw[1],p.uvw[2])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
14
tests/test_particle_restart/results_true.dat
Normal file
14
tests/test_particle_restart/results_true.dat
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
current batch:
|
||||
10.00000000
|
||||
current gen:
|
||||
1.00000000
|
||||
particle id:
|
||||
638.00000000
|
||||
particle weight:
|
||||
1.00000000
|
||||
particle energy:
|
||||
2.19644588
|
||||
particle xyz:
|
||||
30.87637144 57.78785719 35.19837347
|
||||
particle uvw:
|
||||
-0.69841548 -0.09803596 0.70894624
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -17,14 +18,21 @@ def test_run():
|
|||
def test_created_restart():
|
||||
assert os.path.exists(pwd + '/particle_10_638.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def test_run_restart():
|
||||
proc = Popen([pwd + '/../../src/openmc -s particle_10_638.binary'],
|
||||
proc = Popen([pwd + '/../../src/openmc -r particle_10_638.binary'],
|
||||
stderr=PIPE, stdout=PIPE, shell=True)
|
||||
stdout, stderr = proc.communicate()
|
||||
assert stderr != ''
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/particle_10_638.binary']
|
||||
output = [pwd + '/particle_10_638.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_ptables_off/results.py
Normal file
22
tests/test_ptables_off/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_ptables_off/results_true.dat
Normal file
2
tests/test_ptables_off/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
0.29819611 0.00828720
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -18,8 +19,15 @@ def test_run():
|
|||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_reflective_cone/results.py
Normal file
22
tests/test_reflective_cone/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_reflective_cone/results_true.dat
Normal file
2
tests/test_reflective_cone/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
2.25422952 0.01988955
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_reflective_cylinder/results.py
Normal file
22
tests/test_reflective_cylinder/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_reflective_cylinder/results_true.dat
Normal file
2
tests/test_reflective_cylinder/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
2.26978548 0.00418283
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_reflective_plane/results.py
Normal file
22
tests/test_reflective_plane/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_reflective_plane/results_true.dat
Normal file
2
tests/test_reflective_plane/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
2.27029660 0.00403683
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_reflective_sphere/results.py
Normal file
22
tests/test_reflective_sphere/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_reflective_sphere/results_true.dat
Normal file
2
tests/test_reflective_sphere/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
2.27701025 0.00486242
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_rotation/results.py
Normal file
22
tests/test_rotation/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_rotation/results_true.dat
Normal file
2
tests/test_rotation/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
0.30078030 0.00343315
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
22
tests/test_salphabeta/results.py
Normal file
22
tests/test_salphabeta/results.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
# import statepoint
|
||||
sys.path.append('../../src/utils')
|
||||
import statepoint
|
||||
|
||||
# read in statepoint file
|
||||
sp = statepoint.StatePoint('statepoint.10.binary')
|
||||
sp.read_results()
|
||||
|
||||
# set up output string
|
||||
outstr = ''
|
||||
|
||||
# write out k-combined
|
||||
outstr += 'k-combined:\n'
|
||||
outstr += "{0:10.8f} {1:10.8f}\n".format(sp.k_combined[0], sp.k_combined[1])
|
||||
|
||||
# write results to file
|
||||
with open('results_test.dat','w') as fh:
|
||||
fh.write(outstr)
|
||||
2
tests/test_salphabeta/results_true.dat
Normal file
2
tests/test_salphabeta/results_true.dat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
k-combined:
|
||||
0.86084578 0.00787947
|
||||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import os
|
||||
from subprocess import Popen, STDOUT, PIPE
|
||||
import filecmp
|
||||
|
||||
pwd = os.path.dirname(__file__)
|
||||
|
||||
|
|
@ -15,8 +16,18 @@ def test_run():
|
|||
print(proc.communicate()[0])
|
||||
assert returncode == 0
|
||||
|
||||
def test_created_statepoint():
|
||||
assert os.path.exists(pwd + '/statepoint.10.binary')
|
||||
|
||||
def test_results():
|
||||
os.system('python results.py')
|
||||
compare = filecmp.cmp('results_test.dat', 'results_true.dat')
|
||||
if not compare:
|
||||
os.rename('results_test.dat', 'results_error.dat')
|
||||
assert compare
|
||||
|
||||
def teardown():
|
||||
output = [pwd + '/statepoint.10.binary']
|
||||
output = [pwd + '/statepoint.10.binary', pwd + '/results_test.dat']
|
||||
for f in output:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue