diff --git a/cara/apps/expert.py b/cara/apps/expert.py index 261afe75..bba12b6b 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 d98baf02..d09f9f69 100644 --- a/cara/models.py +++ b/cara/models.py @@ -459,13 +459,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 e057da5c..e8136836 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ REQUIREMENTS: dict = { 'matplotlib', 'memoization', 'mistune', - 'numpy != 1.22.0', + 'numpy', 'psutil', 'python-dateutil', 'scipy',