Sometimes the resulting distribution is not normal.
=================================== FAILURES ===================================
_______________ TestPybind11Bindings.test_gaussian_distribution ________________
self = <test_pybind11_bindings.TestPybind11Bindings object at 0x10a326f90>
sample_data = {'C0_input': -1.0, 'U': array([0.5, 0.6, 0.7, 0.8, 0.9]), 'input_vector': array([0.93853618, 6.02024286, 2.63349139, 1...9, 2.49825269, 2.86078551, 1.64777499, 2.94777993,
1.36162946, 1.47935768, 1.11562839, 0.05149555, 0.22833487])}
def test_gaussian_distribution(self, sample_data):
"""Test Gaussian distribution value generation"""
if not NEW_API_AVAILABLE:
pytest.skip("New API not available")
# Generate 50 values and test statistical properties
values = [StatTools_bindings.get_gauss_dist_value() for _ in range(500)]
# All values should be floats
assert all(isinstance(x, float) for x in values)
# Test for normality using Shapiro-Wilk test
# Null hypothesis: the sample comes from a normal distribution
# We want to fail to reject the null hypothesis (p-value > 0.05)
from scipy.stats import shapiro
stat, p_value = shapiro(values)
> assert (
p_value > 0.05
), f"Values do not appear to be normally distributed (p-value: {p_value:.4f})"
E AssertionError: Values do not appear to be normally distributed (p-value: 0.0131)
E assert np.float64(0.013082312439144999) > 0.05
tests/test_pybind11_bindings.py:83: AssertionError
Sometimes the resulting distribution is not normal.
To Reproduce
Steps to reproduce the behavior: