From 1368161ed152ecb3a6614773713c46ab3cc6ff8c Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 23 Dec 2020 11:27:39 -0600 Subject: [PATCH] Change variable names in normal dist unit test --- tests/unit_tests/test_math.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/unit_tests/test_math.py b/tests/unit_tests/test_math.py index 2e3f654009..d242273023 100644 --- a/tests/unit_tests/test_math.py +++ b/tests/unit_tests/test_math.py @@ -206,25 +206,22 @@ def test_watt_spectrum(): def test_normal_dist(): + # When standard deviation is zero, sampled value should be mean prn_seed = 1 - a = 14.08 - b = 0.0 + mean = 14.08 + stdev = 0.0 ref_val = 14.08 - test_val = openmc.lib.math.normal_variate(a, b, prn_seed) - + test_val = openmc.lib.math.normal_variate(mean, stdev, prn_seed) assert ref_val == pytest.approx(test_val) - # make sigma = 1.0 - b = 1.0 - + # Use Shapiro-Wilk test to ensure normality of sampled vairates + stdev = 1.0 samples = [] num_samples = 10000 - # sample some numbers - for i in range(num_samples): + for _ in range(num_samples): # sample the normal distribution from openmc - samples.append(openmc.lib.math.normal_variate(a, b, prn_seed)) + samples.append(openmc.lib.math.normal_variate(mean, stdev, prn_seed)) prn_seed += 1 - stat, p = shapiro(samples) assert p > 0.05