Skip to content

verify.dump

Run the experiments of a project and store what they produce, verify dump.

Dump

Bases: TypedDict

Everything dump stores of the experiments of a model.

serialize

serialize(obj, depth=0)

Serialize the attributes of an object (a figure) into json values.

References back to the experiment and to parents are replaced by their type, so that the specification of a figure only contains the figure.

metadata_names

metadata_names(metadata)

Get the metadata of a fit mapping as {field: name}.

Enum members are stored by name, so a change of their values or of the enum type (StrEnum) does not count as a change.

describe_mapping

describe_mapping(key, mapping)

Describe a fit mapping by its data, its observable, weight and metadata.

mapping_range

mapping_range(mapping)

Get the range of the x values of the data and of the simulation of a mapping.

The data are converted into the unit of the simulation.

on_grid

on_grid(simulation, n)

Get a simulation with a common fixed output grid (dump --grid).

The output times are n + 1 equidistant times from the start to the end of the simulation and the times of its changes (and of the dimensions of a scan with a time), in the time unit of the simulation; the steps or times of the simulation are replaced, everything else stays. The output of the integrator differs between two runs whose model or tolerances differ; on this grid both dumps of a compare have the same times, which are matched exactly, without interpolation, so a compare resolves its threshold (a migration compare dumps both models with --grid).

A scan has its simulation on the grid and every simulation of a dimension of simulations, each on the grid of its own start, end and changes.

Parameters:

Name Type Description Default
simulation Simulation | Scan

the simulation or the scan.

required
n int

the number of intervals of the grid.

required

Returns:

Type Description
Simulation | Scan

The simulation or the scan on the grid, a new object.

Raises:

Type Description
ValueError

for an object which is no simulation or scan, or a time which is a quantity of a simulation without a time unit.

defined_experiments

defined_experiments(project, errors)

Get the experiments defined in the modules of the experiments of a project.

Every subclass of SimulationExperiment defined in the modules of the project (CheckSettings.experiment_modules below its package) counts, except the classes from which another found class derives (the base experiments), see sbmlsim.project_checks.defined_experiments.

Parameters:

Name Type Description Default
project Project

the project.

required
errors dict[str, str]

the traceback of every module which does not import is added here, as import:<module>.

required

Returns:

Type Description
list[type[SimulationExperiment]]

The experiment classes in the order of module name and definition.

variant_of

variant_of(project, experiment, task)

Get the variant of the model a task of an experiment runs on.

The experiment decides (SimulationExperiment.variant_of, the hook of a framework which builds a model per group of subjects); else the variant of the project whose file is the source of the model of the task; None for a model which is none of the variants.

Parameters:

Name Type Description Default
project Project

the project.

required
experiment SimulationExperiment

the experiment, initialized.

required
task str

the key of the task.

required

Returns:

Type Description
str | None

The name of the variant, or None.

package_versions

package_versions(project)

Get the versions of the packages which make a dump.

sbmlsim, the distribution of the package of the project and, for a project with release settings, the libraries of the release (core_libraries) which are installed.

Parameters:

Name Type Description Default
project Project

the project.

required

Returns:

Type Description
dict[str, str]

The version by name of the distribution.

dump

dump(args)

Run the experiments of a project and store everything in a pickle.

Returns:

Type Description
int

1 if an experiment failed, else 0.

Raises:

Type Description
UsageError

for an unknown experiment or tolerance, or a project without experiments.

store_experiment

store_experiment(result, sid, experiment, project)

Store the results, datasets, fit mappings and figures of a run experiment.

The time of a grid is a coordinate of a result; it is stored as the variable time over ("time",), which the comparison reads. The variant of the build of every task is stored (builds, see variant_of), so that a study which moves to the build of another variant is a difference of its own.

figure_spec

figure_spec(figure, experiment)

Get the specification of a figure, its attributes as json.

RESOLVED adds the settings of the experiment and of the figure (the figure_settings of the experiment overridden by the settings of the figure) and the width and height the figure is rendered with, as sbmlsim resolves them without the settings of a run, so that compare sees a change of a setting of the experiment or of the size of the panels.

load

load(path)

Load a dump.