Example #1
0
people = []
for i in range(14):
    for j in range(14):
        pos = [1.0 / 15 * i + 1.0 / 15, 1.0 / 15 * j + 1.0 / 15]
        theta = 2 * np.pi * np.random.rand()
        vel = [np.cos(theta), np.sin(theta)]
        rad = 0.01
        person = Person(pos, vel, radius=rad)
        people.append(person)
people[0].health = 'sick'
if quarantine_rate is not None:
    for ind, person in enumerate(people):
        if rand() < quarantine_rate and ind != 0:
            person.quarantined = True
sim = Sim([0, 1, 0, 1],
          people,
          name=sys.argv[1],
          transm_prob=transm_prob,
          death_rate=dr,
          recovery_time=rt)

sim.write_state_to_file('states')
skip = 1
while sim.total_sick > 0:
    sim.proceed(skip)
    sim.write_state_to_file('states')
    if print_:
        print(sim.total_sick)
sim.end()