class Scenarios(pars=None, repeats=None, scens=None, **kwargs)[source]#

Bases: prettyobj

Run different intervention scenarios.

A “scenario” can be thought of as a list of sims, all with the same parameters except for the random seed. Usually, scenarios differ from each other only in terms of the interventions run (to compare other differences between sims, it’s preferable to use a MultiSim object).

  • pars (dict) – parameters to pass to the sim

  • repeats (int) – how many repeats of each scenario to run (default: 1)

  • scens (list) – the list of scenarios to run; see also fp.make_scen() and Scenarios.add_scen()

  • kwargs (dict) – optional additional parameters to pass to the sim


scen1 = fp.make_scen(label='Baseline')
scen2 = fp.make_scen(year=2002, eff={'Injectables':0.99}) # Basic efficacy scenario
scens = fp.Scenarios(location='test', repeats=2, scens=[scen1, scen2])


add_scen(scen=None, label=None)[source]#

Add a scenario or scenarios to the Scenarios object

make_sims(scenlabel, **kwargs)[source]#

Create a list of sims that are all identical except for the random seed


Convert a scenario specification into a list of sims

run(recompute=True, *args, **kwargs)[source]#

Actually run a list of sims


Give a meaningful error message if the scenarios haven’t been run

plot(to_plot=None, plot_sims=True, **kwargs)[source]#

Plot the scenarios with bands – see sim.plot() for args

plot_sims(to_plot=None, plot_sims=True, **kwargs)[source]#

Plot each sim as a separate line across all senarios – see sim.plot() for args

analyze_sims(start=None, end=None)[source]#

Take a list of sims that have different labels and extrapolate statistics from each