From acdd22cb07ef132746e6cdb76028aecb3eb52736 Mon Sep 17 00:00:00 2001 From: Nicolas Mounet Date: Tue, 14 Sep 2021 11:11:13 +0200 Subject: [PATCH] Bugs fixed in monte_carlo/data.py; updating ExposureModel for diameter dependent exposure --- cara/models.py | 2 +- cara/monte_carlo/data.py | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cara/models.py b/cara/models.py index 8dbd0e90..dd797ba2 100644 --- a/cara/models.py +++ b/cara/models.py @@ -923,7 +923,7 @@ class ExposureModel: def exposure(self) -> _VectorisedFloat: """The number of virus per meter^3.""" - return (self._normed_exposure() * + return (np.array(self._normed_exposure()).mean() * self.concentration_model.infected.emission_rate_when_present()) def infection_probability(self) -> _VectorisedFloat: diff --git a/cara/monte_carlo/data.py b/cara/monte_carlo/data.py index 355d302d..09dd50d2 100644 --- a/cara/monte_carlo/data.py +++ b/cara/monte_carlo/data.py @@ -1,4 +1,8 @@ +from dataclasses import dataclass +import typing + import numpy as np +from scipy import special as sp import cara.monte_carlo as mc from cara.monte_carlo.sampleable import Normal,LogNormal,LogCustomKernel,CustomKernel,Uniform @@ -138,10 +142,14 @@ mask_distributions = { def expiration_distribution(BLO_factors: typing.Tuple[float, float, float]): """ Returns an Expiration with an aerosol diameter distribution, defined - by the BLO factors + by the BLO factors. + Note: integration boundaries for normalization are chosen as 0.1 and + 30 microns respectively - this is an historical choice based on + previous implementations of the model (it limits the influence of + the O-mode). """ return mc.Expiration(CustomKernel(dscan, - BLOmodel(BLO_factors).normalized_distribution(dscan), + BLOmodel(BLO_factors).normalized_distribution(dscan, 0.1, 30.), kernel_bandwidth=0.1))