Skip to content

Commit

Permalink
Merge branch 'feature/short_range_bug_fix_and_tests' into 'master'
Browse files Browse the repository at this point in the history
Adding breathing rate factor in short-range deposited exposure (bug fix), and exposure tests for short-range

See merge request cara/cara!345
  • Loading branch information
andrejhenriques committed Apr 7, 2022
2 parents 0b58d59 + 4dd5b8a commit c1589a0
Show file tree
Hide file tree
Showing 4 changed files with 352 additions and 53 deletions.
2 changes: 1 addition & 1 deletion cara/apps/calculator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# calculator version. If the calculator needs to make breaking changes (e.g. change
# form attributes) then it can also increase its MAJOR version without needing to
# increase the overall CARA version (found at ``cara.__version__``).
__version__ = "4.1.0"
__version__ = "4.1.1"


class BaseRequestHandler(RequestHandler):
Expand Down
37 changes: 26 additions & 11 deletions cara/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def halflife(self, humidity: _VectorisedFloat) -> _VectorisedFloat:
),
'SARS_CoV_2_OMICRON': SARSCoV2(
viral_load_in_sputum=1e9,
infectious_dose=20.,
infectious_dose=50.,
viable_to_RNA_ratio=0.5,
transmissibility_factor=0.2
),
Expand Down Expand Up @@ -1175,12 +1175,21 @@ def normed_exposure_between_bounds(self, concentration_model: ConcentrationModel
"""
start_bound, stop_bound = self.presence.boundaries()[0]

jet_origin_integrated = self.expiration.jet_origin_concentration()
jet_origin = self.expiration.jet_origin_concentration()
dilution = self.dilution_factor()

total_normed_concentration = -(concentration_model.integrated_concentration(start_bound, stop_bound)/concentration_model.virus.viral_load_in_sputum/dilution)
total_normed_concentration_interpolated = np.interp(self.expiration.particle.diameter, concentration_model.infected.particle.diameter, total_normed_concentration)
return (jet_origin_integrated/dilution * (stop_bound - start_bound)) + total_normed_concentration_interpolated
total_normed_concentration_diluted = (
concentration_model.integrated_concentration(start_bound,
stop_bound)/dilution/
concentration_model.virus.viral_load_in_sputum
)
total_normed_concentration_interpolated = np.interp(
self.expiration.particle.diameter,
concentration_model.infected.particle.diameter,
total_normed_concentration_diluted
)
return (jet_origin/dilution * (stop_bound - start_bound)
) - total_normed_concentration_interpolated


@dataclass(frozen=True)
Expand Down Expand Up @@ -1318,14 +1327,20 @@ def deposited_exposure_between_bounds(self, time1: float, time2: float) -> _Vect
# in the case of a single diameter or no diameter defined,
# one should not take any mean at this stage.
deposited_exposure += short_range_exposure*fdep

# then we multiply by the diameter-independent quantity virus viral load
deposited_exposure *= self.concentration_model.virus.viral_load_in_sputum
# long-range concentration

# multiply by the (diameter-independent) inhalation rate
deposited_exposure *= interaction.activity.inhalation_rate

# then we multiply by diameter-independent quantities: viral load
# and fraction of infected virions
f_inf = self.concentration_model.infected.fraction_of_infectious_virus()
deposited_exposure += self.long_range_deposited_exposure_between_bounds(time1, time2)/f_inf
deposited_exposure *= (f_inf
* self.concentration_model.virus.viral_load_in_sputum
)
# long-range concentration
deposited_exposure += self.long_range_deposited_exposure_between_bounds(time1, time2)

return deposited_exposure * f_inf
return deposited_exposure

def deposited_exposure(self) -> _VectorisedFloat:
"""
Expand Down
Loading

0 comments on commit c1589a0

Please sign in to comment.