do not reset vaccines with rescaling
@@ -356,14 +356,19 @@ class People(cvb.BasePeople):
#%% Methods to make events occur (infection and diagnosis)
- def make_naive(self, inds):
+ def make_naive(self, inds, reset_vx=False):
'''
Make a set of people naive. This is used during dynamic resampling.
+
+ Args:
+ inds (array): list of people to make naive
+ reset_vx (bool): whether to reset vaccine-derived immunity
'''
for key in self.meta.states:
if key in ['susceptible', 'naive']:
self[key][inds] = True
else:
+ if (key != 'vaccinated') or reset_vx: # Don't necessarily reset vaccination
self[key][inds] = False
# Reset variant states
@@ -373,15 +378,15 @@ class People(cvb.BasePeople):
self[key][:, inds] = False
# Reset immunity and antibody states
+ non_vx_inds = inds if reset_vx else inds[~self['vaccinated'][inds]]
for key in self.meta.imm_states:
- self[key][:, inds] = 0
- for key in self.meta.nab_states:
- self[key][inds] = 0
- for key in self.meta.vacc_states:
- self[key][inds] = 0
+ self[key][:, non_vx_inds] = 0
+ for key in self.meta.nab_states + self.meta.vacc_states:
+ self[key][non_vx_inds] = 0
# Reset dates
for key in self.meta.dates + self.meta.durs:
+ if (key != 'date_vaccinated') or reset_vx: # Don't necessarily reset vaccination
self[key][inds] = np.nan
return
