fixed error with f_inf (short-range)

This commit is contained in:
lrdossan 2024-06-07 18:19:38 +02:00
parent e1a94b9067
commit 7cb762ec1f
3 changed files with 11 additions and 9 deletions

View file

@ -1428,7 +1428,8 @@ class ShortRangeModel:
Virus short-range exposure concentration, as a function of time.
"""
return (self._normed_concentration(concentration_model, time) *
concentration_model.virus.viral_load_in_sputum)
concentration_model.virus.viral_load_in_sputum *
concentration_model.virus.viable_to_RNA_ratio)
@method_cache
def _normed_short_range_concentration_cached(self, concentration_model: ConcentrationModel, time: float) -> _VectorisedFloat:
@ -1693,7 +1694,6 @@ class ExposureModel:
self.exposed.activity.inhalation_rate *
(1 - self.exposed.mask.inhale_efficiency()))
# In the end we multiply the final results by the fraction of infectious virus of the vD equation.
return deposited_exposure
def deposited_exposure_between_bounds(self, time1: float, time2: float) -> _VectorisedFloat:
@ -1744,8 +1744,9 @@ class ExposureModel:
# Then we multiply by diameter-independent quantities: viral load
# and fraction of infected virions
deposited_exposure *= (
self.concentration_model.virus.viral_load_in_sputum
* (1 - self.exposed.mask.inhale_efficiency()))
self.concentration_model.virus.viral_load_in_sputum *
self.concentration_model.virus.viable_to_RNA_ratio *
(1 - self.exposed.mask.inhale_efficiency()))
# Long-range concentration
deposited_exposure += self.long_range_deposited_exposure_between_bounds(time1, time2)

View file

@ -106,9 +106,9 @@ def test_extract_between_bounds(short_range_model, time1, time2,
@pytest.mark.parametrize(
"time, expected_short_range_concentration", [
[8.5, 0.],
[10.5, 11.266605],
[10.6, 11.266605],
[11.0, 11.266605],
[10.5, 5.6333025],
[10.6, 5.6333025],
[11.0, 5.6333025],
[12.0, 0.],
]
)

View file

@ -263,6 +263,7 @@ class SimpleShortRangeModel:
we perform the integral of Np(d)*V(d) over diameter analytically
"""
vl = conc_model.viral_load
viable_to_RNA = conc_model.viable_to_RNA
dmin = self.diameter_min
dmax = self.diameter_max
result = 0.
@ -273,7 +274,7 @@ class SimpleShortRangeModel:
ymax = (np.log(dmax)-mu)/(sqrt2*sigma)-3.*sigma/sqrt2
result += ( (cn * famp * d0**3)/2. * np.exp(9*sigma**2/2.) *
(erf(ymax) - erf(ymin)) )
return vl * 1e-6 * result * np.pi/6.
return vl * viable_to_RNA * 1e-6 * result * np.pi/6.
def concentration(self, conc_model: SimpleConcentrationModel, time: float) -> _VectorisedFloat:
"""
@ -430,7 +431,7 @@ class SimpleExposureModel(SimpleConcentrationModel):
res = (quad(integrand,
sr_model.diameter_min,sr_model.diameter_max,
epsabs=0.,limit=500)[0]
* self.viral_load * 1e-6 * (t2-t1) )
* self.viral_load * self.viable_to_RNA * 1e-6 * (t2-t1) )
result += sr_model.breathing_rate * (
res-self.integrated_longrange_concentration(t1,t2,evaporation)
)/sr_model.dilution_factor()