diff --git a/cara/apps/expert.py b/cara/apps/expert.py index 664f97b3..a9ed281f 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 bbf4557e..8fdbd34b 100644 --- a/cara/models.py +++ b/cara/models.py @@ -453,11 +453,8 @@ 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) - halflife[humidity <= 0.4] = 3.8 - halflife[humidity > 0.4] = 1.1 - return halflife - + return np.piecewise(humidity, [humidity <= 0.4, humidity > 0.4], [3.8, 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',