mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 21:25:36 -04:00
add the shaprio test for normality
This commit is contained in:
parent
fa80bfe613
commit
ee62c7fcd2
1 changed files with 16 additions and 5 deletions
|
|
@ -213,13 +213,24 @@ def test_normal_dist():
|
|||
|
||||
assert ref_val == pytest.approx(test_val)
|
||||
|
||||
prn_seed = 1
|
||||
a = 14.08
|
||||
# make sigma = 1.0
|
||||
b = 1.0
|
||||
ref_val = 16.436645416691427
|
||||
test_val = openmc.lib.math.normal_variate(a, b, prn_seed)
|
||||
|
||||
assert ref_val == pytest.approx(test_val)
|
||||
# import shapiro test
|
||||
from scipy.stats import shapiro
|
||||
samples = []
|
||||
num_samples = 10000
|
||||
# sample some numbers
|
||||
for i in range(num_samples):
|
||||
# sample the normal distribution from openmc
|
||||
samples.append(openmc.lib.math.normal_variate(a, b, prn_seed)
|
||||
prn_seed += 1
|
||||
|
||||
stat,p = shaprio(samples)
|
||||
assert stat > 0.97
|
||||
|
||||
# cleanup
|
||||
del samples
|
||||
|
||||
|
||||
def test_broaden_wmp_polynomials():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue