Remove the repeats concept from the report generator (removed in 1d34db3a81).

This commit is contained in:
Phil Elson 2021-07-07 12:43:39 +02:00
parent 1044946fa5
commit 4d3ff3c742
2 changed files with 4 additions and 20 deletions

View file

@ -96,6 +96,7 @@ class ConcentrationModel(BaseRequestHandler):
if self.settings.get("debug", False):
from pprint import pprint
pprint(requested_model_config)
start = datetime.datetime.now()
try:
form = model_generator.FormData.from_dict(requested_model_config)
@ -114,6 +115,9 @@ class ConcentrationModel(BaseRequestHandler):
report_generator.build_report, base_url, form,
)
report: str = await asyncio.wrap_future(report_task)
if self.settings.get("debug", False):
dt = (datetime.datetime.now() - start)
print(f'Report response time {dt.seconds}.{dt.microseconds}s')
self.finish(report)

View file

@ -18,13 +18,6 @@ from .model_generator import FormData
from ... import dataclass_utils
@dataclasses.dataclass(frozen=True)
class RepeatEvents:
repeats: int
probability_of_infection: float
expected_new_cases: float
def model_start_end(model: models.ExposureModel):
t_start = min(model.exposed.presence.boundaries()[0][0],
model.concentration_model.infected.presence.boundaries()[0][0])
@ -46,18 +39,6 @@ def calculate_report_data(model: models.ExposureModel):
exposed_occupants = model.exposed.number
expected_new_cases = np.mean(model.expected_new_cases())
repeated_events = []
for n in [1, 2, 3, 4, 5]:
repeat_model = dataclass_utils.replace(model, repeats=n)
repeated_events.append(
RepeatEvents(
repeats=n,
probability_of_infection=np.mean(repeat_model.infection_probability()),
expected_new_cases=np.mean(repeat_model.expected_new_cases()),
)
)
return {
"times": times,
"concentrations": concentrations,
@ -67,7 +48,6 @@ def calculate_report_data(model: models.ExposureModel):
"exposed_occupants": exposed_occupants,
"expected_new_cases": expected_new_cases,
"scenario_plot_src": img2base64(_figure2bytes(plot(times, concentrations, model))),
"repeated_events": repeated_events,
}