changed variable name in report_generator and added a retry decorator in test
This commit is contained in:
parent
a61b88ce1b
commit
9032a8815d
3 changed files with 7 additions and 6 deletions
|
|
@ -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,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue