Core

Core provides a framework for the implementation of SEIR and Related Models.

Overview:

SEIR Core

class seirmo.SEIRForwardModel[source]

Abstract base class for forward SEIR and Related models.

Extends pints.ForwardModel.

n_outputs()[source]

Returns Number of Output Parameters

n_parameters()[source]

Returns Number of Model parameters

output_names()[source]

Returns the Output Names

parameter_names()[source]

Returns the Model Parameter Names

set_outputs(outputs)[source]

Set the Desired Output Parameters

simulate(parameters, times)[source]

Forward simulation of a model for a given time period with given parameters Returns a sequence of length n_times (for single output problems) or a NumPy array of shape (n_times, n_outputs) (for multi-output problems), representing the values of the model at the given times.

Parameters:
  • parameters (list | numpy.ndarray) – An array-like object with parameter values of length n_parameters().

  • times (list | numpy.ndarray) – An array-like object with time points.

class seirmo.SEIRParameters(parameterNames: List[str])[source]

Base Parameter Class for SEIR and Related Forward Models

configure_parameters(parameters: ndarray)[source]

Set the current parameters

n_parameters()[source]

Returns the Number of Model Parameters

parameter_names()[source]

Returns the Names of the Model Parameters

class seirmo.SEIROutputCollector(outputNames: List[str])[source]

Base Class for Accumulating the Output Data from SEIR and Related Forward Models

begin(*args, **kwargs)[source]

Abstract method which is called before observations from simulation are reported.

This allows for subclasses to pre-initialize a datastructure for when observations are then reported.

n_outputs()[source]

Returns the Number of Outputs

output_names()[source]

Returns the Names of the Outputs

report(row)[source]

Abstract Method which is for reporting observations from each iteration of a simulation.

This allows for subclasses to perform extra operations on the data.

Also allows for subclasses to filter / decide which observations should be stored.

report_all(data)[source]

Save all Datapoints to the OutputCollector.

Overwrites any existing data with this.

: param: data np.ndarray: Data to save.

retrieve()[source]

Returns the Data stored in the Collector.

If the collector is configured to only output specific columns, these are filtered here.

set_outputs(outputs)[source]

Sets the Outputs to Keep

class seirmo.StochasticOutputCollector(outputNames: List[str])[source]
begin(times)[source]

Abstract method which is called before observations from simulation are reported.

This allows for subclasses to pre-initialize a datastructure for when observations are then reported.

report(data: ndarray) array[source]

Report data as a column vector into an array at each timestep.

Parameters:

data – numpy array containing the data of the model resolution

Returns:

numpy array containing the model solution

retrieve_time(index: int) ndarray[source]

Return data as a column vector at a time point requested. Asserts timepoint is within the ‘past’ of the model.

Parameters:

time_point – specified time at which we want the data

Returns:

data as a column for the specified time step

Return type:

numpy array column