add optional variant arg
@@ -299,7 +299,7 @@ def init_immunity(sim, create=False):
return
-def check_immunity(people):
+def check_immunity(people, variants=None):
'''
Calculate people's immunity on this timestep from prior infections + vaccination. Calculates effective NAbs by
weighting individuals NAbs by source and then calculating efficacy.
@@ -308,13 +308,14 @@ def check_immunity(people):
(1) prior exposure: degree of protection depends on variant, prior symptoms, and time since recovery
(2) vaccination: degree of protection depends on variant, vaccine, and time since vaccination
-
'''
# Handle parameters and indices
pars = people.pars
+ if variants is None:
+ variants = range(pars['n_variants'])
- for variant in range(pars['n_variants']):
+ for variant in variants:
immunity = pars['immunity'][variant, :] # cross-immunity/own-immunity scalars to be applied to NAb level before computing efficacy
nab_eff = pars['nab_eff']
imm = np.ones(len(people))
