moved default infectiousness_days value to SARSCoV2 class and added another test scenario

This commit is contained in:
Luis Aleixo 2022-10-10 11:15:05 +02:00
parent d50d63d710
commit 12b7b57593
4 changed files with 9 additions and 6 deletions

View file

@ -278,7 +278,7 @@ def scenario_statistics(mc_model: mc.ExposureModel, sample_times: typing.List[fl
model = mc_model.build_model(size=_DEFAULT_MC_SAMPLE_SIZE)
if (compute_prob_exposure):
# It means we have data to calculate the total_probability_rule
prob_probabilistic_exposure = np.array(model.total_probability_rule()).mean()
prob_probabilistic_exposure = model.total_probability_rule()
else:
prob_probabilistic_exposure = 0.

View file

@ -440,7 +440,7 @@ class Virus:
types: typing.ClassVar[typing.Dict[str, "Virus"]]
#: Number of days the infector is contagious
infectiousness_days: int = 14
infectiousness_days: int
def halflife(self, humidity: _VectorisedFloat, inside_temp: _VectorisedFloat) -> _VectorisedFloat:
# Biological decay (inactivation of the virus in air) - virus
@ -454,7 +454,9 @@ class Virus:
@dataclass(frozen=True)
class SARSCoV2(Virus):
#: Number of days the infector is contagious
infectiousness_days: int = 14
def halflife(self, humidity: _VectorisedFloat, inside_temp: _VectorisedFloat) -> _VectorisedFloat:
"""
Half-life changes with humidity level. Here is implemented a simple

View file

@ -275,7 +275,9 @@ def test_prob_meet_infected_person(pop, cases, AB, exposed, infected, prob_meet_
@pytest.mark.parametrize(
"exposed_population, cm, pop, cases, AB, probabilistic_exposure_probability",[
[10, known_concentrations(lambda t: 36.),
100000, 68, 5, 41.51920685],
100000, 68, 5, 41.50971131],
[10, known_concentrations(lambda t: 0.2),
100000, 68, 5, 2.185785075],
[20, known_concentrations(lambda t: 72.),
100000, 68, 5, 64.09068488],
[30, known_concentrations(lambda t: 1.2),
@ -289,7 +291,6 @@ def test_probabilistic_exposure_probability(exposed_population, cm,
models.Activity.types['Standing'], host_immunity=0.,)
model = ExposureModel(cm, (), population, models.Cases(geographic_population=pop,
geographic_cases=cases, ascertainment_bias=AB),)
np.testing.assert_allclose(
model.total_probability_rule(), probabilistic_exposure_probability, rtol=0.05
)

View file

@ -29,7 +29,7 @@ def test_infected_population_vectorisation(override_params):
0.51,
defaults['exhalation_rate'],
),
virus=caimira.models.Virus(
virus=caimira.models.SARSCoV2(
viral_load_in_sputum=defaults['viral_load_in_sputum'],
infectious_dose=50.,
viable_to_RNA_ratio = 0.5,