-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatistics_seiqr.py
33 lines (24 loc) · 1.08 KB
/
statistics_seiqr.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from statistics.statistics_seir import StatisticsSEIR
from logic.models import GenericModel
from logic.point import Point
class StatisticsSEIQR(StatisticsSEIR):
def __init__(self, model: GenericModel):
super().__init__(model)
self.quarantine_cnt = 0
self.fieldnames += ["Quarantined"]
self.save_field_names()
def update_statistics(self, point: Point) -> None:
super().update_statistics(point)
self.quarantine_cnt += point.all_quarantined()
def reset_statistics(self) -> None:
super().reset_statistics()
self.quarantine_cnt = 0
def get_attributes_array(self):
return super().get_attributes_array() + [self.quarantine_cnt]
@property
def current_stats_representations(self) -> dict[str, str]:
stats_representations = {"quarantined": f"quarantined: {self.quarantine_cnt}"}
stats_representations.update(super().current_stats_representations)
return stats_representations
def generate_plot(self, idx: int, *args) -> None:
super().generate_plot(idx, *args, 'Quarantined')