clip_edges#

class clip_edges(days, changes, layers=None, **kwargs)[source]#

Bases: Intervention

Isolate contacts by removing them from the simulation. Contacts are treated as “edges”, and this intervention works by removing them from sim.people.contacts and storing them internally. When the intervention is over, they are moved back. This intervention has quite similar effects as change_beta(), but is more appropriate for modeling the effects of mobility reductions such as school and workplace closures. The main difference is that since clip_edges() actually removes contacts, it affects the number of people who would be traced and placed in quarantine if an individual tests positive. It also alters the structure of the network – i.e., compared to a baseline case of 20 contacts and a 2% chance of infecting each, there are slightly different statistics for a beta reduction (i.e., 20 contacts and a 1% chance of infecting each) versus an edge clipping (i.e., 10 contacts and a 2% chance of infecting each).

Parameters:
  • days (int or array) – the day or array of days to isolate contacts

  • changes (float or array) – the changes in the number of contacts (1 = no change, 0 = no contacts)

  • layers (str or list) – the layers in which to isolate contacts (if None, then all layers)

  • kwargs (dict) – passed to Intervention()

Examples:

interv = cv.clip_edges(25, 0.3) # On day 25, reduce overall contacts by 70% to 0.3
interv = cv.clip_edges([14, 28], [0.7, 1], layers='s') # On day 14, remove 30% of school contacts, and on day 28, restore them

Methods

finalize(sim)[source]#

Ensure the edges get deleted at the end