2020-11-12 20:21:02 +00:00
|
|
|
import pytest
|
|
|
|
|
|
2024-06-20 08:14:38 +00:00
|
|
|
from caimira.calculator.models import models
|
|
|
|
|
import caimira.calculator.models.data
|
|
|
|
|
import caimira.calculator.models.dataclass_utils
|
|
|
|
|
from caimira.calculator.store.data_registry import DataRegistry
|
2023-11-29 07:54:58 +00:00
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
|
def data_registry():
|
|
|
|
|
return DataRegistry()
|
2020-11-12 20:21:02 +00:00
|
|
|
|
|
|
|
|
@pytest.fixture
|
2023-11-29 07:54:58 +00:00
|
|
|
def baseline_concentration_model(data_registry):
|
2020-11-12 20:21:02 +00:00
|
|
|
model = models.ConcentrationModel(
|
2023-11-29 07:54:58 +00:00
|
|
|
data_registry=data_registry,
|
2022-04-22 13:20:20 +00:00
|
|
|
room=models.Room(volume=75, inside_temp=models.PiecewiseConstant((0., 24.), (293,))),
|
2021-05-31 21:09:22 +00:00
|
|
|
ventilation=models.AirChange(
|
2021-08-05 13:48:24 +00:00
|
|
|
active=models.SpecificInterval(((0., 24.), )),
|
2021-05-31 21:09:22 +00:00
|
|
|
air_exch=30.,
|
2020-11-12 20:21:02 +00:00
|
|
|
),
|
2021-09-16 11:55:04 +00:00
|
|
|
infected=models.EmittingPopulation(
|
2023-11-29 07:54:58 +00:00
|
|
|
data_registry=data_registry,
|
2020-11-12 20:21:02 +00:00
|
|
|
number=1,
|
|
|
|
|
virus=models.Virus.types['SARS_CoV_2'],
|
2021-08-05 13:48:24 +00:00
|
|
|
presence=models.SpecificInterval(((0., 4.), (5., 8.))),
|
2020-11-12 20:21:02 +00:00
|
|
|
mask=models.Mask.types['No mask'],
|
2020-11-17 18:24:07 +00:00
|
|
|
activity=models.Activity.types['Light activity'],
|
2021-09-16 11:55:04 +00:00
|
|
|
known_individual_emission_rate=970 * 50,
|
2021-10-05 13:44:37 +00:00
|
|
|
host_immunity=0.,
|
2022-06-09 07:46:31 +00:00
|
|
|
# Superspreading event, where ejection factor is fixed based
|
2021-09-16 11:55:04 +00:00
|
|
|
# on Miller et al. (2020) - 50 represents the infectious dose.
|
2020-11-12 20:21:02 +00:00
|
|
|
),
|
2021-10-05 13:44:37 +00:00
|
|
|
evaporation_factor=0.3,
|
2020-11-12 20:21:02 +00:00
|
|
|
)
|
|
|
|
|
return model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2022-02-17 10:54:10 +00:00
|
|
|
def baseline_sr_model():
|
2022-03-29 10:19:14 +00:00
|
|
|
return ()
|
2022-02-17 10:54:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2023-11-29 07:54:58 +00:00
|
|
|
def baseline_exposure_model(data_registry, baseline_concentration_model, baseline_sr_model):
|
2020-11-12 20:21:02 +00:00
|
|
|
return models.ExposureModel(
|
2023-11-29 07:54:58 +00:00
|
|
|
data_registry=data_registry,
|
|
|
|
|
concentration_model=baseline_concentration_model,
|
|
|
|
|
short_range=baseline_sr_model,
|
2020-11-12 20:21:02 +00:00
|
|
|
exposed=models.Population(
|
2021-05-31 21:09:22 +00:00
|
|
|
number=1000,
|
2022-02-17 10:54:10 +00:00
|
|
|
presence=baseline_concentration_model.infected.presence,
|
|
|
|
|
activity=baseline_concentration_model.infected.activity,
|
|
|
|
|
mask=baseline_concentration_model.infected.mask,
|
2021-10-05 13:44:37 +00:00
|
|
|
host_immunity=0.,
|
2021-06-01 07:21:09 +00:00
|
|
|
),
|
2022-09-21 07:14:44 +00:00
|
|
|
geographical_data=models.Cases(),
|
2020-11-12 20:21:02 +00:00
|
|
|
)
|
2021-08-25 07:58:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
2023-12-12 10:58:19 +00:00
|
|
|
def exposure_model_w_outside_temp_changes(data_registry, baseline_exposure_model: models.ExposureModel):
|
2024-06-20 08:14:38 +00:00
|
|
|
exp_model = caimira.calculator.models.dataclass_utils.nested_replace(
|
2021-08-25 07:58:45 +00:00
|
|
|
baseline_exposure_model, {
|
|
|
|
|
'concentration_model.ventilation': models.SlidingWindow(
|
2023-11-29 07:54:58 +00:00
|
|
|
data_registry=data_registry,
|
2021-08-25 08:25:48 +00:00
|
|
|
active=models.PeriodicInterval(2.2 * 60, 1.8 * 60),
|
2024-06-20 08:14:38 +00:00
|
|
|
outside_temp=caimira.calculator.models.data.GenevaTemperatures['Jan'],
|
2021-08-25 07:58:45 +00:00
|
|
|
window_height=1.6,
|
|
|
|
|
opening_length=0.6,
|
|
|
|
|
)
|
|
|
|
|
})
|
|
|
|
|
return exp_model
|