Adapted code to new numpy version
This commit is contained in:
parent
8b6f399e02
commit
d8e8398eeb
3 changed files with 6 additions and 9 deletions
|
|
@ -153,16 +153,16 @@ class ExposureModelResult(View):
|
||||||
|
|
||||||
def update_textual_result(self, model: models.ExposureModel):
|
def update_textual_result(self, model: models.ExposureModel):
|
||||||
lines = []
|
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'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'Probability of infection: {np.round(P, 0)}%')
|
||||||
|
|
||||||
lines.append(f'Number of exposed: {model.exposed.number}')
|
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}')
|
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}')
|
lines.append(f'Reproduction number (R0): {R0}')
|
||||||
|
|
||||||
self.html_output.value = '<br>\n'.join(lines)
|
self.html_output.value = '<br>\n'.join(lines)
|
||||||
|
|
|
||||||
|
|
@ -453,11 +453,8 @@ class SARSCoV2(Virus):
|
||||||
piecewise constant model (for more details see A. Henriques et al,
|
piecewise constant model (for more details see A. Henriques et al,
|
||||||
CERN-OPEN-2021-004, DOI: 10.17181/CERN.1GDQ.5Y75)
|
CERN-OPEN-2021-004, DOI: 10.17181/CERN.1GDQ.5Y75)
|
||||||
"""
|
"""
|
||||||
halflife = np.empty_like(humidity)
|
return np.piecewise(humidity, [humidity <= 0.4, humidity > 0.4], [3.8, 1.1])
|
||||||
halflife[humidity <= 0.4] = 3.8
|
|
||||||
halflife[humidity > 0.4] = 1.1
|
|
||||||
return halflife
|
|
||||||
|
|
||||||
|
|
||||||
Virus.types = {
|
Virus.types = {
|
||||||
'SARS_CoV_2': SARSCoV2(
|
'SARS_CoV_2': SARSCoV2(
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -27,7 +27,7 @@ REQUIREMENTS: dict = {
|
||||||
'matplotlib',
|
'matplotlib',
|
||||||
'memoization',
|
'memoization',
|
||||||
'mistune',
|
'mistune',
|
||||||
'numpy != 1.22.0',
|
'numpy',
|
||||||
'psutil',
|
'psutil',
|
||||||
'python-dateutil',
|
'python-dateutil',
|
||||||
'scipy',
|
'scipy',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue