From a24e4fd73eb411ef77411e02c8ba91dc2f84fd9c Mon Sep 17 00:00:00 2001 From: "CERN\\Andrejh" Date: Thu, 9 Jun 2022 16:50:23 +0200 Subject: [PATCH 1/3] update docstring --- cara/models.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/cara/models.py b/cara/models.py index 42695ca5..1dc6cb5f 100644 --- a/cara/models.py +++ b/cara/models.py @@ -635,7 +635,7 @@ class _ExpirationBase: def aerosols(self, mask: Mask): """ - Total volume of aerosols expired per volume of air (mL/cm^3). + Total volume of aerosols expired per volume of exhaled air (mL/cm^3). """ raise NotImplementedError("Subclass must implement") @@ -670,7 +670,10 @@ class Expiration(_ExpirationBase): @cached() def aerosols(self, mask: Mask): - """ Result is in mL.cm^-3 """ + """ + Total volume of aerosols expired per volume of exhaled air. + Result is in mL.cm^-3 + """ def volume(d): return (np.pi * d**3) / 6. @@ -791,14 +794,15 @@ class _PopulationWithVirus(Population): def aerosols(self): """ - Total volume of aerosols expired per volume of air (mL/cm^3). + Total volume of aerosols expired per volume of exhaled air (mL/cm^3). """ raise NotImplementedError("Subclass must implement") def emission_rate_per_aerosol_when_present(self) -> _VectorisedFloat: """ - The emission rate of virions per fraction of aerosol volume in - the expired air, if the infected population is present, in cm^3/(mL.h). + The emission rate of virions in the expired air per aerosol volume, + if the infected population is present, in (virion.cm^3)/(mL.h). + This method includes the diameter-independent variables of the emission rate. It should not be a function of time. """ raise NotImplementedError("Subclass must implement") @@ -845,7 +849,7 @@ class EmittingPopulation(_PopulationWithVirus): def aerosols(self): """ - Total volume of aerosols expired per volume of air (mL/cm^3). + Total volume of aerosols expired per volume of exhaled air (mL/cm^3). Here arbitrarily set to 1 as the full emission rate is known. """ return 1. @@ -853,8 +857,9 @@ class EmittingPopulation(_PopulationWithVirus): @method_cache def emission_rate_per_aerosol_when_present(self) -> _VectorisedFloat: """ - The emission rate of virions per fraction of aerosol volume in - the expired air, if the infected population is present, in cm^3/(mL.h). + The emission rate of virions in the expired air per aerosol volume, + if the infected population is present, in (virion.cm^3)/(mL.h). + This method includes the diameter-independent variables of the emission rate. It should not be a function of time. """ return self.known_individual_emission_rate * self.number @@ -874,18 +879,20 @@ class InfectedPopulation(_PopulationWithVirus): def aerosols(self): """ - Total volume of aerosols expired per volume of air (mL/cm^3). + Total volume of aerosols expired per volume of exhaled air (mL/cm^3). """ return self.expiration.aerosols(self.mask) @method_cache def emission_rate_per_aerosol_when_present(self) -> _VectorisedFloat: """ - The emission rate of virions per fraction of aerosol volume in - the expired air, if the infected population is present, in cm^3/(mL.h). + The emission rate of virions in the expired air per aerosol volume, + if the infected population is present, in (virion.cm^3)/(mL.h). + This method includes the diameter-independent variables of the emission rate. It should not be a function of time. """ # Note on units: exhalation rate is in m^3/h -> 1e6 conversion factor + # returns the results of ER times the 'numeber' of infected hosts in the room ER = (self.virus.viral_load_in_sputum * self.activity.exhalation_rate * From 1823aed6175f16af30b20c1143f3781b5ae04218 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Fri, 10 Jun 2022 09:32:33 +0200 Subject: [PATCH 2/3] Adde missing retry decorator --- cara/tests/test_sampleable_distribution.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cara/tests/test_sampleable_distribution.py b/cara/tests/test_sampleable_distribution.py index 162f2e88..76544b35 100644 --- a/cara/tests/test_sampleable_distribution.py +++ b/cara/tests/test_sampleable_distribution.py @@ -1,10 +1,12 @@ import numpy as np import numpy.testing as npt import pytest +from retry import retry from cara.monte_carlo import sampleable +@retry(tries=10) @pytest.mark.parametrize( "mean, std",[ [1., 0.5], From eb39f628d8c484e73f4c1bc0238dfdfc466137d4 Mon Sep 17 00:00:00 2001 From: "CERN\\Andrejh" Date: Fri, 10 Jun 2022 09:49:26 +0200 Subject: [PATCH 3/3] update docstring --- cara/models.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cara/models.py b/cara/models.py index 1dc6cb5f..49f94efc 100644 --- a/cara/models.py +++ b/cara/models.py @@ -800,9 +800,9 @@ class _PopulationWithVirus(Population): def emission_rate_per_aerosol_when_present(self) -> _VectorisedFloat: """ - The emission rate of virions in the expired air per aerosol volume, + The emission rate of virions in the expired air per mL of respiratory fluid, if the infected population is present, in (virion.cm^3)/(mL.h). - This method includes the diameter-independent variables of the emission rate. + This method includes only the diameter-independent variables within the emission rate. It should not be a function of time. """ raise NotImplementedError("Subclass must implement") @@ -857,9 +857,9 @@ class EmittingPopulation(_PopulationWithVirus): @method_cache def emission_rate_per_aerosol_when_present(self) -> _VectorisedFloat: """ - The emission rate of virions in the expired air per aerosol volume, + The emission rate of virions in the expired air per mL of respiratory fluid, if the infected population is present, in (virion.cm^3)/(mL.h). - This method includes the diameter-independent variables of the emission rate. + This method includes only the diameter-independent variables within the emission rate. It should not be a function of time. """ return self.known_individual_emission_rate * self.number @@ -886,13 +886,13 @@ class InfectedPopulation(_PopulationWithVirus): @method_cache def emission_rate_per_aerosol_when_present(self) -> _VectorisedFloat: """ - The emission rate of virions in the expired air per aerosol volume, + The emission rate of virions in the expired air per mL of respiratory fluid, if the infected population is present, in (virion.cm^3)/(mL.h). - This method includes the diameter-independent variables of the emission rate. + This method includes only the diameter-independent variables within the emission rate. It should not be a function of time. """ # Note on units: exhalation rate is in m^3/h -> 1e6 conversion factor - # returns the results of ER times the 'numeber' of infected hosts in the room + # Returns the emission rate times the number of infected hosts in the room ER = (self.virus.viral_load_in_sputum * self.activity.exhalation_rate *