single_run#
- class single_run(sim, ind=0, reseed=True, noise=0.0, noisepar=None, keep_people=False, run_args=None, sim_args=None, verbose=None, do_run=True, **kwargs)[source]#
Convenience function to perform a single simulation run. Mostly used for parallelization, but can also be used directly.
- Parameters:
sim (Sim) – the sim instance to be run
ind (int) – the index of this sim
reseed (bool) – whether or not to generate a fresh seed for each run
noise (float) – the amount of noise to add to each run
noisepar (str) – the name of the parameter to add noise to
keep_people (bool) – whether to keep the people after the sim run
run_args (dict) – arguments passed to sim.run()
sim_args (dict) – extra parameters to pass to the sim, e.g. ‘n_infected’
verbose (int) – detail to print
do_run (bool) – whether to actually run the sim (if not, just initialize it)
kwargs (dict) – also passed to the sim
- Returns:
a single sim object with results
- Return type:
sim (Sim)
Example:
import covasim as cv sim = cv.Sim() # Create a default simulation sim = cv.single_run(sim) # Run it, equivalent(ish) to sim.run()