From d1ec9902556e88d91df7e13ac0914abc01e03d77 Mon Sep 17 00:00:00 2001 From: Nicolas Mounet Date: Sun, 12 Sep 2021 13:05:17 +0200 Subject: [PATCH] Remove suprespreading event from the expiration types; replace by an optional parameter to fix directly the emission rate; updates the corresponding tests --- cara/models.py | 21 ++++++++++++++----- .../apps/calculator/test_model_generator.py | 4 ++-- cara/tests/test_monte_carlo_full_models.py | 5 ++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/cara/models.py b/cara/models.py index 498308d3..d7f67d49 100644 --- a/cara/models.py +++ b/cara/models.py @@ -630,12 +630,14 @@ class MultipleExpiration(_ExpirationBase): ]).sum(axis=0) +# Typical expirations. The aerosol diameter given is an equivalent +# diameter, chosen in such a way that the aerosol volume is +# the same as the total aerosol volume given by the full BLO model. _ExpirationBase.types = { - 'Breathing': Expiration((1., 0., 0.), 1.3844), - 'Talking': Expiration((1., 1., 1.), 5.8925), - 'Shouting': Expiration((1., 5., 5.), 10.0411), - 'Singing': Expiration((1., 5., 5.), 10.0411), - 'Superspreading event': Expiration((np.inf, 0., 0.), 10.0411), + 'Breathing': Expiration((1., 0., 0.)), + 'Talking': Expiration((1., 1., 1.)), + 'Shouting': Expiration((1., 5., 5.)), + 'Singing': Expiration((1., 5., 5.)), } @@ -688,6 +690,15 @@ class _PopulationWithVirus(Population): #: The virus with which the population is infected. virus: Virus + #: The type of expiration that is being emitted whilst doing the activity. + expiration: _ExpirationBase + + #: Optionally, this provides directly the emission rate of a single individual, + # in units of virions * virus.infectious_dose / h (i.e. it is + # multiplied by the virus infectious dose, to get virions / h)) + # This effectively overrides the "expiration" parameter. + known_individual_emission_rate: float = np.nan + @method_cache def emission_rate_when_present(self) -> _VectorisedFloat: """ diff --git a/cara/tests/apps/calculator/test_model_generator.py b/cara/tests/apps/calculator/test_model_generator.py index 6ee821c0..432790fb 100644 --- a/cara/tests/apps/calculator/test_model_generator.py +++ b/cara/tests/apps/calculator/test_model_generator.py @@ -27,8 +27,8 @@ def test_blend_expiration(): r = model_generator.build_expiration(blend) mask = models.Mask.types['Type I'] expected = models.Expiration( - (0.13466666666666668, 0.02866666666666667, 0.004333333333333334, 0.005) - ) + (0.13466666666666668, 0.02866666666666667, 0.004333333333333334), + 2.5) npt.assert_almost_equal(r.aerosols(mask), expected.aerosols(mask)) diff --git a/cara/tests/test_monte_carlo_full_models.py b/cara/tests/test_monte_carlo_full_models.py index 08bd2dad..f153d389 100644 --- a/cara/tests/test_monte_carlo_full_models.py +++ b/cara/tests/test_monte_carlo_full_models.py @@ -218,7 +218,10 @@ def skagit_chorale_mc(): presence=mc.SpecificInterval(((0., 2.5),)), mask=models.Mask.types["No mask"], activity=activity_distributions['Light activity'], - expiration=models.Expiration((5., 5., 5.)), + expiration=models.Expiration((5., 5., 5.), 10.0761), + # The aerosol diameter given (10.0761 microns) is an equivalent + # diameter, chosen in such a way that the aerosol volume is + # the same as the total aerosol volume given by the full BLO model. ), ) return mc.ExposureModel(