コード例 #1
0
 def __init__(self,
              daily_vaccines,
              start_day=None,
              end_day=None,
              delay=None,
              prob=1.0,
              rel_symp=None,
              rel_sus=None,
              subtarget=None,
              cumulative=[0.5, 1],
              **kwargs):
     super().__init__(**kwargs)  # NB: This line must be included
     self._store_args(
     )  # Store the input arguments so the intervention can be recreated
     self.start_day = start_day
     self.end_day = end_day
     self.delay = cvd.default_int(
         delay)  # days needed to take the second dose
     self.rel_sus = rel_sus  # relative change in susceptibility; 0 = perfect, 1 = no effect
     self.rel_symp = rel_symp  # relative change in symptom probability for people who still get infected; 0 = perfect, 1 = no effect
     self.daily_vaccines = daily_vaccines  #daily number of vaccines (first dose)
     self.subtarget = subtarget
     if cumulative in [0, False]:
         cumulative = [1,
                       0]  # First dose has full efficacy, second has none
     elif cumulative in [1, True]:
         cumulative = [1]  # All doses have full efficacy
     self.cumulative = np.array(
         cumulative, dtype=cvd.default_float)  # Ensure it's an array
     return
コード例 #2
0
 def __init__(self, daily_vaccines, prob=1.0, rel_symp=0.0, rel_trans=1.0, take_prob=1.0, delay=7*7, dose_delay=14,
              age_priority=65, cumulative=[0.5, 1.0], dose_priority=[1.0, 5.0], start_day=0, end_day=None, **kwargs):
     super().__init__(**kwargs)  # Initialize the Intervention object
     self._store_args()  # Store the input arguments so the intervention can be recreated
     self.daily_vaccines = daily_vaccines # Should be a list of length matching time
     self.prob = prob
     self.rel_symp = rel_symp
     self.rel_trans = rel_trans
     self.take_prob = take_prob
     self.age_priority = age_priority
     self.delay = cvd.default_int(delay)
     self.dose_delay = cvd.default_int(dose_delay)
     self.dose_priority = np.array(dose_priority, dtype=cvd.default_float)
     if cumulative in [0, False]:
         cumulative = [1,0] # First dose has full efficacy, second has none
     elif cumulative in [1, True]:
         cumulative = [1] # All doses have full efficacy
     self.cumulative = np.array(cumulative, dtype=cvd.default_float) # Ensure it's an array
     self.start_day   = start_day
     self.end_day     = end_day