diff --git a/cara/models.py b/cara/models.py index 1adb810e..65f820e9 100644 --- a/cara/models.py +++ b/cara/models.py @@ -461,8 +461,8 @@ class SARSCoV2(Virus): """ # Updated to use the formula from Dabish et al. https://doi.org/10.1080/02786826.2020.1829536 # with a minimum at hl = 1.1 - inside_temp = inside_temp.value(time) - return max(1.1, (0.693/(0.16030 + 0.04018*(((inside_temp-273.15)-20.615)/10.585)+0.02176*((humidity-45.235)/28.665)+0.1))) + temperature: _VectorisedFloat = inside_temp.value(time) + return np.maximum(1.1, (0.693/(0.16030 + 0.04018*(((temperature-273.15)-20.615)/10.585)+0.02176*((humidity-45.235)/28.665)+0.1))) Virus.types = { diff --git a/cara/tests/models/test_concentration_model.py b/cara/tests/models/test_concentration_model.py index 3b1d9292..ea11a005 100644 --- a/cara/tests/models/test_concentration_model.py +++ b/cara/tests/models/test_concentration_model.py @@ -59,7 +59,7 @@ def test_concentration_model_vectorisation(override_params): def simple_conc_model(): interesting_times = models.SpecificInterval(([0.5, 1.], [1.1, 2], [2., 3.]), ) return models.ConcentrationModel( - models.Room(75), + models.Room(75, models.PiecewiseConstant((0., 24.), (293,))), models.AirChange(interesting_times, 100), models.InfectedPopulation( number=1, diff --git a/cara/tests/models/test_exposure_model.py b/cara/tests/models/test_exposure_model.py index abc476d0..428de12d 100644 --- a/cara/tests/models/test_exposure_model.py +++ b/cara/tests/models/test_exposure_model.py @@ -152,7 +152,7 @@ def conc_model(): ) always = models.SpecificInterval(((0., 24.), )) return models.ConcentrationModel( - models.Room(25), + models.Room(25, models.PiecewiseConstant((0., 24.), (293,))), models.AirChange(always, 5), models.EmittingPopulation( number=1, @@ -179,12 +179,12 @@ def sr_model(): @pytest.mark.parametrize( ["exposed_time_interval", "expected_deposited_exposure"], [ - [(0., 1.), 48.19316], - [(1., 1.01), 0.566368], - [(1.01, 1.02), 0.551401], - [(12., 12.01), 0.016278], - [(12., 24.), 691.21381], - [(0., 24.), 750.258043], + [(0., 1.), 48.193159880096644], + [(1., 1.01), 0.5663683904832492], + [(1.01, 1.02), 0.5514013220457682], + [(12., 12.01), 0.016277647772557004], + [(12., 24.), 691.2138099188268], + [(0., 24.), 750.2580429542696], ] ) def test_exposure_model_integral_accuracy(exposed_time_interval,