updated filter_group_transfer test

This commit is contained in:
Bryan Herman 2013-08-12 14:51:12 -04:00
parent 620980274c
commit b5908f68f2
3 changed files with 111 additions and 1 deletions

View 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)

View 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

View file

@ -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.system('cp 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)