experiment.experiment¶
SimulationExperiments and helpers.
SimulationExperiment
¶
Generic simulation experiment.
Consists of models, datasets, simulations, tasks, results, processing, figures
SimulationExperiement.
:param sid: :param base_path: :param data_path: :param ureg: :param kwargs:
results
property
¶
initialize
¶
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:
datasets
¶
Define dataset definitions (experimental data).
The child classes fill out the information.
simulations
¶
Define simulation definitions.
The child classes fill out the information.
data
¶
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.
figures
¶
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.
figures_mpl
¶
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.
fit_mappings
¶
Define fit mappings.
Mapping reference data on observables. Used for the optimization of parameters. The child classes fill out the information.
reports
¶
Define reports.
Reports are defined by a hashmap label:Data. Reports can be serialized in multiple manners.
add_selections_data
¶
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.
:param reset: drop and reset all selections.
run
¶
run(
simulator,
output_path=None,
show_figures=False,
save_results=False,
figure_formats=None,
reduced_selections=True,
)
Execute given experiment and store results.
to_json
¶
Convert experiment to JSON for exchange.
:param path: path for file, if None JSON str is returned :return:
save_results
¶
Save results (mean timecourse).
:param results_path: :return:
show_mpl_figures
¶
Show matplotlib figures.
The figures of the serializer are created without pyplot, so that
rendering does not fill its global registry; a figure it does not
manage cannot show itself. Showing is the one place which needs the
state machine, so a figure gets a manager here and only here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mpl_figures
|
dict[str, FigureMPL]
|
the figures to show. |
required |
save_mpl_figures
¶
Save matplotlib figures.
save_interactive_figures
¶
Write the figures as interactive pages.
The pages are drawn by plotly, see
sbmlsim.plot.serialization_plotly: matplotlib draws the static
images a publication needs and plotly the pages a reader zooms and
hovers over. Both read the same Figure, so the two cannot disagree
about what they show.
plotly is not a dependency of sbmlsim; a run which asks for the
interactive figures without it says so and writes none.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
results_path
|
Path
|
directory of the pages. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Path]
|
The path of the page of every figure, empty without plotly. |
close_mpl_figures
classmethod
¶
Close matplotlib figures.
A figure of the serializer is not in the registry of pyplot and is
released when nothing refers to it any more, for which this is a no-op.
A figure of figures_mpl() may well come from pyplot, and that one
is closed here.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mpl_figures
|
dict[str, FigureMPL]
|
the figures to close. |
required |