fit.petab_v2.extension¶
The sbmlsim extension of a PEtab v2 problem.
PEtab v2 problems carry extensions, i.e., a block in the YAML of the problem
which a tool reads if it knows it and ignores if it does not. The sbmlsim
extension holds what the tables of PEtab do not express, see
sbmlsim.fit.petab_v2.gaps: the units, the settings of the fit, what a fit
does with a mapping and the structure of the timecourses.
The extension is required, because the settings it carries are the objective
of the fit: a tool which does not know it has to reject the problem rather than
fit the same data with another objective without saying so. A round trip
through sbmlsim keeps the fit it started from, and
to_petab(..., required_extension=False) writes a problem which other tools
read and fit with the objective PEtab defines.
SbmlsimExtension
¶
Bases: ExtensionConfig
What PEtab v2 does not express about an sbmlsim fit.
PEtab says that an extension which changes the mathematical interpretation
of a problem must be required, and that a tool must reject a problem
which requires an extension it does not know but may ignore one which is
not required (PEtab v2, extensions). The settings this extension carries,
i.e. the residual, the loss function and the weighting, are the objective
sbmlsim optimizes, so a problem which is read without them is fitted with
a different objective on the same data. It is therefore required, and a
tool which does not know sbmlsim has to say so instead of fitting the
problem differently without telling anyone.
to_petab(..., required_extension=False) writes it as not required, which
is what a problem meant for other tools wants: they read the tables and
optimize the objective PEtab defines.
Attributes:
| Name | Type | Description |
|---|---|---|
version |
str
|
version of the extension. |
required |
bool
|
whether a tool needs the extension to interpret the problem,
|
opid |
str | None
|
id of the optimization problem. |
settings |
dict[str, Any]
|
the |
parameters |
dict[str, dict[str, Any]]
|
unit, start value and, when set, the scale of every fit parameter which is no element of a network. |
observables |
dict[str, dict[str, Any]]
|
the fit mapping behind every observable, keyed by the fit mapping (an observable measured in several experiments is one observable of several fit mappings): the observable, its kind, the weight of the curve, the units of the data, the experiment and the task it belongs to and the metadata of the curve. |
experiments |
dict[str, dict[str, Any]]
|
the structure of the |
collections |
dict[str, dict[str, Any]]
|
the |
models |
dict[str, dict[str, Any]]
|
the settings of the integrator per model. |
inputs |
dict[str, str]
|
the formula of an input of a network for the simulations
without a formula of their own, in the math of PEtab, by the id
of the input. The conditions of these experiments repeat it, see
|
gaps |
list[dict[str, Any]]
|
what this export lost, see |
extension_of
¶
Get the sbmlsim extension of a PEtab problem configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Any
|
|
required |
Returns:
| Type | Description |
|---|---|
SbmlsimExtension | None
|
The extension, or |
known_extensions
¶
Get the extensions the reader interprets in this environment.
Returns:
| Type | Description |
|---|---|
frozenset[str]
|
|
frozenset[str]
|
|
check_extensions
¶
Check the extensions of a problem against the ones the reader knows.
PEtab says that a tool must reject a problem which requires an extension
it does not know and may ignore an extension which is not required (PEtab
v2, extensions). A block without required is read as required, which is
the safe reading of a block that does not say.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
extensions
|
Mapping[str, Any] | None
|
the blocks of the problem by the id of the extension, as
the dictionaries of the YAML or as the |
required |
known
|
Collection[str] | None
|
ids of the extensions the reader interprets,
|
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
The ids of the extensions which are to be ignored, i.e. the ones |
list[str]
|
which are not known and not required, in the order of the problem. |
list[str]
|
The reader logs them. |
Raises:
| Type | Description |
|---|---|
ImportError
|
if the problem requires the extension of PEtab SciML
and the extra |
ValueError
|
if the problem requires an extension which is not known. |