refactored with simplified linelist
@@ -282,7 +282,7 @@ class Sim(cvb.BaseSim):
inds = np.arange(int(self['pop_infected']))
self.people.infect(inds=inds)
for ind in inds:
- self.people.transtree.seeds.append({'person':ind, 'date':self.t, 'layer':None})
+ self.people.transtree.seeds.append({'person':ind, 'date':self.t, 'layer':'seed_infection'})
return
@@ -310,7 +310,7 @@ class Sim(cvb.BaseSim):
imporation_inds = cvu.choose(max_n=len(people), n=n_imports)
flows['new_infections'] += people.infect(inds=imporation_inds, bed_max=bed_max)
for ind in imporation_inds:
- self.people.transtree.seeds.append({'person':ind, 'date':self.t, 'layer':None})
+ self.people.transtree.seeds.append({'person':ind, 'date':self.t, 'layer':'importation'})
# Apply interventions
for intervention in self['interventions']:
@@ -354,19 +354,9 @@ class Sim(cvb.BaseSim):
for ind in edge_inds:
source = sources[ind]
target = targets[ind]
-
- s_symp = people.symptomatic[source]
- s_diag = people.diagnosed[source]
- s_quar = people.quarantined[source]
- s_sev = people.severe[source]
- s_crit = people.critical[source]
- t_quar = people.quarantined[target]
-
- s_asymp = np.isnan(people.date_symptomatic[source])
- s_presymp = ~s_asymp and ~s_symp # Not asymptomatic and not currently symptomatic
-
- self.people.transtree.sources[target] = {'source':source, 'target':target, 'date':self.t, 'layer':lkey, 's_symp':s_symp, 's_diag':s_diag, 's_quar':s_quar, 't_quar':t_quar, 's_asymp':s_asymp, 's_presymp':s_presymp, 's_sev':s_sev, 's_crit':s_crit} # Call this the linelist
- self.people.transtree.targets[source].append({'source':source, 'target':target, 'date':self.t, 'layer':lkey}) # Make a count
+ transdict = {'source':source, 'target':target, 'date':self.t, 'layer':lkey}
+ self.people.transtree.sources[target] = transdict # Call this the linelist
+ self.people.transtree.targets[source].append(transdict) # Make a count
# Update counts for this time step: stocks
for key in cvd.result_stocks.keys():
