Fix the tests which depend on the gravitational settlement (tests on concentration, its integration, r0, etc.); set a common seed for all tests
This commit is contained in:
parent
4fe0fbefbe
commit
cc98bf003b
4 changed files with 14 additions and 14 deletions
|
|
@ -136,12 +136,12 @@ def conc_model():
|
|||
# expected quanta were computed with a trapezoidal integration, using
|
||||
# a mesh of 10'000 pts per exposed presence interval.
|
||||
@pytest.mark.parametrize("exposed_time_interval, expected_quanta", [
|
||||
[(0, 1), 5.4869151],
|
||||
[(1, 1.01), 0.064013521],
|
||||
[(1.01, 1.02), 0.062266596],
|
||||
[(12, 12.01), 0.0019025904],
|
||||
[(12, 24), 78.190763],
|
||||
[(0, 24), 84.866592],
|
||||
[(0, 1), 5.3334352],
|
||||
[(1, 1.01), 0.061759078],
|
||||
[(1.01, 1.02), 0.060016487],
|
||||
[(12, 12.01), 0.0019012647],
|
||||
[(12, 24), 75.513005],
|
||||
[(0, 24), 81.956988],
|
||||
]
|
||||
)
|
||||
def test_exposure_model_integral_accuracy(exposed_time_interval,
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ def test_concentrations(baseline_model):
|
|||
concentrations = [baseline_model.concentration(t) for t in ts]
|
||||
npt.assert_allclose(
|
||||
concentrations,
|
||||
[0.000000e+00, 0.4189594, 1.6422648e-14, 0.4189594, 6.4374587e-28],
|
||||
[0.000000e+00, 0.41611256, 1.3205628e-14, 0.41611256, 4.1909001e-28],
|
||||
rtol=1e-6
|
||||
)
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ def test_r0(baseline_exposure_model):
|
|||
# expected r0 was computed with a trapezoidal integration, using
|
||||
# a mesh of 100'000 pts per exposed presence interval.
|
||||
r0 = baseline_exposure_model.reproduction_number()
|
||||
npt.assert_allclose(r0, 973.535888)
|
||||
npt.assert_allclose(r0, 972.880852)
|
||||
|
||||
|
||||
def test_periodic_window(baseline_periodic_window, baseline_room):
|
||||
|
|
@ -359,8 +359,8 @@ def build_exposure_model(concentration_model):
|
|||
@pytest.mark.parametrize(
|
||||
"month, expected_quanta",
|
||||
[
|
||||
['Jan', 10.136783],
|
||||
['Jun', 41.800377],
|
||||
['Jan', 9.930854],
|
||||
['Jun', 37.962708],
|
||||
],
|
||||
)
|
||||
def test_quanta_hourly_dep(month,expected_quanta):
|
||||
|
|
@ -379,8 +379,8 @@ def test_quanta_hourly_dep(month,expected_quanta):
|
|||
@pytest.mark.parametrize(
|
||||
"month, expected_quanta",
|
||||
[
|
||||
['Jan', 10.19818],
|
||||
['Jun', 44.130683],
|
||||
['Jan', 9.989881],
|
||||
['Jun', 39.99636],
|
||||
],
|
||||
)
|
||||
def test_quanta_hourly_dep_refined(month,expected_quanta):
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import pytest
|
|||
from cara.monte_carlo.data import activity_distributions, virus_distributions
|
||||
|
||||
# TODO: seed better the random number generators
|
||||
np.random.seed(0)
|
||||
np.random.seed(2000)
|
||||
|
||||
|
||||
# mean & std deviations from CERN-OPEN-2021-04 (Table 4)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ def test_lognormal(mean_gaussian, std_gaussian):
|
|||
assert len(samples) == sample_size
|
||||
npt.assert_allclose([samples.mean(), samples.std()],
|
||||
[exact_mean, exact_std], rtol=0.01)
|
||||
npt.assert_allclose(selected_histogram, exact_dist, rtol=0.02)
|
||||
npt.assert_allclose(selected_histogram, exact_dist, rtol=0.03)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
|
|
|||
Loading…
Reference in a new issue