updated filter_mesh_2d test

This commit is contained in:
Bryan Herman 2013-08-12 14:54:14 -04:00
parent 07ba85d487
commit 282cf4f47c
3 changed files with 625 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,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

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)