starsimhub / starsim

Starsim disease modeling framework
http://starsim.org
MIT License
14 stars 8 forks source link

Network initialization #147

Closed daniel-klein closed 8 months ago

daniel-klein commented 11 months ago

Users should be able to specify the network as a single Network instance, a list of networks, or Networks object. For now, only the Networks objects seems to work.

cliffckerr commented 8 months ago

Since fixed:

import scipy.stats as sps
import starsim as ss

n_agents = 2000
network = ss.RandomNetwork(n_contacts=sps.poisson(mu=4))
people = ss.People(n=n_agents, networks=network)
sir = ss.SIR(dur_inf=10, beta=0.1)
sim = ss.Sim(diseases=sir, people=people)
sim.run()
sim.plot()