BaseSim#

class BaseSim(pars, **kwargs)[source]#

Bases: ParsObj

The BaseSim class handles the dynamics of the simulation.

Attributes

n

npts

Count the number of points in timesteps between the starting year and the ending year.

tvec

Create a time vector array at intervals of the timestep in years

Methods

property npts#

Count the number of points in timesteps between the starting year and the ending year.

property tvec#

Create a time vector array at intervals of the timestep in years

get_interventions(label=None, partial=False, as_inds=False)[source]#

Find the matching intervention(s) by label, index, or type. If None, return all interventions. If the label provided is “summary”, then print a summary of the interventions (index, label, type).

Parameters:
  • label (str, int, Intervention, list) – the label, index, or type of intervention to get; if a list, iterate over one of those types

  • partial (bool) – if true, return partial matches (e.g. ‘beta’ will match all beta interventions)

  • as_inds (bool) – if true, return matching indices instead of the actual interventions

get_intervention(label=None, partial=False, first=False, die=True)[source]#

Like get_interventions(), find the matching intervention(s) by label, index, or type. If more than one intervention matches, return the last by default. If no label is provided, return the last intervention in the list.

Parameters:
  • label (str, int, Intervention, list) – the label, index, or type of intervention to get; if a list, iterate over one of those types

  • partial (bool) – if true, return partial matches (e.g. ‘beta’ will match all beta interventions)

  • first (bool) – if true, return first matching intervention (otherwise, return last)

  • die (bool) – whether to raise an exception if no intervention is found

get_analyzers(label=None, partial=False, as_inds=False)[source]#

Same as get_interventions(), but for analyzers.

get_analyzer(label=None, partial=False, first=False, die=True)[source]#

Same as get_intervention(), but for analyzers.