Revert "variables renaming (removal of quantum)"
This reverts commit ae4db5a4b0.
This commit is contained in:
parent
ae4db5a4b0
commit
52c4eb7c2c
4 changed files with 26 additions and 25 deletions
|
|
@ -420,8 +420,8 @@ class Virus:
|
||||||
#: RNA copies / mL
|
#: RNA copies / mL
|
||||||
viral_load_in_sputum: _VectorisedFloat
|
viral_load_in_sputum: _VectorisedFloat
|
||||||
|
|
||||||
#: RNA-copies
|
#: RNA-copies per quantum
|
||||||
infectious_dose: _VectorisedFloat
|
quantum_infectious_dose: _VectorisedFloat
|
||||||
|
|
||||||
#: Pre-populated examples of Viruses.
|
#: Pre-populated examples of Viruses.
|
||||||
types: typing.ClassVar[typing.Dict[str, "Virus"]]
|
types: typing.ClassVar[typing.Dict[str, "Virus"]]
|
||||||
|
|
@ -458,20 +458,20 @@ Virus.types = {
|
||||||
# It is somewhere between 1000 or 10 SARS-CoV viruses,
|
# It is somewhere between 1000 or 10 SARS-CoV viruses,
|
||||||
# as per https://www.dhs.gov/publication/st-master-question-list-covid-19
|
# as per https://www.dhs.gov/publication/st-master-question-list-covid-19
|
||||||
# 50 comes from Buonanno et al.
|
# 50 comes from Buonanno et al.
|
||||||
infectious_dose=50.,
|
quantum_infectious_dose=50.,
|
||||||
),
|
),
|
||||||
'SARS_CoV_2_B117': SARSCoV2(
|
'SARS_CoV_2_B117': SARSCoV2(
|
||||||
# also called VOC-202012/01
|
# also called VOC-202012/01
|
||||||
viral_load_in_sputum=1e9,
|
viral_load_in_sputum=1e9,
|
||||||
infectious_dose=30.,
|
quantum_infectious_dose=30.,
|
||||||
),
|
),
|
||||||
'SARS_CoV_2_P1': SARSCoV2(
|
'SARS_CoV_2_P1': SARSCoV2(
|
||||||
viral_load_in_sputum=1e9,
|
viral_load_in_sputum=1e9,
|
||||||
infectious_dose=1/0.045,
|
quantum_infectious_dose=1/0.045,
|
||||||
),
|
),
|
||||||
'SARS_CoV_2_B16172': SARSCoV2(
|
'SARS_CoV_2_B16172': SARSCoV2(
|
||||||
viral_load_in_sputum=1e9,
|
viral_load_in_sputum=1e9,
|
||||||
infectious_dose=30/1.6,
|
quantum_infectious_dose=30/1.6,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -677,7 +677,7 @@ class InfectedPopulation(Population):
|
||||||
Note that the rate is not currently time-dependent.
|
Note that the rate is not currently time-dependent.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
# Emission Rate (infectious dose / h)
|
# Emission Rate (infectious quantum / h)
|
||||||
# Note on units: exhalation rate is in m^3/h, aerosols in mL/cm^3
|
# Note on units: exhalation rate is in m^3/h, aerosols in mL/cm^3
|
||||||
# and viral load in virus/mL -> 1e6 conversion factor
|
# and viral load in virus/mL -> 1e6 conversion factor
|
||||||
aerosols = self.expiration.aerosols(self.mask)
|
aerosols = self.expiration.aerosols(self.mask)
|
||||||
|
|
@ -685,14 +685,15 @@ class InfectedPopulation(Population):
|
||||||
ER = (self.virus.viral_load_in_sputum *
|
ER = (self.virus.viral_load_in_sputum *
|
||||||
self.activity.exhalation_rate *
|
self.activity.exhalation_rate *
|
||||||
10 ** 6 *
|
10 ** 6 *
|
||||||
aerosols)
|
aerosols /
|
||||||
|
self.virus.quantum_infectious_dose)
|
||||||
|
|
||||||
# For superspreading event, where ejection_factor is infinite we fix the ER
|
# For superspreading event, where ejection_factor is infinite we fix the ER
|
||||||
# based on Miller et al. (2020).
|
# based on Miller et al. (2020).
|
||||||
if isinstance(aerosols, np.ndarray):
|
if isinstance(aerosols, np.ndarray):
|
||||||
ER[np.isinf(aerosols)] = 970 * self.virus.infectious_dose
|
ER[np.isinf(aerosols)] = 970
|
||||||
elif np.isinf(aerosols):
|
elif np.isinf(aerosols):
|
||||||
ER = 970 * self.virus.infectious_dose
|
ER = 970
|
||||||
|
|
||||||
return ER
|
return ER
|
||||||
|
|
||||||
|
|
@ -803,7 +804,7 @@ class ConcentrationModel:
|
||||||
|
|
||||||
def concentration(self, time: float) -> _VectorisedFloat:
|
def concentration(self, time: float) -> _VectorisedFloat:
|
||||||
"""
|
"""
|
||||||
Virus concentration, as a function of time.
|
Virus quanta concentration, as a function of time.
|
||||||
The formulas used here assume that all parameters (ventilation,
|
The formulas used here assume that all parameters (ventilation,
|
||||||
emission rate) are constant between two state changes - only
|
emission rate) are constant between two state changes - only
|
||||||
the value of these parameters at the next state change, are used.
|
the value of these parameters at the next state change, are used.
|
||||||
|
|
@ -866,8 +867,8 @@ class ExposureModel:
|
||||||
#: The fraction of viruses actually deposited in the respiratory tract
|
#: The fraction of viruses actually deposited in the respiratory tract
|
||||||
fraction_deposited: _VectorisedFloat = 0.6
|
fraction_deposited: _VectorisedFloat = 0.6
|
||||||
|
|
||||||
def exposure(self) -> _VectorisedFloat:
|
def quanta_exposure(self) -> _VectorisedFloat:
|
||||||
"""The number of virus per meter^3."""
|
"""The number of virus quanta per meter^3."""
|
||||||
exposure = 0.0
|
exposure = 0.0
|
||||||
|
|
||||||
for start, stop in self.exposed.presence.boundaries():
|
for start, stop in self.exposed.presence.boundaries():
|
||||||
|
|
@ -876,7 +877,7 @@ class ExposureModel:
|
||||||
return exposure * self.repeats
|
return exposure * self.repeats
|
||||||
|
|
||||||
def infection_probability(self) -> _VectorisedFloat:
|
def infection_probability(self) -> _VectorisedFloat:
|
||||||
exposure = self.exposure()
|
exposure = self.quanta_exposure()
|
||||||
|
|
||||||
inf_aero = (
|
inf_aero = (
|
||||||
self.exposed.activity.inhalation_rate *
|
self.exposed.activity.inhalation_rate *
|
||||||
|
|
@ -885,7 +886,7 @@ class ExposureModel:
|
||||||
)
|
)
|
||||||
|
|
||||||
# Probability of infection.
|
# Probability of infection.
|
||||||
return (1 - np.exp(-inf_aero / self.concentration_model.virus.infectious_dose)) * 100
|
return (1 - np.exp(-inf_aero)) * 100
|
||||||
|
|
||||||
def expected_new_cases(self) -> _VectorisedFloat:
|
def expected_new_cases(self) -> _VectorisedFloat:
|
||||||
prob = self.infection_probability()
|
prob = self.infection_probability()
|
||||||
|
|
|
||||||
|
|
@ -43,18 +43,18 @@ symptomatic_vl_frequencies = LogCustomKernel(
|
||||||
virus_distributions = {
|
virus_distributions = {
|
||||||
'SARS_CoV_2': mc.SARSCoV2(
|
'SARS_CoV_2': mc.SARSCoV2(
|
||||||
viral_load_in_sputum=symptomatic_vl_frequencies,
|
viral_load_in_sputum=symptomatic_vl_frequencies,
|
||||||
infectious_dose=100,
|
quantum_infectious_dose=100,
|
||||||
),
|
),
|
||||||
'SARS_CoV_2_B117': mc.SARSCoV2(
|
'SARS_CoV_2_B117': mc.SARSCoV2(
|
||||||
viral_load_in_sputum=symptomatic_vl_frequencies,
|
viral_load_in_sputum=symptomatic_vl_frequencies,
|
||||||
infectious_dose=60,
|
quantum_infectious_dose=60,
|
||||||
),
|
),
|
||||||
'SARS_CoV_2_P1': mc.SARSCoV2(
|
'SARS_CoV_2_P1': mc.SARSCoV2(
|
||||||
viral_load_in_sputum=symptomatic_vl_frequencies,
|
viral_load_in_sputum=symptomatic_vl_frequencies,
|
||||||
infectious_dose=100/2.25,
|
quantum_infectious_dose=100/2.25,
|
||||||
),
|
),
|
||||||
'SARS_CoV_2_B16172': mc.SARSCoV2(
|
'SARS_CoV_2_B16172': mc.SARSCoV2(
|
||||||
viral_load_in_sputum=symptomatic_vl_frequencies,
|
viral_load_in_sputum=symptomatic_vl_frequencies,
|
||||||
infectious_dose=60/1.6,
|
quantum_infectious_dose=60/1.6,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ from cara import models
|
||||||
{'humidity': np.array([0.5, 0.4])},
|
{'humidity': np.array([0.5, 0.4])},
|
||||||
{'air_change': np.array([100, 120])},
|
{'air_change': np.array([100, 120])},
|
||||||
{'viral_load_in_sputum': np.array([5e8, 1e9])},
|
{'viral_load_in_sputum': np.array([5e8, 1e9])},
|
||||||
{'infectious_dose': np.array([50, 20])},
|
{'quantum_infectious_dose': np.array([50, 20])},
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
def test_concentration_model_vectorisation(override_params):
|
def test_concentration_model_vectorisation(override_params):
|
||||||
|
|
@ -22,7 +22,7 @@ def test_concentration_model_vectorisation(override_params):
|
||||||
'humidity': 0.5,
|
'humidity': 0.5,
|
||||||
'air_change': 100,
|
'air_change': 100,
|
||||||
'viral_load_in_sputum': 1e9,
|
'viral_load_in_sputum': 1e9,
|
||||||
'infectious_dose': 50,
|
'quantum_infectious_dose': 50,
|
||||||
}
|
}
|
||||||
defaults.update(override_params)
|
defaults.update(override_params)
|
||||||
|
|
||||||
|
|
@ -43,7 +43,7 @@ def test_concentration_model_vectorisation(override_params):
|
||||||
),
|
),
|
||||||
virus=models.SARSCoV2(
|
virus=models.SARSCoV2(
|
||||||
viral_load_in_sputum=defaults['viral_load_in_sputum'],
|
viral_load_in_sputum=defaults['viral_load_in_sputum'],
|
||||||
infectious_dose=defaults['infectious_dose'],
|
quantum_infectious_dose=defaults['quantum_infectious_dose'],
|
||||||
),
|
),
|
||||||
expiration=models.Expiration((1., 0., 0.)),
|
expiration=models.Expiration((1., 0., 0.)),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,14 @@ import cara.models
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"override_params", [
|
"override_params", [
|
||||||
{'viral_load_in_sputum': np.array([5e8, 1e9])},
|
{'viral_load_in_sputum': np.array([5e8, 1e9])},
|
||||||
{'infectious_dose': np.array([50, 20])},
|
{'quantum_infectious_dose': np.array([50, 20])},
|
||||||
{'exhalation_rate': np.array([0.75, 0.81])},
|
{'exhalation_rate': np.array([0.75, 0.81])},
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
def test_infected_population_vectorisation(override_params):
|
def test_infected_population_vectorisation(override_params):
|
||||||
defaults = {
|
defaults = {
|
||||||
'viral_load_in_sputum': 1e9,
|
'viral_load_in_sputum': 1e9,
|
||||||
'infectious_dose': 50,
|
'quantum_infectious_dose': 50,
|
||||||
'exhalation_rate': 0.75,
|
'exhalation_rate': 0.75,
|
||||||
}
|
}
|
||||||
defaults.update(override_params)
|
defaults.update(override_params)
|
||||||
|
|
@ -33,7 +33,7 @@ def test_infected_population_vectorisation(override_params):
|
||||||
),
|
),
|
||||||
virus=cara.models.Virus(
|
virus=cara.models.Virus(
|
||||||
viral_load_in_sputum=defaults['viral_load_in_sputum'],
|
viral_load_in_sputum=defaults['viral_load_in_sputum'],
|
||||||
infectious_dose=defaults['infectious_dose'],
|
quantum_infectious_dose=defaults['quantum_infectious_dose'],
|
||||||
),
|
),
|
||||||
expiration=cara.models.Expiration((1., 0., 0.)),
|
expiration=cara.models.Expiration((1., 0., 0.)),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue