project¶
The project of a model package: its models, analyses and settings.
A Project describes a model package once: its model variants and the factory
which builds them, its simulation experiments, its fit problems and the records
of its adopted fits, its scans with their sensitivity indices, its
sensitivity analyses over the groups of its simulations, its uncertainty
analyses and its actions (analyses of its own), the settings of
the simulator and of the figures, the known exceptions of its checks
(sbmlsim.project_checks) and its release metadata. It is a description,
nothing of it runs when it is created.
A model package defines its project as an attribute of a module, e.g.
examples.hctz_fitting.project:PROJECT, which load_project imports. The run
layer, python -m sbmlsim.run, resolves a spec {project: "module:attribute",
analysis: name} (or subset: name for a fit) against it and lists the
analyses of a project with python -m sbmlsim.run list <project>, see
Project.analyses.
The experiments, the fits, the factory, the credibility declaration, the
sensitivity analyses and the functions of the actions of a project are objects
or references "module:attribute" to them, which are resolved when they are
used (resolve) and kept, so that importing the module of a project imports none
of them: the experiments import the module of their project for its paths,
so the project cannot import them, and a package of many models stays cheap to
import. A module which starts with a dot is relative to
Project.package. The scans, the observables and the uncertainty models are
python callables which build their objects when an analysis runs, so every
unit of a run builds the same objects from them, which is why every callable
must build a deterministic object, e.g. a design with a fixed seed.
A relative path of a project (its model variants, the paths of its experiments,
the directory of its fit records and the file of its adopted fits) is relative
to its root, the directory of the model package; the outputs of a run are
not: they go where the run is told, e.g. Project.run_experiments(..., out).
The adopted fits of a project are the fits whose parameters the package uses,
one fit id per fit subset, kept in the file ADOPTED_FILE, by default in the
directory of the records of the adopted fits (Project.fits_dir):
{"fits": {"<subset>": "<fit id>"}}, written by write_adopted.
import sbmlsim does not import this module.
SimulatorSettings
¶
Bases: BaseModel
The settings of the simulator of the analyses of a project.
The processes are no setting of a project, they belong to a run, see
simulator.
Attributes:
| Name | Type | Description |
|---|---|---|
engine |
Engine
|
the engine which simulates the models. |
absolute_tolerance |
float | AbsoluteTolerance | None
|
the absolute tolerance of the integrator, one value
or an |
relative_tolerance |
float | None
|
the relative tolerance of the integrator; |
jit_optimization |
JitOptimization | None
|
the optimization level LLJIT compiles the models of
the experiments, the fits and the tests of the project with
( |
integrator |
dict[str, Any]
|
the other settings of the integrator by their names in
roadrunner, see |
integrator_settings
¶
Get the settings of the integrator, the tolerances with the others.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The settings by their names in roadrunner. |
FigureOutputs
¶
Bases: BaseModel
The files of the figures of the runs of a project.
The rendering of a figure (the resolution, the sizes of the panels, the
fonts and the legends) is Project.figure_settings, the
sbmlsim.plot.FigureSettings of every figure of a run; these are the
formats of the files and the parameters of matplotlib while the figures of
a run are drawn.
Attributes:
| Name | Type | Description |
|---|---|---|
formats |
tuple[str, ...]
|
the formats of the figures, static images drawn by matplotlib
( |
savefig_dpi |
float | None
|
the resolution of the static images, the |
rc |
dict[str, Any]
|
other parameters of matplotlib while the figures are drawn, e.g.
|
rc_params
¶
Get the parameters of matplotlib while the figures of a run are drawn.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
|
CheckSettings
¶
Bases: BaseModel
The known exceptions of the checks of a model package, each with its reason.
The checks are the functions of sbmlsim.project_checks.
Attributes:
| Name | Type | Description |
|---|---|---|
experiment_modules |
str
|
the module of the experiments relative to the
package, a package whose modules define the experiment classes or
a module which defines them, see
|
not_registered |
Mapping[str, str]
|
experiment classes which are defined but not in the
group |
not_importable |
Mapping[str, str]
|
modules below the package which do not import in the
test environment (an optional dependency), by their name relative to
the package, e.g. |
one_at_a_time |
str | None
|
why the checks run the experiments one at a time (the
memory a run of all of them needs), |
battery |
Mapping[str, str]
|
the checks of the battery of the model which fail, by the
name of the check, e.g. |
CredibilitySettings
¶
Bases: BaseModel
The settings of the credibility of a project which belong to its domain.
The declaration of the contexts of use (Project.credibility) is checked
and assessed with them, see sbmlsim.credibility.
Attributes:
| Name | Type | Description |
|---|---|---|
metadata_type |
Any
|
the metadata of the fit mappings of the project, a
dataclass derived from |
domain_fields |
tuple[str, ...] | None
|
the fields of the metadata a domain of a context of
use can claim, every field whose type is an enum without, see
|
extensions |
tuple[Any, ...]
|
the evidence extensions of the project, instances of
|
battery |
Any
|
the battery hook of the project, which adds the simulations
and checks of its domain to the battery of its variants, an
instance of |
battery_settings |
Mapping[str, Any]
|
the settings of the battery over the ones of the
hook (the defaults without one), by the names of the fields of
|
ScanAnalysis
¶
Bases: BaseModel
A scan of a project, with its sensitivity indices if it has a design.
The fields are the arguments of Simulator.run.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
Path | str
|
the model of the scan, a path or a source of
|
scan |
Callable[[], Scan | Simulation]
|
builds the scan or the simulation, deterministic: a design of
|
observables |
Callable[[], Sequence[Observable]] | None
|
builds the observables of the run. |
time |
Sequence[float] | None
|
a grid of times in the time unit of the model the timecourses are interpolated onto; the output times of the simulations without. |
keep |
Sequence[str] | None
|
the observables or selections the result keeps. |
on_error |
Literal['raise', 'flag']
|
|
indices |
Literal['local', 'sobol', 'fast', 'morris'] | None
|
the sensitivity indices of the scan, a function of
|
index_options |
dict[str, Any]
|
the keyword arguments of the function of the indices. |
description |
str
|
what the scan analyses. |
UncertaintyAnalysis
¶
Bases: BaseModel
An uncertainty analysis of a project.
The fields are the arguments of sbmlsim.uncertainty.propagate.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
Path | str
|
the model, a path or a source, see |
simulation |
Callable[[], Simulation | Mapping[str, Simulation]]
|
builds the simulation or the scenarios by their name. |
uq |
Callable[[], UncertaintyModel]
|
builds what is uncertain. |
observables |
Callable[[], Sequence[Observable]] | None
|
builds the observables of the runs, e.g. a |
outputs |
Sequence[str] | None
|
the outputs of the summary and the adaptive stopping. |
n |
int | None
|
the number of draws; |
rel_tol |
float
|
the tolerance of the adaptive stopping. |
n_start |
int
|
the draws of the first batch of the adaptive stopping. |
n_max |
int
|
the most draws of the adaptive stopping. |
design |
Literal['sobol', 'lhs', 'random'] | None
|
|
seed |
int | None
|
the seed of the draws. |
keep |
Sequence[str] | None
|
the timecourses the results keep. |
time |
Sequence[float] | None
|
a grid of times in the time unit of the model the timecourses are interpolated onto. |
on_error |
Literal['raise', 'flag']
|
|
description |
str
|
what the analysis answers. |
ActionFunction
¶
Bases: Protocol
The function of an action of a project, see ProjectAction.
It is called with the project, the output directory of the run, which
exists and which the action writes into, the number of processes the run
may use and the arguments of the spec of the run as keywords, and returns
the summary of the run, JSON values by name, or None.
ProjectAction
¶
Bases: BaseModel
An action of a project, an analysis of its own, e.g. a table of its studies.
The kind action of the run layer runs it into its output directory,
python -m sbmlsim.run action <spec> with the spec {project, name,
arguments}, see sbmlsim.run.project_kinds.
Attributes:
| Name | Type | Description |
|---|---|---|
function |
Callable[..., Any] | str
|
the function of the action, see |
description |
str
|
what the action does, its entry in |
Project
¶
Bases: BaseModel
A model package: its models, analyses and settings, see the module.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
the name of the project. |
root |
Path
|
the directory of the model package; the relative paths of the project are relative to it. |
package |
str | None
|
the dotted name of the model package, e.g. |
title |
str
|
the title of the model in its reports, e.g. the title of the report of a fit; the name without. |
description |
str
|
what the project is. |
variants |
Mapping[str, Path]
|
the SBML files of the model by the name of its variant, e.g.
|
factory |
Callable[[Path], Any] | str | None
|
builds the models, a function called with the directory it
writes into, or a reference to it, see |
factory_dir |
Path | None
|
the directory the factory writes into in the package,
the directory of the first variant without; inside of |
factory_outputs |
Sequence[Path]
|
the files the factory writes, relative to |
experiments |
Callable[[], _Experiments] | _Experiments | str | None
|
the simulation experiment classes, a sequence of them,
groups of them by name (the group |
base_path |
Path | None
|
the base path of the experiments, |
data_path |
Path | Sequence[Path] | None
|
the path or paths of the datasets of the experiments. |
fits |
Mapping[str, FitDefinition] | str
|
the fit problems by their subset, or a reference to them; see
|
fits_dir |
Path | None
|
the directory of the records of the adopted fits, one
directory per fit id, see |
adopted |
Path | None
|
the file of the adopted fits, |
credibility |
Any
|
the declaration of the contexts of use of the model, or a
reference to it, see |
credibility_settings |
CredibilitySettings
|
the metadata of the fit mappings, the fields of it a domain can claim and the evidence extensions of the credibility of the project. |
scans |
Mapping[str, ScanAnalysis]
|
the scans by their name. |
uncertainties |
Mapping[str, UncertaintyAnalysis]
|
the uncertainty analyses by their name. |
sensitivities |
Mapping[str, Any]
|
the sensitivity analyses of the model over the groups
of its simulations by their name, see
|
actions |
Mapping[str, ProjectAction]
|
the actions of the project by their name, analyses of its
own which the kind |
simulator |
SimulatorSettings
|
the settings of the simulator of the analyses. |
figure_settings |
FigureSettings | None
|
the settings of the rendering of the figures of a run. |
figures |
FigureOutputs
|
the formats of the figures of a run and the parameters of matplotlib while they are drawn. |
checks |
CheckSettings
|
the known exceptions of the checks of the model. |
release |
InstanceOf[ReleaseSettings] | None
|
the release metadata, |
model_path
property
¶
Get the SBML file of the default variant of the model.
Returns:
| Type | Description |
|---|---|
Path
|
The path of the first variant. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no model variants. |
adopted_file
property
¶
The file of the adopted fits: adopted, else ADOPTED_FILE in fits_dir.
replace
¶
Get a copy of the project with other fields, validated again.
The copy is created by the constructor, so the references are checked
and relative paths of the changes are relative to root, unlike
model_copy(update=...), which validates nothing. The paths of the
project are stored relative to its root, i.e. absolute: a change of
root alone does not move them, and the directory of the factory
which the project derived from its first variant stays unless it is
changed as well.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
**changes
|
Any
|
the fields and their new values. |
{}
|
Returns:
| Type | Description |
|---|---|
Self
|
The new project. |
Raises:
| Type | Description |
|---|---|
ValidationError
|
for invalid fields. |
variant_path
¶
Get the SBML file of a variant of the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variant
|
str | None
|
the name of the variant, the first variant without. |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The path of the SBML file. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no model variants. |
KeyError
|
naming the variants, for an unknown variant. |
load_roadrunner
¶
Load a variant of the model in roadrunner at the level of the project.
The model is compiled with LLJIT at SimulatorSettings.jit_optimization
(sbmlsim.model.model_roadrunner.load_roadrunner), as the experiments
of the project load it, and not with roadrunner's default MCJIT, which
compiles a model with large initial assignments much slower: the
loader of the tests of a model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variant
|
str | None
|
the name of the variant, the first variant without. |
None
|
Returns:
| Type | Description |
|---|---|
RoadRunner
|
The roadrunner instance. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no model variants. |
KeyError
|
for an unknown variant. |
load_factory
¶
Get the function which builds the models.
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no factory. |
TypeError
|
if the factory is not callable. |
create_models
¶
Build the models with the factory, in place or into a rebuild.
By default the factory builds the models in place, into factory_dir.
A rebuild into another directory out keeps the layout of the
package: the factory writes into out / factory_dir.relative_to(root),
so an output o of factory_outputs is out / o there and root / o
in the package, see factory_paths and changed_outputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out
|
Path | None
|
the root of a rebuild, the package ( |
None
|
Returns:
| Type | Description |
|---|---|
Path
|
The directory the factory wrote into. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no factory or no directory of it. |
factory_paths
¶
Get the files the factory writes, factory_outputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out
|
Path | None
|
the root of a rebuild with the layout of the package, see
|
None
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
The paths of the outputs. |
compared_outputs
¶
Get the outputs of the factory which a rebuild compares with the package.
These are the factory_outputs. A project which declares none
compares what the rebuild wrote: the variants of the model and every
file the factory wrote into its directory which the package has as
well (a file the package does not have, e.g. an ignored one, is left
out), so a rebuild is never compared on nothing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out
|
Path
|
the root of a rebuild, see |
required |
Returns:
| Type | Description |
|---|---|
list[Path]
|
The outputs relative to the root, the declared ones in their |
list[Path]
|
order, else sorted. |
changed_outputs
¶
Get the outputs of the factory whose rebuild differs from the package.
Every output of compared_outputs is compared with the one of the
package, the SBML of a model without the dates of its model history
(same_sbml), its antimony (.ant) without the dates of its history
(same_antimony), any other file by its bytes; an output which only one
of them has differs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
out
|
Path
|
the root of a rebuild, see |
required |
Returns:
| Type | Description |
|---|---|
list[Path]
|
The outputs which differ, relative to the root, in the order of |
list[Path]
|
|
load_credibility
¶
Get the declaration of the contexts of use of the model.
A declaration of sbmlsim.credibility is checked against the
credibility settings of the project: its domains against the fields of
the metadata (domain_fields), the settings of the extensions of its
contexts and the pairings of its ratio quantities against the evidence
extensions (evidence_extensions,
sbmlsim.credibility.Credibility.extension_problems); any other
object is returned as it is.
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no declaration, or its credibility
settings are invalid (see |
DeclarationError
|
with the problems of the domains, the settings and the pairings of a declaration. |
metadata_type
¶
Get the metadata of the fit mappings of the project.
Returns:
| Type | Description |
|---|---|
type
|
The class of |
type
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
if a reference is no class. |
domain_fields
¶
Get the fields of the metadata a domain can claim with their enum.
Returns:
| Type | Description |
|---|---|
dict[str, type[StrEnum]]
|
The enum of every field, see |
evidence_extensions
¶
Get the evidence extensions of the credibility of the project.
Returns:
| Type | Description |
|---|---|
list[Any]
|
The extensions, the references resolved, in their order. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if an extension is no
|
battery_hook
¶
Get the battery hook of the credibility of the project.
Returns:
| Type | Description |
|---|---|
BatteryHook | None
|
The hook, the reference resolved, |
BatteryHook | None
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
if the hook is no
|
release_hook
¶
Get the release hook of the project, see ReleaseSettings.hook.
Returns:
| Type | Description |
|---|---|
ReleaseHook
|
The hook, the reference resolved; the hook which adds nothing, |
ReleaseHook
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
if the hook is no |
action
¶
Get an action of the project.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the name of the action. |
required |
Returns:
| Type | Description |
|---|---|
ProjectAction
|
The action. |
Raises:
| Type | Description |
|---|---|
KeyError
|
naming the actions, for an unknown action. |
load_action
¶
Get the function of an action of the project, see ActionFunction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the name of the action. |
required |
Returns:
| Type | Description |
|---|---|
ActionFunction
|
The function. |
Raises:
| Type | Description |
|---|---|
KeyError
|
naming the actions, for an unknown action. |
TypeError
|
if the function is not callable. |
load_experiments
¶
Get the groups of the simulation experiments by their name.
The group ALL_EXPERIMENTS (all) has every experiment of the
project: the group of that name, else every experiment of the groups
once in their order; experiments which are not grouped are the group
all alone.
Returns:
| Type | Description |
|---|---|
dict[str, list[type[SimulationExperiment]]]
|
The experiment classes by group. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no experiments, or two experiment classes have one name. |
TypeError
|
if an experiment is no |
experiment_classes
¶
Get experiment classes by the names of their groups or classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
names
|
Sequence[str] | None
|
names of groups or of experiment classes, every experiment
of the project (the group |
None
|
Returns:
| Type | Description |
|---|---|
list[type[SimulationExperiment]]
|
The experiment classes, every class once in the order of the names. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no experiments, or two experiment classes have one name. |
KeyError
|
naming the groups and the experiments, for a name which is neither. |
experiment_runner
¶
Initialize experiments of the project, as its runs do.
The experiments get the paths of the project (its base_path, else its
root, and its data_path) and their models are compiled at its level
(SimulatorSettings.jit_optimization).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experiment_classes
|
Iterable[type[SimulationExperiment]]
|
the classes of the experiments. |
required |
simulator
|
Simulator | None
|
the simulator of the tasks, see |
None
|
on_error
|
Literal['raise', 'log']
|
whether an experiment which cannot be initialized
raises or is logged, see |
'log'
|
Returns:
| Type | Description |
|---|---|
ExperimentRunner
|
The runner with the initialized experiments. |
run_experiments
¶
run_experiments(
experiments,
out,
*,
n_workers=None,
scan_workers=None,
simulator=None,
figure_formats=None,
save_results=False,
reduced_selections=True,
show_report=False,
progress=None,
raise_on_failure=True,
uncertainty=None,
collect_figures=False,
)
Run simulation experiments of the project and write their report.
The experiments run with the settings of the simulator of the project,
their figures with its figure settings and in its formats, see
sbmlsim.experiment.runner.run_experiments. Every experiment runs, also
after another one failed. The run layer (the kind simulate) calls this
implementation as Project.run_experiments(project, ...), so a subclass
may override the method with another signature and result without
breaking it.
With uncertainty the experiments run over draws of the fitted
parameters of the model: the parameters of the default variant which
have a distribution are drawn once (UncertaintyRun.create), every
experiment runs every simulation over the draws and draws the curves
of the simulations as bands, see sbmlsim.experiment.draws.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experiments
|
Sequence[str] | Sequence[type[SimulationExperiment]] | type[SimulationExperiment] | None
|
the experiment classes, or names of groups or classes
( |
required |
out
|
Path | str
|
the directory of the results and the report; a relative directory is relative to the current directory. |
required |
n_workers
|
int | None
|
the processes of the run, of the pool of the experiments
and, without |
None
|
scan_workers
|
int | None
|
the processes of the scans of the simulator, |
None
|
simulator
|
SimulatorSettings | None
|
the settings of the simulator, the ones of the project without. |
None
|
figure_formats
|
Sequence[str] | None
|
the formats of the figures, the ones of the project
( |
None
|
save_results
|
bool
|
write the results of the tasks. |
False
|
reduced_selections
|
bool
|
simulate only the selections an experiment uses. |
True
|
show_report
|
bool
|
open the report in a web browser. |
False
|
progress
|
bool | None
|
show the progress and the timings on the console, see
|
None
|
raise_on_failure
|
bool
|
raise when an experiment or a figure failed, after every experiment ran and the report was written (and the figures were collected). |
True
|
uncertainty
|
UncertaintySettings | None
|
run the experiments over draws of the fitted
parameters, |
None
|
collect_figures
|
bool
|
copy the static figures of every experiment
( |
False
|
Returns:
| Type | Description |
|---|---|
list[ExperimentResult]
|
The results of the experiments. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has no experiments, or with
|
KeyError
|
for an unknown name of an experiment. |
TypeError
|
if |
ExperimentRunError
|
with |
load_fit_definitions
¶
Get the fit problems by their subset, at the level of the project.
A definition without an optimization level gets the one of the
simulator of the project (SimulatorSettings.jit_optimization), so its
problems compile their models at it in every process.
Returns:
| Type | Description |
|---|---|
dict[str, FitDefinition]
|
The definitions by subset, empty for a project without fits. |
Raises:
| Type | Description |
|---|---|
TypeError
|
if the fits are no fit definitions by subset. |
ValueError
|
for a subset named |
fit
¶
Get a fit problem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subset
|
str
|
the subset of the fit. |
required |
Returns:
| Type | Description |
|---|---|
FitDefinition
|
The definition of the fit, see |
Raises:
| Type | Description |
|---|---|
KeyError
|
naming the subsets, for an unknown subset. |
TypeError
|
if the fits are no fit definitions by subset. |
ValueError
|
for a subset named |
adopted_fits
¶
Get the adopted fits.
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
The fit id by subset; empty without the file of the adopted fits. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the file is no file of adopted fits. |
adopted_record
¶
Get the directory of the records of an adopted fit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fit_id
|
str
|
the id of the fit, e.g. |
required |
Returns:
| Type | Description |
|---|---|
Path
|
The directory |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the id is not the id of a fit
( |
FileNotFoundError
|
if the record of the fit has no parameters. |
fit_records
¶
Get the records of the adopted fits: the fitted values and their uncertainty.
A model file of the factory takes the value of a fitted parameter
with its uncertainty from them, fit_records().parameter(pid,
unit=...), see sbmlsim.fit.records.AdoptedRecords.
Returns:
| Type | Description |
|---|---|
AdoptedRecords
|
The records of the adopted fits of |
AdoptedRecords
|
none for a project without adopted fits. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the project has adopted fits and no |
FileNotFoundError
|
if the record of an adopted fit does not exist. |
scan
¶
Get a scan.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the name of the scan. |
required |
Returns:
| Type | Description |
|---|---|
ScanAnalysis
|
The scan. |
Raises:
| Type | Description |
|---|---|
KeyError
|
naming the scans, for an unknown scan. |
uncertainty
¶
Get an uncertainty analysis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the name of the analysis. |
required |
Returns:
| Type | Description |
|---|---|
UncertaintyAnalysis
|
The uncertainty analysis. |
Raises:
| Type | Description |
|---|---|
KeyError
|
naming the analyses, for an unknown analysis. |
sensitivity
¶
Get a sensitivity analysis over the groups of the simulations, resolved.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
the name of the analysis, a key of |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The |
Any
|
project ( |
Raises:
| Type | Description |
|---|---|
KeyError
|
naming the analyses, for an unknown analysis. |
TypeError
|
for a reference to neither runners nor a runner. |
ValueError
|
for a runner of another project. |
analyses
¶
List the analyses of the project.
Resolves the fits of the project and, with experiments, its
experiments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
experiments
|
bool
|
also list the groups of the simulation experiments
and every experiment, which the kind |
False
|
Returns:
| Type | Description |
|---|---|
list[dict[str, str]]
|
One entry |
list[dict[str, str]]
|
simulation experiments ( |
list[dict[str, str]]
|
every other group and every experiment class), the analyses of |
list[dict[str, str]]
|
every fit subset ( |
list[dict[str, str]]
|
|
list[dict[str, str]]
|
sensitivity analysis ( |
list[dict[str, str]]
|
over groups ( |
list[dict[str, str]]
|
( |
list[dict[str, str]]
|
( |
check_reference
¶
Check that a reference has the form "module:attribute".
The module may start with dots (relative to a package), the attribute may be dotted (an attribute of an attribute).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
str
|
the reference to check. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the reference does not have the form. |
same_sbml
¶
Compare the SBML of two models without the dates of their model history.
A factory writes the dates of its run into the model history, so a rebuild of an unchanged model differs from the model only in the lines of these dates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
str
|
the content of one file. |
required |
b
|
str
|
the content of the other. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether they are equal but for the lines with a date. |
same_antimony
¶
Compare the antimony of two models without the dates of their history.
A factory which writes the antimony of a model writes the dates of its run
as model created "..." and model modified "...".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
a
|
str
|
the content of one file. |
required |
b
|
str
|
the content of the other. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether they are equal but for the lines with a date. |
resolve
¶
Resolve a reference "module:attribute" to the object it names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reference
|
str
|
the reference; a module which starts with a dot is relative
to |
required |
package
|
str | None
|
the package of relative references. |
None
|
Returns:
| Type | Description |
|---|---|
Any
|
The object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the reference is malformed or relative without a package. |
AttributeError
|
if the module has no such attribute; the message names the reference. |
normalize_formats
¶
Get figure formats as a lower-case tuple.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
formats
|
Sequence[str]
|
the formats, e.g. |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, ...]
|
The formats in lower case, e.g. |
Raises:
| Type | Description |
|---|---|
TypeError
|
if the formats are a single string, e.g. |
load_project
¶
Load a project from its reference.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ref
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
Project
|
The project. |
Raises:
| Type | Description |
|---|---|
ValueError
|
for a reference without |
ImportError
|
if the module is not imported. |
collect_figure_files
¶
Copy the static figures of a run of experiments into one directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_path
|
Path
|
the output of the run. |
required |
show
|
bool
|
show the link of the directory on the console of the package; a command whose stdout carries its result, e.g. the build of a release, shows none. |
True
|
Returns:
| Type | Description |
|---|---|
Path
|
The directory of the figures, |
Path
|
every figure of |
write_adopted
¶
Write the adopted fits of a project, atomically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
the file, see |
required |
fits
|
Mapping[str, str]
|
the fit id by subset. |
required |