diff --git a/cara/apps/expert.py b/cara/apps/expert.py index 8198f2d1..29df1d1c 100644 --- a/cara/apps/expert.py +++ b/cara/apps/expert.py @@ -153,16 +153,16 @@ class ExposureModelResult(View): def update_textual_result(self, model: models.ExposureModel): lines = [] - P = model.infection_probability() + P = np.array(model.infection_probability()).mean() lines.append(f'Emission rate (virus/hr): {np.round(model.concentration_model.infected.emission_rate_when_present(),0)}') lines.append(f'Probability of infection: {np.round(P, 0)}%') lines.append(f'Number of exposed: {model.exposed.number}') - new_cases = np.round(model.expected_new_cases(), 1) + new_cases = np.round(np.array(model.expected_new_cases()).mean(), 1) lines.append(f'Number of expected new cases: {new_cases}') - R0 = np.round(model.reproduction_number(), 1) + R0 = np.round(np.array(model.reproduction_number()).mean(), 1) lines.append(f'Reproduction number (R0): {R0}') self.html_output.value = '
\n'.join(lines) diff --git a/cara/models.py b/cara/models.py index b8f0e4a2..30aeaafd 100644 --- a/cara/models.py +++ b/cara/models.py @@ -460,13 +460,10 @@ class SARSCoV2(Virus): piecewise constant model (for more details see A. Henriques et al, CERN-OPEN-2021-004, DOI: 10.17181/CERN.1GDQ.5Y75) """ - halflife = np.empty_like(humidity) - # Taken from Morris et al (https://doi.org/10.7554/eLife.65902) data at T = 22°C and RH = 40 %. - halflife[humidity <= 0.4] = 6.43 - # Taken from Doremalen et al (https://www.nejm.org/doi/10.1056/NEJMc2004973). - halflife[humidity > 0.4] = 1.1 - return halflife - + # Taken from Morris et al (https://doi.org/10.7554/eLife.65902) data at T = 22°C and RH = 40 % and + # from Doremalen et al (https://www.nejm.org/doi/10.1056/NEJMc2004973). + return np.piecewise(humidity, [humidity <= 0.4, humidity > 0.4], [6.43, 1.1]) + Virus.types = { 'SARS_CoV_2': SARSCoV2( diff --git a/setup.py b/setup.py index f32d10c2..e8136836 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ REQUIREMENTS: dict = { 'matplotlib', 'memoization', 'mistune', - 'numpy != 1.22.0, != 1.22.1', + 'numpy', 'psutil', 'python-dateutil', 'scipy',