Merge branch 'feature/numpy_updates' into 'master'

Adapted code to the new numpy version

Closes #233

See merge request cara/cara!320
This commit is contained in:
Andre Henriques 2022-01-26 14:58:08 +01:00
commit c4fbb03adf
3 changed files with 6 additions and 9 deletions

View file

@ -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 = '<br>\n'.join(lines)

View file

@ -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(

View file

@ -27,7 +27,7 @@ REQUIREMENTS: dict = {
'matplotlib',
'memoization',
'mistune',
'numpy != 1.22.0',
'numpy',
'psutil',
'python-dateutil',
'scipy',