Result#

class Result(name=None, label=None, dtype=<class 'float'>, shape=None, scale=True, module=None, values=None, timevec=None, low=None, high=None)[source]#

Bases: BaseArr

Array-like container for holding sim results.

Parameters:
  • module (str) – the name of the parent module, e.g. ‘hiv’

  • name (str) – the name of this result, e.g. ‘new_infections’

  • shape (int/tuple) – the shape of the result array (usually module.npts)

  • scale (bool) – whether or not the result scales by population size (e.g. a count does, a prevalence does not)

  • label (str) – a human-readable label for the result

  • values (array) – prepopulate the Result with these values

  • timevec (array) – an array of time points

  • low (array) – values for the lower bound

  • high (array) – values for the upper bound

In most cases, ss.Result behaves exactly like np.array(), except with the additional fields listed above. To see everything contained in a result, you can use result.disp().

Attributes

full_label

<label>, e.g. "HIV: New infections".

initialized

key

<module>.<name>, e.g. "hiv.new_infections".

Methods

init_values(values=None, dtype=None, shape=None, force=False)[source]#

Handle values

update(*args, **kwargs)[source]#

Update parameters, and initialize values if needed

property key#

<module>.<name>, e.g. “hiv.new_infections”

Type:

Return the unique key of the result

property full_label#

<label>, e.g. “HIV: New infections”

Type:

Return the full label of the result

Type:

<Module>

to_df(sep='_', rename=False)[source]#

Convert to a dataframe with timevec, value, low, and high columns

Parameters:

rename (bool) – if True, rename the columns with the name of the result (else value, low, high)

plot(fig=None, ax=None, fig_kw=None, plot_kw=None, fill_kw=None, **kwargs)[source]#

Plot a single result; kwargs are interpreted as plot_kw