From 66ebf8a2bb449e69c88acefda601f7a894390e37 Mon Sep 17 00:00:00 2001 From: Luis Aleixo Date: Tue, 21 Sep 2021 17:16:01 +0200 Subject: [PATCH 1/2] Correct Cn values for B and L factors --- cara/monte_carlo/data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cara/monte_carlo/data.py b/cara/monte_carlo/data.py index 115020f6..ea6a2349 100644 --- a/cara/monte_carlo/data.py +++ b/cara/monte_carlo/data.py @@ -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. From cbb17e49501dd6e0c71f835152d1314fcc681dd6 Mon Sep 17 00:00:00 2001 From: Nicolas Mounet Date: Wed, 22 Sep 2021 08:55:39 +0200 Subject: [PATCH 2/2] Updating test_expiration_aerosols --- cara/tests/test_expiration.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/cara/tests/test_expiration.py b/cara/tests/test_expiration.py index 8a600086..93c5d4f4 100644 --- a/cara/tests/test_expiration.py +++ b/cara/tests/test_expiration.py @@ -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)