updated background_concentration name to min_background_concentration
This commit is contained in:
parent
2043f34b69
commit
e59d4b3d59
3 changed files with 21 additions and 20 deletions
|
|
@ -78,8 +78,8 @@ The estimate of the concentration of virus-laden particles in a given room is ba
|
|||
* **Box 2** - short-range exposure: also known as the *exhaled jet* concentration in close-proximity, corresponds to the exposure of airborne virions where the susceptible (exposed) host is distanced between 0.5 and 2 m from an infected host, considering the result of a two-stage exhaled jet model.
|
||||
|
||||
Note that most of the methods used to calculate the concentration are defined in the superclass :meth:`caimira.models._ConcentrationModelBase`, while the specific methods for the long-range virus concentration are part of the subclass :meth:`caimira.models.ConcentrationModel`.
|
||||
The specific removal rate, background concentration and normalization factors will depend on what concentration is being calculated (e.g. viral concentration or CO\ :sub:`2` concentration) and are respectively defined in :meth:`caimira.models._ConcentrationModelBase.removal_rate`,
|
||||
:meth:`caimira.models._ConcentrationModelBase.background_concentration` and :meth:`caimira.models._ConcentrationModelBase.normalization_factor`.
|
||||
The specific removal rate, minimum background concentration and normalization factors will depend on what concentration is being calculated (e.g. viral concentration or CO\ :sub:`2` concentration) and are respectively defined in :meth:`caimira.models._ConcentrationModelBase.removal_rate`,
|
||||
:meth:`caimira.models._ConcentrationModelBase.min_background_concentration` and :meth:`caimira.models._ConcentrationModelBase.normalization_factor`.
|
||||
|
||||
Long-range approach
|
||||
*******************
|
||||
|
|
@ -318,7 +318,7 @@ Note that in order to calculate the CO\ :sub:`2` concentration one should use th
|
|||
A fraction of 4.2% of the exhalation rate of the defined activity was considered as the supplied to the room (:meth:`caimira.models.CO2ConcentrationModel.CO2_fraction_exhaled`).
|
||||
|
||||
Since the CO\ :sub:`2` concentration differs from the virus concentration, the specific removal rate, CO\ :sub:`2` atmospheric concentration and normalization factors are respectively defined in :meth:`caimira.models.CO2ConcentrationModel.removal_rate`,
|
||||
:meth:`caimira.models.CO2ConcentrationModel.background_concentration` and :meth:`caimira.models.CO2ConcentrationModel.normalization_factor`.
|
||||
:meth:`caimira.models.CO2ConcentrationModel.min_background_concentration` and :meth:`caimira.models.CO2ConcentrationModel.normalization_factor`.
|
||||
|
||||
.. _caimira-uml-diagram:
|
||||
|
||||
|
|
|
|||
|
|
@ -978,10 +978,11 @@ class _ConcentrationModelBase:
|
|||
"""
|
||||
raise NotImplementedError("Subclass must implement")
|
||||
|
||||
def background_concentration(self) -> _VectorisedFloat:
|
||||
def min_background_concentration(self) -> _VectorisedFloat:
|
||||
"""
|
||||
Background concentration in the scenario
|
||||
(in the same unit as the concentration)
|
||||
Minimum background concentration in the room for a given scenario
|
||||
(in the same unit as the concentration). Its the value towards which
|
||||
the concentration will decay to.
|
||||
"""
|
||||
return 0.
|
||||
|
||||
|
|
@ -1005,11 +1006,11 @@ class _ConcentrationModelBase:
|
|||
dependence has been solved for.
|
||||
"""
|
||||
if not self.population.person_present(time):
|
||||
return self.background_concentration()/self.normalization_factor()
|
||||
return self.min_background_concentration()/self.normalization_factor()
|
||||
V = self.room.volume
|
||||
RR = self.removal_rate(time)
|
||||
|
||||
return (1. / (RR * V) + self.background_concentration()/
|
||||
return (1. / (RR * V) + self.min_background_concentration()/
|
||||
self.normalization_factor())
|
||||
|
||||
@method_cache
|
||||
|
|
@ -1081,7 +1082,7 @@ class _ConcentrationModelBase:
|
|||
# The model always starts at t=0, but we avoid running concentration calculations
|
||||
# before the first presence as an optimisation.
|
||||
if time <= self._first_presence_time():
|
||||
return self.background_concentration()/self.normalization_factor()
|
||||
return self.min_background_concentration()/self.normalization_factor()
|
||||
next_state_change_time = self._next_state_change(time)
|
||||
RR = self.removal_rate(next_state_change_time)
|
||||
conc_limit = self._normed_concentration_limit(next_state_change_time)
|
||||
|
|
@ -1111,7 +1112,7 @@ class _ConcentrationModelBase:
|
|||
normalized by normalization_factor.
|
||||
"""
|
||||
if stop <= self._first_presence_time():
|
||||
return (stop - start)*self.background_concentration()/self.normalization_factor()
|
||||
return (stop - start)*self.min_background_concentration()/self.normalization_factor()
|
||||
state_change_times = self.state_change_times()
|
||||
req_start, req_stop = start, stop
|
||||
total_normed_concentration = 0.
|
||||
|
|
@ -1206,7 +1207,7 @@ class CO2ConcentrationModel(_ConcentrationModelBase):
|
|||
def removal_rate(self, time: float) -> _VectorisedFloat:
|
||||
return self.ventilation.air_exchange(self.room, time)
|
||||
|
||||
def background_concentration(self) -> _VectorisedFloat:
|
||||
def min_background_concentration(self) -> _VectorisedFloat:
|
||||
"""
|
||||
Background CO2 concentration in the atmosphere (in ppm)
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ class KnownConcentrationModelBase(models._ConcentrationModelBase):
|
|||
|
||||
known_removal_rate: float
|
||||
|
||||
known_background_concentration: float
|
||||
known_min_background_concentration: float
|
||||
|
||||
known_normalization_factor: float
|
||||
|
||||
|
|
@ -29,8 +29,8 @@ class KnownConcentrationModelBase(models._ConcentrationModelBase):
|
|||
def removal_rate(self, time: float) -> float:
|
||||
return self.known_removal_rate
|
||||
|
||||
def background_concentration(self) -> float:
|
||||
return self.known_background_concentration
|
||||
def min_background_concentration(self) -> float:
|
||||
return self.known_min_background_concentration
|
||||
|
||||
def normalization_factor(self) -> float:
|
||||
return self.known_normalization_factor
|
||||
|
|
@ -180,7 +180,7 @@ def test_integrated_concentration(simple_conc_model):
|
|||
|
||||
|
||||
@pytest.mark.parametrize([
|
||||
"known_background_concentration",
|
||||
"known_min_background_concentration",
|
||||
"expected_normed_integrated_concentration"],
|
||||
[
|
||||
[0.0, 0.00018533333708996207],
|
||||
|
|
@ -193,7 +193,7 @@ def test_integrated_concentration(simple_conc_model):
|
|||
def test_normed_integrated_concentration_with_background_concentration(
|
||||
simple_conc_model: models.ConcentrationModel,
|
||||
dummy_population: models.Population,
|
||||
known_background_concentration: float,
|
||||
known_min_background_concentration: float,
|
||||
expected_normed_integrated_concentration: float):
|
||||
|
||||
known_conc_model = KnownConcentrationModelBase(
|
||||
|
|
@ -201,14 +201,14 @@ def test_normed_integrated_concentration_with_background_concentration(
|
|||
ventilation = simple_conc_model.ventilation,
|
||||
known_population = dummy_population,
|
||||
known_removal_rate = 100.,
|
||||
known_background_concentration = known_background_concentration,
|
||||
known_min_background_concentration = known_min_background_concentration,
|
||||
known_normalization_factor = 10.)
|
||||
npt.assert_almost_equal(known_conc_model.normed_integrated_concentration(0, 2), expected_normed_integrated_concentration)
|
||||
|
||||
|
||||
@pytest.mark.parametrize([
|
||||
"known_removal_rate",
|
||||
"known_background_concentration",
|
||||
"known_min_background_concentration",
|
||||
"known_normalization_factor",
|
||||
"expected_normed_integrated_concentration"],
|
||||
[
|
||||
|
|
@ -223,7 +223,7 @@ def test_normed_integrated_concentration_vectorisation(
|
|||
simple_conc_model: models.ConcentrationModel,
|
||||
dummy_population: models.Population,
|
||||
known_removal_rate: float,
|
||||
known_background_concentration: float,
|
||||
known_min_background_concentration: float,
|
||||
known_normalization_factor: float,
|
||||
expected_normed_integrated_concentration: float):
|
||||
|
||||
|
|
@ -232,7 +232,7 @@ def test_normed_integrated_concentration_vectorisation(
|
|||
ventilation = simple_conc_model.ventilation,
|
||||
known_population = dummy_population,
|
||||
known_removal_rate = known_removal_rate,
|
||||
known_background_concentration = known_background_concentration,
|
||||
known_min_background_concentration = known_min_background_concentration,
|
||||
known_normalization_factor = known_normalization_factor)
|
||||
|
||||
integrated_concentration = known_conc_model.normed_integrated_concentration(0, 2)
|
||||
|
|
|
|||
Loading…
Reference in a new issue