sbmlsim.experiment.experiment

SimulationExperiments and helpers.

Module Contents

Classes

ExperimentDict

Dictionary for experiments.

SimulationExperiment

Generic simulation experiment.

ExperimentResult

Result of a simulation experiment.

Attributes

logger

sbmlsim.experiment.experiment.logger[source]
class sbmlsim.experiment.experiment.ExperimentDict[source]

Bases: dict

Dictionary for experiments.

__getitem__(self, k)[source]

Get item k.

class sbmlsim.experiment.experiment.SimulationExperiment(sid=None, base_path=None, data_path=None, ureg=None, **kwargs)[source]

Generic simulation experiment.

Consists of models, datasets, simulations, tasks, results, processing, figures

Parameters
  • sid (str) –

  • base_path (pathlib.Path) –

  • data_path (pathlib.Path) –

  • ureg (sbmlsim.units.UnitRegistry) –

initialize(self)[source]

Initialize SimulationExperiment.

Initialization must be separated from object construction due to the parallel execution of the problem later on. Certain objects cannot be serialized and must be initialized. :return:

Return type

None

__str__(self)[source]

Get string representation.

Return type

str

models(self)[source]

Define model definitions.

The child classes fill out the information.

Return type

Dict[str, sbmlsim.model.AbstractModel]

datasets(self)[source]

Define dataset definitions (experimental data).

The child classes fill out the information.

Return type

Dict[str, sbmlsim.data.DataSet]

tasks(self)[source]

Define task definitions.

The child classes fill out the information.

Return type

Dict[str, sbmlsim.task.Task]

simulations(self)[source]

Define simulation definitions.

The child classes fill out the information.

Return type

Dict[str, sbmlsim.simulation.AbstractSim]

fit_mappings(self)[source]

Define fit mappings.

Mapping reference data on observables. Used for the optimization of parameters. The child classes fill out the information.

Return type

Dict[str, sbmlsim.fit.FitMapping]

datagenerators(self)[source]

Define DataGenerators including functions.

All data which is accessed in a simulation result must be defined in a data generator. The data generators are important for defining the selections of a simulation experiment.

Return type

None

add_selections(self, selections, task_ids=None, reset=False)[source]

Add selections to given tasks.

Selections are necessary to access data from simulations. Here these selections are added to the tasks. If no tasks are given, the selections are added to all tasks.

Parameters
  • reset (bool) – drop and reset all selections.

  • selections (Iterable[str]) –

  • task_ids (Iterable[str]) –

property results(self)[source]

Access simulation results.

Results are mapped on tasks based on the task_ids. E.g. to get the results for the task with id ‘task_glciv’ use ```

simexp.results[“task_glciv”] self.results[“task_glciv”]

```

Return type

Dict[str, sbmlsim.result.XResult]

figures(self)[source]

Figure definition.

Selections accessed in figures and analyses must be registered beforehand via datagenerators.

Most figures do not require access to concrete data, but only abstract data concepts.

Return type

Dict[str, sbmlsim.plot.Figure]

_check_keys(self)[source]

Check keys in information dictionaries.

_check_types(self)[source]

Check for correctness of types.

run(self, simulator, output_path=None, show_figures=True, save_results=False, figure_formats=None, reduced_selections=True)[source]

Execute given experiment and store results.

Parameters
  • output_path (pathlib.Path) –

  • show_figures (bool) –

  • save_results (bool) –

  • figure_formats (List[str]) –

  • reduced_selections (bool) –

Return type

ExperimentResult

_run_tasks(self, simulator, reduced_selections=True)[source]

Run simulations and scans.

This should not be called directly, but the results of the simulations should be requested by the results property. This allows to hash executed simulations.

Parameters

reduced_selections (bool) –

evaluate_fit_mappings(self)[source]

Evaluate fit mappings.

to_json(self, path=None, indent=2)[source]

Convert experiment to JSON for exchange.

Parameters

path – path for file, if None JSON str is returned

Returns

to_dict(self)[source]

Convert to dictionary.

This is the basis for the JSON serialization.

classmethod from_json(cls, json_info)[source]

Load experiment from json path or str.

Parameters

json_info (Union[pathlib.Path, str]) –

Return type

SimulationExperiment

save_datasets(self, results_path)[source]

Save datasets.

Parameters

results_path (pathlib.Path) –

Return type

None

save_results(self, results_path)[source]

Save results (mean timecourse).

Parameters

results_path (pathlib.Path) –

Returns

Return type

None

create_mpl_figures(self)[source]

Create matplotlib figures.

Return type

Dict[str, Union[sbmlsim.plot.plotting_matplotlib.FigureMPL, sbmlsim.plot.Figure]]

show_mpl_figures(self, mpl_figures)[source]

Show matplotlib figures.

Parameters

mpl_figures (Dict[str, sbmlsim.plot.plotting_matplotlib.FigureMPL]) –

Return type

None

save_mpl_figures(self, results_path, mpl_figures, figure_formats=None)[source]

Save matplotlib figures.

Parameters
  • results_path (pathlib.Path) –

  • mpl_figures (Dict[str, sbmlsim.plot.plotting_matplotlib.FigureMPL]) –

  • figure_formats (List[str]) –

Return type

Dict[str, List[pathlib.Path]]

classmethod close_mpl_figures(cls, mpl_figures)[source]

Close matplotlib figures.

Parameters

mpl_figures (Dict[str, sbmlsim.plot.plotting_matplotlib.FigureMPL]) –

class sbmlsim.experiment.experiment.ExperimentResult[source]

Result of a simulation experiment.

experiment :SimulationExperiment[source]
output_path :pathlib.Path[source]
to_dict(self)[source]

Conversion to dictionary.

Used in serialization and required for reports.

Return type

Dict