diff --git a/caimira/apps/calculator/report_generator.py b/caimira/apps/calculator/report_generator.py index f171fe01..8f30876c 100644 --- a/caimira/apps/calculator/report_generator.py +++ b/caimira/apps/calculator/report_generator.py @@ -274,9 +274,9 @@ def manufacture_alternative_scenarios(form: FormData) -> typing.Dict[str, mc.Exp return scenarios -def scenario_statistics(mc_model: mc.ExposureModel, sample_times: typing.List[float], probabilistic_exposure: bool): +def scenario_statistics(mc_model: mc.ExposureModel, sample_times: typing.List[float], compute_prob_exposure: bool): model = mc_model.build_model(size=_DEFAULT_MC_SAMPLE_SIZE) - if (probabilistic_exposure): + if (compute_prob_exposure): # It means we have data to calculate the total_probability_rule prob_probabilistic_exposure = np.array(model.total_probability_rule()).mean() else: @@ -312,16 +312,16 @@ def comparison_report( statistics = {} if (form.short_range_option == "short_range_yes" and form.exposure_option == "p_probabilistic_exposure"): - probabilistic_exposure = True + compute_prob_exposure = True else: - probabilistic_exposure = False + compute_prob_exposure = False with executor_factory() as executor: results = executor.map( scenario_statistics, scenarios.values(), [sample_times] * len(scenarios), - [probabilistic_exposure] * len(scenarios), + [compute_prob_exposure] * len(scenarios), timeout=60, ) diff --git a/caimira/models.py b/caimira/models.py index 913487e9..92589a22 100644 --- a/caimira/models.py +++ b/caimira/models.py @@ -1475,7 +1475,7 @@ class ExposureModel: # The influence of a higher number of simultainious infected people (> 4 - 5) yields an almost negligible contirbution to the total probability. # To be on the safe side, a hard coded limit with a safety margin of 2x was set. # Therefore we decided a hard limit of 10 infected people. - for num_infected in range(1, max_num_infected): + for num_infected in range(1, max_num_infected + 1): exposure_model = nested_replace( self, {'concentration_model.infected.number': num_infected} ) diff --git a/caimira/tests/test_full_algorithm.py b/caimira/tests/test_full_algorithm.py index 0ef12fda..aea4151c 100644 --- a/caimira/tests/test_full_algorithm.py +++ b/caimira/tests/test_full_algorithm.py @@ -785,6 +785,7 @@ def test_concentration_with_shortrange(expo_sr_model,simple_expo_sr_model,time): ) +@retry(tries=10) def test_exposure_with_shortrange(expo_sr_model,simple_expo_sr_model): npt.assert_allclose( expo_sr_model.build_model(SAMPLE_SIZE).deposited_exposure().mean(),