Rebug in progress...
@@ -432,6 +432,7 @@ class People(cvb.BasePeople):
start_date = self.t if start_date is None else int(start_date)
period = self.pars['quar_period'] if period is None else int(period)
for ind in inds:
+ if ind not in {x[0] for x in self._pending_quarantine[start_date]}:
self._pending_quarantine[start_date].append((ind, start_date+period))
return
@@ -445,6 +446,8 @@ class People(cvb.BasePeople):
trace_time (dict): days it'll take to trace people at each contact layer - should have the same keys as contacts
'''
+ this_step = set()
+
# Extract the indices of the people who'll be contacted
traceable_layers = {k:v for k,v in trace_probs.items() if v != 0.} # Only trace if there's a non-zero tracing probability
for lkey,this_trace_prob in traceable_layers.items():
@@ -459,11 +462,19 @@ class People(cvb.BasePeople):
edge_inds = np.unique(np.concatenate(inds_list)) # Find all edges
# Check contacts
+
contact_inds = cvu.binomial_filter(this_trace_prob, edge_inds) # Filter the indices according to the probability of being able to trace this layer
if len(contact_inds):
self.known_contact[contact_inds] = True
self.date_known_contact[contact_inds] = np.fmin(self.date_known_contact[contact_inds], self.t+this_trace_time) # Record just first time they were notified
- self.quarantine(contact_inds, self.t+this_trace_time) # Schedule quarantine for the notified people to start on the date they will be notified
+ # self.quarantine(contact_inds, self.t+this_trace_time) # Schedule quarantine for the notified people to start on the date they will be notified
+ for a in contact_inds:
+ if a in this_step:
+ continue
+ else:
+ this_step.add(a)
+ self.quarantine([a], self.t+this_trace_time)
+
return
