daily_stats#
- class daily_stats(days=None, verbose=True, reporter=None, save_inds=False, **kwargs)[source]#
Bases:
Analyzer
Print out daily statistics about the simulation. Note that this analyzer takes a considerable amount of time, so should be used primarily for debugging, not in production code. To keep the intervention but toggle it off, pass an empty list of days.
To show the stats for a day after a run has finished, use e.g.
daily_stats.report('2020-04-04')
.- Parameters:
days (list) – days on which to print out statistics (if None, assume all)
verbose (bool) – whether to print on each timestep
reporter (func) – if supplied, a custom parser of the stats object into a report (see make_report() function for syntax)
save_inds (bool) – whether to save the indices of every infection at every timestep (also recoverable from the infection log)
Example:
sim = cv.Sim(analyzers=cv.daily_stats()) sim.run() sim['analyzers'][0].plot()
Methods
- intersect(*args)[source]#
Compute the intersection between arrays of indices, handling either keys to precomputed indices or lists of indices. With two array inputs, simply performs np.intersect1d(arr1, arr2).
- transpose(keys=None)[source]#
Transpose the data from a list-of-dicts-of-dicts to a dict-of-dicts-of-lists
- plot(fig_args=None, axis_args=None, plot_args=None, do_show=None, **kwargs)[source]#
Plot the daily statistics recorded. Some overlap with e.g.
sim.plot(to_plot='overview')
.- Parameters:
fig_args (dict) – passed to pl.figure()
axis_args (dict) – passed to pl.subplots_adjust()
plot_args (dict) – passed to pl.plot()
do_show (bool) – whether to show the plot
kwargs (dict) – passed to
cv.options.with_style()