diff --git a/cara/models.py b/cara/models.py index f2ac2500..0a94a2dd 100644 --- a/cara/models.py +++ b/cara/models.py @@ -465,7 +465,7 @@ class SARSCoV2(Virus): return np.maximum(1.1, (0.693/((0.16030 + 0.04018*(((temperature-273.15)-20.615)/10.585) +0.02176*((humidity-45.235)/28.665) -0.14369 - -0.2636*((temperature-273.15)-20.615)/10.585)))) + -0.02636*((temperature-273.15)-20.615)/10.585)))) Virus.types = { diff --git a/cara/tests/models/test_exposure_model.py b/cara/tests/models/test_exposure_model.py index 428de12d..5a6a5449 100644 --- a/cara/tests/models/test_exposure_model.py +++ b/cara/tests/models/test_exposure_model.py @@ -179,12 +179,12 @@ def sr_model(): @pytest.mark.parametrize( ["exposed_time_interval", "expected_deposited_exposure"], [ - [(0., 1.), 48.193159880096644], - [(1., 1.01), 0.5663683904832492], - [(1.01, 1.02), 0.5514013220457682], - [(12., 12.01), 0.016277647772557004], - [(12., 24.), 691.2138099188268], - [(0., 24.), 750.2580429542696], + [(0., 1.), 45.6008710], + [(1., 1.01), 0.5280401], + [(1.01, 1.02), 0.51314096385], + [(12., 12.01), 0.016255813185], + [(12., 24.), 645.63619275], + [(0., 24.), 700.7322474], ] ) def test_exposure_model_integral_accuracy(exposed_time_interval, diff --git a/cara/tests/test_full_algorithm.py b/cara/tests/test_full_algorithm.py index 8a07321c..3f701e5e 100644 --- a/cara/tests/test_full_algorithm.py +++ b/cara/tests/test_full_algorithm.py @@ -47,9 +47,6 @@ class SimpleConcentrationModel: #: room volume (m^3) room_volume: _VectorisedFloat - #: The temperature inside the room (Kelvin). - #inside_temp: float = 293.15 - #: ventilation rate (air changes per hour) - including HEPA lambda_ventilation: _VectorisedFloat @@ -89,10 +86,10 @@ class SimpleConcentrationModel: """ return (self.lambda_ventilation - + ln2/(max(1.1, (0.693 / ((0.16030 + 0.04018 * (((22) - 20.615) / 10.585) - + 0.02176 * ((self.humidity - 45.235) / 28.665) + + ln2/(np.maximum(1.1, (0.693 / ((0.16030 + 0.04018 * (((21) - 20.615) / 10.585) + + 0.02176*((self.humidity - 45.235) / 28.665) - 0.14369 - - 0.2636((22-20.615)/10.585))))))) + - 0.02636*((21-20.615)/10.585))))))) @method_cache def deposition_removal_coefficient(self) -> float: @@ -460,7 +457,7 @@ interaction_intervals = (models.SpecificInterval(present_times=((10.5, 11.0),)), @pytest.fixture def c_model() -> mc.ConcentrationModel: return mc.ConcentrationModel( - room=models.Room(volume=50, humidity=0.3), + room=models.Room(volume=50, inside_temp=models.PiecewiseConstant((0., 24.), (293,)), humidity=0.3), ventilation=models.AirChange(active=models.PeriodicInterval(period=120, duration=120), air_exch=1.), infected=mc.InfectedPopulation( number=1, diff --git a/cara/tests/test_known_quantities.py b/cara/tests/test_known_quantities.py index 4eb94d0b..ed775312 100644 --- a/cara/tests/test_known_quantities.py +++ b/cara/tests/test_known_quantities.py @@ -43,7 +43,7 @@ def test_concentrations(baseline_concentration_model): concentrations = [baseline_concentration_model.concentration(float(t)) for t in ts] npt.assert_allclose( concentrations, - [0.000000e+00, 2.108144e+01, 1.004741e-12, 2.108144e+01, 4.788592e-26], + [0.000000e+00, 20.805628, 6.602814e-13, 20.805628, 2.09545e-26], rtol=1e-6 ) @@ -94,7 +94,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, 781.293793) + npt.assert_allclose(r0, 776.941990) def test_periodic_window(baseline_periodic_window, baseline_room): @@ -381,8 +381,8 @@ def build_exposure_model(concentration_model, short_range_model): @pytest.mark.parametrize( "month, expected_deposited_exposure", [ - ['Jan', 392.994454], - ['Jun', 2127.82386], + ['Jan', 377.440565819], + ['Jun', 1721.03336729], ], ) def test_exposure_hourly_dep(month,expected_deposited_exposure, baseline_sr_model): @@ -402,8 +402,8 @@ def test_exposure_hourly_dep(month,expected_deposited_exposure, baseline_sr_mode @pytest.mark.parametrize( "month, expected_deposited_exposure", [ - ['Jan', 394.000261], - ['Jun', 2239.777906], + ['Jan', 383.339206111], + ['Jun', 1799.17597184], ], ) def test_exposure_hourly_dep_refined(month,expected_deposited_exposure, baseline_sr_model): diff --git a/cara/tests/test_monte_carlo_full_models.py b/cara/tests/test_monte_carlo_full_models.py index 58f0a57d..48682758 100644 --- a/cara/tests/test_monte_carlo_full_models.py +++ b/cara/tests/test_monte_carlo_full_models.py @@ -310,13 +310,13 @@ def waiting_room_mc(): @pytest.mark.parametrize( "mc_model, expected_pi, expected_new_cases, expected_dose, expected_ER", [ - ["shared_office_mc", 6.524158, 0.195725, 3.413983, 809], - ["classroom_mc", 9.5, 1.85, 9.478, 5624], - ["ski_cabin_mc", 16.0, 0.5, 17.315, 7966], - ["skagit_chorale_mc",69.84901, 40.0, 121.265911, 190422], - ["bus_ride_mc", 13.311721, 8.918853, 8.6662, 5419], + ["shared_office_mc", 6.03, 0.18, 3.198, 809], + ["classroom_mc", 8.63, 1.64, 8.082, 5624], + ["ski_cabin_mc", 16.0, 0.47, 17.315, 7966], + ["skagit_chorale_mc",65.7, 40.0, 102.213, 190422], + ["bus_ride_mc", 12.0, 8.0, 7.65, 5419], ["gym_mc", 0.45, 0.13, 0.208, 1145], - ["waiting_room_mc", 1.854373, 0.259612, 0.99173, 737], + ["waiting_room_mc", 1.59, 0.22, 0.821, 737], ] ) def test_report_models(mc_model, expected_pi, expected_new_cases, @@ -337,10 +337,10 @@ def test_report_models(mc_model, expected_pi, expected_new_cases, @pytest.mark.parametrize( "mask_type, month, expected_pi, expected_dose, expected_ER", [ - ["No mask", "Jul", 10.966992, 12.357222, 809], - ["Type I", "Jul", 2.084648, 1.137819, 149], - ["FFP2", "Jul", 0.654566, .309637, 149], - ["Type I", "Feb", 0.612366, 0.272, 162], + ["No mask", "Jul", 9.52, 9.920, 809], + ["Type I", "Jul", 1.7, 0.913, 149], + ["FFP2", "Jul", 0.51, 0.239, 149], + ["Type I", "Feb", 0.57, 0.272, 162], ], ) def test_small_shared_office_Geneva(mask_type, month, expected_pi,