From ac92c99098aa7f4e81b4c2ec00be15226a798ed9 Mon Sep 17 00:00:00 2001 From: Nicolas Mounet Date: Tue, 5 Apr 2022 19:42:22 +0200 Subject: [PATCH] Adding breathing rate factor in short-range deposited exposure (bug fix); more samples in Monte-Carlo general tests --- cara/models.py | 20 +++++++++++++------- cara/tests/test_monte_carlo_full_models.py | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/cara/models.py b/cara/models.py index eb7324d5..9ac956c9 100644 --- a/cara/models.py +++ b/cara/models.py @@ -1318,14 +1318,20 @@ class ExposureModel: # in the case of a single diameter or no diameter defined, # one should not take any mean at this stage. deposited_exposure += short_range_exposure*fdep - - # then we multiply by the diameter-independent quantity virus viral load - deposited_exposure *= self.concentration_model.virus.viral_load_in_sputum - # long-range concentration - f_inf = self.concentration_model.infected.fraction_of_infectious_virus() - deposited_exposure += self.long_range_deposited_exposure_between_bounds(time1, time2)/f_inf - return deposited_exposure * f_inf + # multiply by the (diameter-independent) inhalation rate + deposited_exposure *= interaction.activity.inhalation_rate + + # then we multiply by diameter-independent quantities: viral load + # and fraction of infected virions + f_inf = self.concentration_model.infected.fraction_of_infectious_virus() + deposited_exposure *= (f_inf + * self.concentration_model.virus.viral_load_in_sputum + ) + # long-range concentration + deposited_exposure += self.long_range_deposited_exposure_between_bounds(time1, time2) + + return deposited_exposure def deposited_exposure(self) -> _VectorisedFloat: """ diff --git a/cara/tests/test_monte_carlo_full_models.py b/cara/tests/test_monte_carlo_full_models.py index ecdb3374..b97956b9 100644 --- a/cara/tests/test_monte_carlo_full_models.py +++ b/cara/tests/test_monte_carlo_full_models.py @@ -9,7 +9,7 @@ from cara.apps.calculator.model_generator import build_expiration # TODO: seed better the random number generators np.random.seed(2000) -SAMPLE_SIZE = 250_000 +SAMPLE_SIZE = 600_000 TOLERANCE = 0.06 # Load the weather data (temperature in kelvin) for Toronto.