BaseSim#
- class BaseSim(pars, **kwargs)[source]#
Bases:
ParsObj
The BaseSim class handles the dynamics of the simulation.
Attributes
n
Count the number of points in timesteps between the starting year and the ending year.
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