Skip to content

experiment.experiment

SimulationExperiments and helpers.

SimulationExperiment

SimulationExperiment(
    sid=None,
    base_path=None,
    data_path=None,
    ureg=None,
    **kwargs,
)

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

results

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"]

initialize

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:

models

models()

Define model definitions.

The child classes fill out the information.

datasets

datasets()

Define dataset definitions (experimental data).

The child classes fill out the information.

simulations

simulations()

Define simulation definitions.

The child classes fill out the information.

tasks

tasks()

Define task definitions.

The child classes fill out the information.

data

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

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

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

fit_mappings()

Define fit mappings.

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

reports

reports()

Define reports.

Reports are defined by a hashmap label:Data. Reports can be serialized in multiple manners.

add_data

add_data(d)

Add data to the tracked data.

add_selections_data

add_selections_data(selections, task_ids=None)

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=True,
    save_results=False,
    figure_formats=None,
    reduced_selections=True,
)

Execute given experiment and store results.

evaluate_fit_mappings

evaluate_fit_mappings()

Evaluate fit mappings.

to_json

to_json(path=None, indent=2)

Convert experiment to JSON for exchange.

:param path: path for file, if None JSON str is returned :return:

to_dict

to_dict()

Convert to dictionary.

This is the basis for the JSON serialization.

from_json classmethod

from_json(json_info)

Load experiment from json path or str.

save_datasets

save_datasets(results_path)

Save datasets.

save_results

save_results(results_path)

Save results (mean timecourse).

:param results_path: :return:

create_mpl_figures

create_mpl_figures()

Create matplotlib figures.

show_mpl_figures

show_mpl_figures(mpl_figures)

Show matplotlib figures.

save_mpl_figures

save_mpl_figures(
    results_path, mpl_figures, figure_formats=None
)

Save matplotlib figures.

close_mpl_figures classmethod

close_mpl_figures(mpl_figures)

Close matplotlib figures.

ExperimentResult dataclass

ExperimentResult(experiment, output_path)

Result of a simulation experiment.

to_dict

to_dict()

Conversion to dictionary.

Used in serialization and required for reports.