diff --git a/cara/models.py b/cara/models.py index b74cdcf2..95aabe08 100644 --- a/cara/models.py +++ b/cara/models.py @@ -221,11 +221,9 @@ class Expiration: def volume(diameter): return (4 * np.pi * (diameter/2)**3) / 3 total = 0 - for i, (diameter, factor) in enumerate(zip(self.particle_sizes, self.ejection_factor)): + for diameter, factor in zip(self.particle_sizes, self.ejection_factor): contribution = volume(diameter) * factor - if i >= 2: - # TODO: It is probably the case that this term comes from the - # particle diameter, rather than arbitrary position in a sequence... + if diameter >= 3e-4: contribution = contribution * (1 - mask.exhale_efficiency) total += contribution return total diff --git a/cara/tests/test_known_quantities.py b/cara/tests/test_known_quantities.py index 5a11e4ae..82c3ac71 100644 --- a/cara/tests/test_known_quantities.py +++ b/cara/tests/test_known_quantities.py @@ -139,3 +139,12 @@ def test_periodic_hepa(baseline_periodic_hepa, baseline_room): aes = [baseline_periodic_hepa.air_exchange(baseline_room, t) for t in ts] answers = [0, rate, rate, 0, 0, 0, rate, 0, 0] npt.assert_allclose(aes, answers, rtol=1e-5) + + +def test_expiration_aerosols(): + mask = models.Mask.types['Type I'] + exp1 = models.Expiration((0.751, 0.139, 0.0139, 0.059), + particle_sizes = (0.8e-4, 1.8e-4, 3.5e-4, 5.5e-4)) + exp2 = models.Expiration((0.059, 0.0139, 0.751, 0.139), + particle_sizes = (5.5e-4, 3.5e-4, 0.8e-4, 1.8e-4)) + npt.assert_allclose(exp1.aerosols(mask), exp2.aerosols(mask), rtol=1e-5)