sbmlsim.experiment.experiment
¶
SimulationExperiments and helpers.
Module Contents¶
Classes¶
Generic simulation experiment. |
|
Result of a simulation experiment. |
Attributes¶
- 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) –
- property results: Dict[str, sbmlsim.xresult.XResult][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.xresult.XResult]
- initialize()[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
- models()[source]¶
Define model definitions.
The child classes fill out the information.
- Return type:
Dict[str, Union[sbmlsim.model.AbstractModel, pathlib.Path]]
- datasets()[source]¶
Define dataset definitions (experimental data).
The child classes fill out the information.
- Return type:
Dict[str, sbmlsim.data.DataSet]
- simulations()[source]¶
Define simulation definitions.
The child classes fill out the information.
- Return type:
Dict[str, sbmlsim.simulation.AbstractSim]
- tasks()[source]¶
Define task definitions.
The child classes fill out the information.
- Return type:
Dict[str, sbmlsim.task.Task]
- data()[source]¶
Define DataGenerators including functions.
This determines the selection in the model.
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:
Dict[str, sbmlsim.data.Data]
- figures()[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]
- figures_mpl()[source]¶
Matplotlib 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.serialization_matplotlib.FigureMPL]
- fit_mappings()[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]
- reports()[source]¶
Define reports.
Reports are defined by a hashmap label:Data. Reports can be serialized in multiple manners.
- Return type:
Dict[str, Dict[str, str]]
- add_data(d)[source]¶
Add data to the tracked data.
- Parameters:
d (sbmlsim.data.Data) –
- Return type:
None
- add_selections_data(selections, task_ids=None)[source]¶
Add selections to given tasks.
The data for the selections will be part of the results.
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 – drop and reset all selections.
selections (Iterable[str]) –
task_ids (Iterable[str]) –
- Return type:
None
- run(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:
- _run_tasks(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) –
- to_json(path=None, indent=2)[source]¶
Convert experiment to JSON for exchange.
- Parameters:
path (pathlib.Path) – path for file, if None JSON str is returned
indent (int) –
- Returns:
- classmethod from_json(json_info)[source]¶
Load experiment from json path or str.
- Parameters:
json_info (Union[pathlib.Path, str]) –
- Return type:
- save_datasets(results_path)[source]¶
Save datasets.
- Parameters:
results_path (pathlib.Path) –
- Return type:
None
- save_results(results_path)[source]¶
Save results (mean timecourse).
- Parameters:
results_path (pathlib.Path) –
- Returns:
- Return type:
None
- create_mpl_figures()[source]¶
Create matplotlib figures.
- Return type:
Dict[str, Union[sbmlsim.plot.serialization_matplotlib.FigureMPL, sbmlsim.plot.Figure]]
- show_mpl_figures(mpl_figures)[source]¶
Show matplotlib figures.
- Parameters:
mpl_figures (Dict[str, sbmlsim.plot.serialization_matplotlib.FigureMPL]) –
- Return type:
None