From 646b005baa0e218f9f249b4663dd7783d5f40900 Mon Sep 17 00:00:00 2001 From: markus Date: Wed, 24 Feb 2021 13:18:20 +0100 Subject: [PATCH] fix compare_concentration_curves --- cara/montecarlo.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cara/montecarlo.py b/cara/montecarlo.py index 7f72b870..2cf996f6 100644 --- a/cara/montecarlo.py +++ b/cara/montecarlo.py @@ -1036,16 +1036,19 @@ def compare_concentration_curves(exp_models: typing.List[MCExposureModel], label times = np.arange(start, stop, TIME_STEP) - concentrations = [[np.mean(model.concentration_model.concentration(t)) for t in times] for model in exp_models] + concentrations = [[np.median(model.concentration_model.concentration(t)) for t in times] for model in exp_models] for c, label, color in zip(concentrations, labels, colors): plt.plot(times, c, label=label, color=color) plt.legend() + factors = [0.6 * model.exposed.activity.inhalation_rate * (1 - model.exposed.mask.η_inhale) for model in exp_models] + qds = [[np.trapz(c[:i + 1], times[:i + 1]) * factor for i in range(len(times))] + for c, factor in zip(concentrations, factors)] if show_qd: plt.twinx() - for c, label, color in zip(concentrations, labels, colors): - plt.plot(times, np.cumsum(c), label='qD - ' + label, color=color, linestyle='dotted') + for qd, label, color in zip(qds, labels, colors): + plt.plot(times, qd, label='qD - ' + label, color=color, linestyle='dotted') plt.legend() plt.show()