Transmission can occur via both routes in the same model: the contact transmission route (via networks) and the environmental transmission route. These routes are independent of each other. Interventions can attenuate and/or amplify the contribution of each route, including blocking it altogether.
import starsim as ssimport typhoidsim as ty# Define high-level simulation parameterspars =dict( start =2000, # Starting year dur =1.0, # Duration of the simulation in years dt =1.0/365.0, # Timestep of 1 day, expressed in years verbose =0, # Do not print details of the run)# The populationppl = ss.People(10_000)# The environment the population is affected by, and can carry the pathogenenvironment = ty.EnvironmentalPool()# Person to person transmissionrandom_p2p = ss.RandomNet({'n_contacts': 5})# The disease typhoid = ty.Typhoid()sim = ss.Sim( pars=pars, people=ppl, demographics=environment, networks=random_p2p, diseases=typhoid, )sim.run()sim.plot()
Figure(1152x864)
/opt/hostedtoolcache/Python/3.12.15/x64/lib/python3.12/site-packages/starsim/time.py:2455: UserWarning: AutoDateLocator was unable to pick an appropriate interval for this date range. It may be necessary to add an interval value to the AutoDateLocator's intervald dictionary. Defaulting to 6.
vticks = self._date_locator() # The internal date locator will return the tick positions in matplotlib units