hari_plotter.simulation module

class hari_plotter.simulation.Simulation(model: Model, parameters: dict[str, Any], dynamics: Dynamics | None = None)[source]

Bases: object

A class representing a simulation. Provides methods for initializing from TOML configurations and directories.

property dt
classmethod from_dir(datadir: str | Path) Simulation[source]

Load simulation parameters from a directory containing configuration and data.

Parameters:

datadir – Path to the directory containing simulation data and configuration.

Returns:

Instance of Simulation based on the data in the directory.

classmethod from_toml(filename: str) Simulation[source]

Load simulation parameters from a TOML file and instantiate a Simulation instance.

Parameters:

filename – Path to the TOML file containing simulation configuration.

Returns:

Instance of Simulation based on the TOML file.

group(num_intervals: int, interval_size: int = 1, offset: int = 0)[source]
parameters_with_model(updates: dict | None = None)[source]

Return a dictionary containing the model parameters and simulation parameters.

run(path_to_seldon, directory, n_output_network: int | None = None, n_output_agents: int | None = None, start_numbering_from: int | None = None, start_from: int | None = None, print_progress: bool | None = None) bool[source]

Run the simulation.

if start_from is integer, it takes the start_from image from the dynamics as the initial_guess for the simulation.

to_toml(filename: str, updates: dict | None = None) None[source]

Serialize the Simulation instance to a TOML file.

Parameters:

filename – Path to the TOML file where the simulation configuration will be saved.

static update_nested_dict(original: dict, updates: dict | None)[source]

Recursively update the dictionary ‘original’ with values from ‘updates’. If a key in ‘updates’ refers to a dictionary, dive deeper. Otherwise, simply update the value.