experiment, still WIP
@@ -294,9 +294,6 @@ class Sim(cvbase.BaseSim):
if self['rescale']:
self.rescale()
- # Update each person, skipping people who are susceptible
- not_susceptible = self.people.filter_out('susceptible')
-
# Randomly infect some people (imported infections)
if n_imports>0:
imporation_inds = cvu.choose(max_n=pop_size, n=n_imports)
@@ -304,17 +301,16 @@ class Sim(cvbase.BaseSim):
person = self.people[ind]
new_infections += person.infect(t=t)
- # Loop over everyone not susceptible
- for person in not_susceptible:
-
- # If exposed, check if the person becomes infectious
- if person.exposed:
+ # Loop over exposed people
+ exposed_people = self.people.filter_in('exposed')
+ for person in exposed_people:
if not person.infectious and t == person.date_infectious: # It's the day they become infectious
person.infectious = True
sc.printv(f' Person {person.uid} became infectious!', 2, verbose)
# If infectious, update status according to the course of the infection, and check if anyone gets infected
- if person.infectious:
+ infectious_people = self.people.filter_in('infectious')
+ for person in infectious_people:
# Check whether the person died on this timestep
new_death = person.check_death(t)
@@ -369,9 +365,9 @@ class Sim(cvbase.BaseSim):
self =self['interv_func'](self)
# Update counts for this time step: stocks
- for key in cvd.result_stocks.keys():
- self.results[f'n_{key}'][t] = self.people.count_in(key)
- self.results['bed_capacity'][t] = self.results['n_severe'][t]/n_beds if n_beds>0 else np.nan
+ # for key in cvd.result_stocks.keys():
+ # self.results[f'n_{key}'][t] = self.people.count_in(key)
+ # self.results['bed_capacity'][t] = self.results['n_severe'][t]/n_beds if n_beds>0 else np.nan
# Update counts for this time step: flows
self.results['new_infections'][t] = new_infections # New infections on this timestep
