Skip to content

fit.petab_v2.gaps

What PEtab v2 does not express about an sbmlsim optimization problem.

PEtab describes a parameter estimation problem as tables: a model, the conditions and experiments it is simulated under, the observables, the measurements and the parameters. sbmlsim describes more than that, i.e., the units of everything, what a fit does with a subset of the data and how the residuals are weighted, and less of it in tables: a SimulationExperiment is python and its data can be a function of other data.

This module is the catalogue of the differences. Every Gap says what sbmlsim has, what PEtab v2 offers for it and what the layer does about it, and gaps_of_problem reports the gaps a given problem actually runs into, so that what a specific export loses is known before it is written.

GapKind

Bases: StrEnum

What the layer does about a difference to PEtab v2.

EXTENSION class-attribute instance-attribute

EXTENSION = 'extension'

PEtab has no place for it, the sbmlsim extension of the problem carries it, so the round trip through sbmlsim is exact. The extension is required, i.e. a tool which does not know it rejects the problem rather than reading it without the information; required_extension=False writes a problem for other tools.

LOSSY class-attribute instance-attribute

LOSSY = 'lossy'

The information is transformed and the round trip is not exact, i.e., the problem which is read back is not the problem which was written.

UNSUPPORTED class-attribute instance-attribute

UNSUPPORTED = 'unsupported'

The export raises, there is no representation which keeps the meaning of the fit.

Gap dataclass

Gap(id, kind, sbmlsim, petab, detail)

A difference between an sbmlsim fit and a PEtab v2 problem.

Attributes:

Name Type Description
id str

identifier of the gap.

kind GapKind

what the layer does about it.

sbmlsim str

what sbmlsim has.

petab str

what PEtab v2 offers for it, - if it offers nothing.

detail str

what the layer does and what it costs.

gaps_of_problem

gaps_of_problem(problem)

Report the gaps an optimization problem runs into.

The problem must be initialized, i.e., its mappings are resolved; the gaps of the data are only known then.

Parameters:

Name Type Description Default
problem OptimizationProblem

the problem which is exported.

required

Returns:

Type Description
list[Gap]

The gaps which apply to this problem, in the order of GAPS.

Raises:

Type Description
ValueError

if the problem is not initialized.

gaps_table

gaps_table(gaps, title=None)

Get the table of the gaps for the console.

Parameters:

Name Type Description Default
gaps Iterable[Gap]

gaps to show.

required
title str | None

title of the table.

None

Returns:

Type Description
Table

The table of the gaps with their kind and what the layer does.

gaps_dict

gaps_dict(gaps)

Get the gaps as dictionaries, i.e., for a report or the extension.