added initialize methods
@@ -225,6 +225,12 @@ class sequence(Intervention):
return
+ def initialize(self, sim):
+ ''' Fix the dates '''
+ self.days = [sim.day(day) for day in self.days]
+ return
+
+
def apply(self, sim):
idx = np.argmax(self._cum_days > sim.t) # Index of the intervention to apply on this day
self.interventions[idx].apply(sim)
@@ -326,7 +332,6 @@ class clip_edges(Intervention):
super().__init__()
self.start_day = start_day
self.end_day = end_day
- self.days = [start_day, end_day]
self.change = change
self.verbose = verbose
self.layer_keys = None
@@ -335,6 +340,14 @@ class clip_edges(Intervention):
return
+ def initialize(self, sim):
+ ''' Fix the dates '''
+ self.start_day = sim.day(self.start_day)
+ self.end_day = sim.day(self.end_day)
+ self.days = [self.start_day, self.end_day]
+ return
+
+
def apply(self, sim):
verbose = self.verbose
@@ -422,11 +435,18 @@ class test_num(Intervention):
self.loss_prob = loss_prob
self.start_day = start_day
self.end_day = end_day
- self.days = [start_day, end_day]
self._store_args()
return
+ def initialize(self, sim):
+ ''' Fix the dates '''
+ self.start_day = sim.day(self.start_day)
+ self.end_day = sim.day(self.end_day)
+ self.days = [self.start_day, self.end_day]
+ return
+
+
def apply(self, sim):
t = sim.t
@@ -502,11 +522,18 @@ class test_prob(Intervention):
self.test_delay = test_delay
self.start_day = start_day
self.end_day = end_day
- self.days = [start_day, end_day]
self._store_args()
return
+ def initialize(self, sim):
+ ''' Fix the dates '''
+ self.start_day = sim.day(self.start_day)
+ self.end_day = sim.day(self.end_day)
+ self.days = [self.start_day, self.end_day]
+ return
+
+
def apply(self, sim):
''' Perform testing '''
t = sim.t
@@ -547,10 +574,18 @@ class contact_tracing(Intervention):
self.contact_reduction = contact_reduction # Not using this yet, but could potentially scale contact in this intervention
self.start_day = start_day
self.end_day = end_day
- self.days = [start_day, end_day]
self._store_args()
return
+
+ def initialize(self, sim):
+ ''' Fix the dates '''
+ self.start_day = sim.day(self.start_day)
+ self.end_day = sim.day(self.end_day)
+ self.days = [self.start_day, self.end_day]
+ return
+
+
def apply(self, sim):
t = sim.t
if t < self.start_day:
