Merge branch 'feature/BLO_data' into 'feature/scientific_model_update'

BLO particle concentration emission value update

See merge request cara/cara!253
This commit is contained in:
Nicolas Mounet 2021-09-22 09:06:50 +02:00
commit c2f2ca1bf6
2 changed files with 11 additions and 9 deletions

View file

@ -32,7 +32,7 @@ class BLOmodel:
#: cn (cm^-3) for resp. the B, L and O modes. Corresponds to the
# total concentration of aerosols for each mode.
cn: typing.Tuple[float, float, float] = (0.1, 1., 0.0010008)
cn: typing.Tuple[float, float, float] = (0.06, 0.2, 0.0010008)
# mean of the underlying normal distributions (represents the log of a
# diameter in microns), for resp. the B, L and O modes.

View file

@ -5,6 +5,7 @@ import numpy.testing as npt
import pytest
from cara import models
from cara.monte_carlo.data import expiration_distribution
def test_multiple_wrong_weight_size():
@ -40,16 +41,17 @@ def test_multiple():
npt.assert_almost_equal(aerosol_expected, e.aerosols(mask))
# expected values obtained from another code
# expected values obtained from analytical formulas
@pytest.mark.parametrize(
"expiration_type, expected_aerosols",
"BLO_weights, expected_aerosols",
[
['Breathing', 1.38924e-12],
['Talking', 1.07129e-10],
['Shouting', 5.30088e-10],
[(1.,0.,0.), 8.33551e-13],
[(1.,1.,1.), 2.20071e-11],
[(1.,5.,5.), 1.06701e-10],
],
)
def test_expiration_aerosols(expiration_type, expected_aerosols):
def test_expiration_aerosols(BLO_weights, expected_aerosols):
mask = models.Mask.types['No mask']
e = models._ExpirationBase.types[expiration_type]
npt.assert_allclose(e.aerosols(mask), expected_aerosols, rtol=1e-4)
e = expiration_distribution(BLO_weights)
npt.assert_allclose(e.build_model(100000).aerosols(mask).mean(),
expected_aerosols, rtol=1e-2)