updated confidence interval testing for k combined and tally results

This commit is contained in:
Bryan Herman 2013-08-12 13:30:17 -04:00
parent 5d00dfa638
commit 947b8576d6
4 changed files with 44 additions and 2 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,5 @@
k-combined:
0.29618376 0.01254762
tallies:
63.10626773
503.50685224

View file

@ -2,6 +2,7 @@
import os
from subprocess import Popen, STDOUT, PIPE
import filecmp
pwd = os.path.dirname(__file__)
@ -21,6 +22,10 @@ def test_created_statepoint():
def test_created_output():
assert os.path.exists(pwd + '/tallies.out')
def test_results():
os.system('python results.py')
assert filecmp.cmp('results_test.dat', 'results_true.dat')
def teardown():
output = [pwd + '/statepoint.10.binary', pwd + '/tallies.out']
for f in output:

View file

@ -27,5 +27,3 @@ for root, dirs, files in os.walk('.'):
# Go back a directory
os.chdir('..')
exit()