From 427934f4d45b8069755b836d9503de1ddc3e3a8e Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Wed, 22 Jun 2022 15:37:36 +0200 Subject: [PATCH 1/3] Handled typos on equations syntax --- cara/docs/full_diameter_dependence.rst | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/cara/docs/full_diameter_dependence.rst b/cara/docs/full_diameter_dependence.rst index 05feaa3c..413192cc 100644 --- a/cara/docs/full_diameter_dependence.rst +++ b/cara/docs/full_diameter_dependence.rst @@ -45,7 +45,7 @@ Under the :mod:`cara.apps.calculator.model_generator`, when it comes to generate To summarize, the Expiration contains the distribution of the diameters as a vectorised float. Depending on different expiratory types, the contributions from each mode will be different, therefore the result in the distribution also differs from model to model. Emission Rate - :math:`\mathrm{vR}(D)` -===================== +====================================== The mathematical equations to calculate :math:`\mathrm{vR}(D)` are defined in the paper (Henriques A et al, Modelling airborne transmission of SARS-CoV-2 using CARA: risk assessment for enclosed spaces. @@ -61,15 +61,14 @@ since :math:`\mathrm{vR}(D)` is a diameter-dependent quantity. :math:`E_{c, j}` In the code, for a given Expiration, we use different methods to perform the calculations *set-by-step*: 1. Calculate the non aerosol-dependent quantities in the emission rate, which is the multiplication of the diameter-**independent** variables: :meth:`cara.models.InfectedPopulation.emission_rate_per_aerosol_when_present`. This corresponds to the :math:`\mathrm{vl_{in}} \cdot \mathrm{BR_{k}}` part of the :math:`\mathrm{vR}(D)` equation. -2. Calculate the diameter-**dependent** variable :meth:`cara.models.InfectedPopulation.aerosols`, which is the result of :math:`E_{c,j}(D) = N_p(D) \cdot V_p(D) \cdot (1 − η_\mathrm{out}(D))` (in mL/(m\ :sup:`3` \.µm)). -Note that this result is not integrated over the diameters at this stage, thus the units are still *'per aerosol diameter'*. -1. Calculate the full emission rate, which is the multiplication of the two previous methods, and corresponds to :math:`\mathrm{vR(D)}`: :meth:`cara.models._PopulationWithVirus.emission_rate_when_present` +2. Calculate the diameter-**dependent** variable :meth:`cara.models.InfectedPopulation.aerosols`, which is the result of :math:`E_{c,j}(D) = N_p(D) \cdot V_p(D) \cdot (1 − η_\mathrm{out}(D))` (in mL/(m\ :sup:`3` \.µm)). Note that this result is not integrated over the diameters at this stage, thus the units are still *'per aerosol diameter'*. +3. Calculate the full emission rate, which is the multiplication of the two previous methods, and corresponds to :math:`\mathrm{vR(D)}`: :meth:`cara.models._PopulationWithVirus.emission_rate_when_present`. Note that the diameter-dependence is kept at this stage. Since other parameters downstream in code are also diameter-dependent, the Monte-Carlo integration over the aerosol sizes is computed at the level of the dose :math:`\mathrm{vD^{total}}`. In case one would like to have intermediate results for emission rate, perform the Monte-Carlo integration of :math:`E_{c, j}^{\mathrm{total}}` and compute :math:`\mathrm{vR^{total}} =\mathrm{vl_{in}} \cdot E_{c, j}^{\mathrm{total}} \cdot \mathrm{BR_k}` -Concentration - C(t, D) -======================= +Concentration - :math:`C(t, D)` +=============================== Long-range approach ******************* @@ -78,8 +77,8 @@ Starting with the long-range concentration of virus-laden aerosols of a given si :math:`C(t, D)=\frac{\mathrm{vR}(D) \cdot N_{\mathrm{inf}}}{\lambda_{\mathrm{vRR}}(D) \cdot V_r}-\left (\frac{\mathrm{vR}(D) \cdot N_{\mathrm{inf}}}{\lambda_{\mathrm{vRR}}(D) \cdot V_r}-C_0(D) \right )e^{-\lambda_{\mathrm{vRR}}(D)t}` , -where **emission rate vR(D)** and **viral removal rate** :math:`\lambda_{\mathrm{vRR}}` (:meth: `infectious_virus_removal_rate`) are diameter-dependent. -Since the emission rate is, in turn, dependent on other diameter-independent variables (:math:`\mathrm{vl}_\mathrm{in}` and :math:`\mathrm{BR}_k``) that should not be included when calculating the integral, the concentration method was written to be normalized by the emission rate. +where **emission rate** - :math:`\mathrm{vR(D)}` - and **viral removal rate** - :math:`\lambda_{\mathrm{vRR}}` (:meth:`infectious_virus_removal_rate`) are diameter-dependent. +Since the emission rate is, in turn, dependent on other diameter-independent variables (:math:`\mathrm{vl_{in}}` and :math:`\mathrm{BR}_k`) that should not be included when calculating the integral, the concentration method was written to be normalized by the emission rate. In other words, we can split the concentration in two different formulations: @@ -101,7 +100,7 @@ The following methods calculate the integrated concentration between any two tim .. Note that the integral over the diameters is performed later in the dose, with the average of the samples, since the diameters are sampled according to the distribution given by **Np(D)**. The integral over different times is calculated directly in the class (integrated methods). Dose - :math:`\mathrm{vD}` -********* +************************** The term “dose” refers to the number of viable virions that will contribute to a potential infection. @@ -158,7 +157,7 @@ In the code, :meth:`cara.models.Expiration.jet_origin_concentration` computes th When calculating the dose, we get the concentration normalized by the **viral load** and **breathing rate**, and without the **dilution factor**, since these parameters are Monte-Carlo variables that do not depend on the diameter. Concentration - :math:`C(t, D)` -*********************** +******************************* The short-range concentration close to the mouth or nose of an exposed person, may be written as: @@ -182,7 +181,7 @@ The method :meth:`cara.models.ShortRangeModel.short_range_concentration` applies The final concentration is the sum of the `short-range` and `long-range` concentrations. Dose - :math:`vD` -********* +***************** In theory, the `short-range` dose is defined as follows: From 6a9f3071f3a7d5b2e5f488eb624f16600dae34aa Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Thu, 23 Jun 2022 09:56:03 +0100 Subject: [PATCH 2/3] Missed \cdot reference on equation --- cara/docs/full_diameter_dependence.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cara/docs/full_diameter_dependence.rst b/cara/docs/full_diameter_dependence.rst index 413192cc..b2c32cfc 100644 --- a/cara/docs/full_diameter_dependence.rst +++ b/cara/docs/full_diameter_dependence.rst @@ -207,7 +207,7 @@ To perform the integral, we calculate the average since it is a good approximati Then, we add the contribution to the result of the diameter-independent vectorized properties, which are the **dilution factor**, **viral load**, **fraction of infectious virus** and **breathing rate**: -`vD = integral_over_diameters . exhalation_rate . inhalation_rate / dilution` :math:`\cdot f_{\mathrm{inf}} \cdot \mathrm{vl_{in}} \cdot (1 - η_{\mathrm{in}})` . +`vD = integral_over_diameters \cdot exhalation_rate \cdot inhalation_rate / dilution` :math:`\cdot f_{\mathrm{inf}} \cdot \mathrm{vl_{in}} \cdot (1 - η_{\mathrm{in}})` . Note that the multiplication over the `exhalation_rate` is done at each `short-range` interaction since the `Activity` type may be different for different interactions. From 2a06c82efad3c7d77b75dd053eb0bca9249047d5 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Thu, 23 Jun 2022 10:57:54 +0100 Subject: [PATCH 3/3] Handled numpy update --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 324c1f00..49232333 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ REQUIREMENTS: dict = { 'matplotlib', 'memoization', 'mistune', - 'numpy', + 'numpy != 1.23', 'psutil', 'python-dateutil', 'scipy',