variant#

class variant(variant, days, label=None, n_imports=1, rescale=True)[source]#

Bases: prettyobj

Add a new variant to the sim

Parameters:
  • variant (str/dict) – name of variant, or dictionary of parameters specifying information about the variant

  • days (int/list) – day(s) on which new variant is introduced

  • label (str) – if variant is supplied as a dict, the name of the variant

  • n_imports (int) – the number of imports of the variant to be added

  • rescale (bool) – whether the number of imports should be rescaled with the population

Example:

alpha    = cv.variant('alpha', days=10) # Make the alpha variant B117 active from day 10
p1      = cv.variant('p1', days=15) # Make variant P1 active from day 15
my_var  = cv.variant(variant={'rel_beta': 2.5}, label='My variant', days=20)
sim     = cv.Sim(variants=[alpha, p1, my_var]).run() # Add them all to the sim
sim2    = cv.Sim(variants=cv.variant('alpha', days=0, n_imports=20), pop_infected=0).run() # Replace default variant with alpha

Methods

parse(variant=None, label=None)[source]#

Unpack variant information, which may be given as either a string or a dict

initialize(sim)[source]#

Update variant info in sim

apply(sim)[source]#

Introduce new infections with this variant