Merge branch 'feature/report_error_pi_short_range' into 'master'

Fixed bug with short-range interactions

See merge request cara/cara!374
This commit is contained in:
Luis Aleixo 2022-07-05 13:50:40 +02:00
commit 1df90375fa
2 changed files with 12 additions and 8 deletions

View file

@ -286,18 +286,22 @@ def scenario_statistics(mc_model: mc.ExposureModel, sample_times: typing.List[fl
def comparison_report(
form: FormData,
report_data: typing.Dict[str, typing.Any],
scenarios: typing.Dict[str, mc.ExposureModel],
sample_times: typing.List[float],
executor_factory: typing.Callable[[], concurrent.futures.Executor],
):
statistics = {
'Current scenario' : {
'probability_of_infection': report_data['prob_inf'],
'expected_new_cases': report_data['expected_new_cases'],
'concentrations': report_data['concentrations'],
if (form.short_range_option == "short_range_no"):
statistics = {
'Current scenario' : {
'probability_of_infection': report_data['prob_inf'],
'expected_new_cases': report_data['expected_new_cases'],
'concentrations': report_data['concentrations'],
}
}
}
else:
statistics = {}
with executor_factory() as executor:
results = executor.map(
@ -351,7 +355,7 @@ class ReportGenerator:
context.update(report_data)
alternative_scenarios = manufacture_alternative_scenarios(form)
context['alternative_scenarios'] = comparison_report(
report_data, alternative_scenarios, scenario_sample_times, executor_factory=executor_factory,
form, report_data, alternative_scenarios, scenario_sample_times, executor_factory=executor_factory,
)
context['permalink'] = generate_permalink(base_url, self.calculator_prefix, form)
context['calculator_prefix'] = self.calculator_prefix

View file

@ -691,7 +691,7 @@ function draw_alternative_scenarios_plot(concentration_plot_svg_id, alternative_
highest_concentration = Math.max(highest_concentration, Math.max(...scenario_concentrations));
}
yRange.domain([0., highest_concentration]);
yRange.domain([0., highest_concentration*1.1]);
yAxisEl.transition().duration(1000).call(yAxis);
for (const [scenario_name, data] of Object.entries(data_for_scenarios)) {