def fn(self, cb): coverage_by_age = {'min': 0, 'max': 200, 'coverage': self.coverage} add_ITN(cb, start=self.start, coverage_by_ages=[coverage_by_age], waning=self.waning, nodeIDs=self.nodeIDs)
def fn(self, cb) : birth_durations = [self.itn_dates[x] - self.itn_dates[x + 1] for x in range(len(self.itn_dates) - 1)] # itn_distr = zip(self.itn_dates[:-1], self.itn_fracs) with open(self.reffname) as fin : cov = json.loads(fin.read()) for itncov in cov[self.channel] : if itncov['coverage'] > 0 : for i, (itn_date, itn_frac) in enumerate(zip(self.itn_dates, self.itn_fracs)): c = itncov['coverage'] * itn_frac if i < len(self.itn_fracs) - 1: c /= np.prod([1 - x * itncov['coverage'] for x in self.itn_fracs[i + 1:]]) add_ITN(cb, itn_date, coverage_by_ages=[{'min': 0, 'max': 5, 'coverage': min([1, c*1.3])}, {'birth': 1, 'coverage': min([1,c*1.3]), 'duration': max([-1, birth_durations[i]])}, {'min': 5, 'max': 20, 'coverage': c / 2}, {'min': 20, 'max': 100, 'coverage': min([1, c*1.3])}], waning=self.waning, nodeIDs=itncov['nodes'])