petab_v2.testsuite
The cases of the PEtab v2 test suite on disk.
The test suite has a group of
cases per model format and the cases of the math of PEtab, below
petabtests/cases/v2.0.0:
| group | case | compared |
|---|---|---|
sbml |
PetabCase |
log-likelihood, chi2, simulations, log prior, log posterior |
math |
MathCase |
the value of an expression of math_tests.yaml |
A case of a model is a directory named by its number with the problem
_<id>.yaml, the solution _<id>_solution.yaml and the simulations it
names. It is read with PetabReader, simulated at the nominal values of its
parameter table (PetabReader.nominal_parameters) and compared with the
tolerances of its solution. A math case compiles its expression with
sbmlsim.simulator.formula.compile_formula, which is what the formulas of
conditions, observables and noise are evaluated with.
The suite has no releases, so it is pinned by a commit. PetabSuite is the
directory of the groups with the download and the cache of the commit.
CaseStatus
¶
Bases: StrEnum
The outcome of a case.
CaseResult
dataclass
¶
The outcome of a case.
Attributes:
| Name | Type | Description |
|---|---|---|
group |
str
|
the group of the case, |
cid |
str
|
the number of the case, e.g. |
status |
CaseStatus
|
the outcome. |
message |
str
|
what failed, empty for a case which passes. |
max_difference |
float | None
|
the largest absolute difference to the reference
values, |
PetabCase
dataclass
¶
A case of a model of the PEtab v2 test suite.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
Path
|
the directory of the case. |
cid |
str
|
the number of the case, the name of its directory. |
group |
str
|
the group of the case, the format of its model. |
problem_file |
Path
|
the YAML file of the problem. |
solution |
dict[str, Any]
|
the content of the solution. |
from_directory
classmethod
¶
Read a case from its directory.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
the directory of the case. |
required |
group
|
str
|
the group of the case. |
SBML
|
Returns:
| Type | Description |
|---|---|
PetabCase
|
The case. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the directory has no problem or no solution. |
run
¶
Run the case.
Returns:
| Type | Description |
|---|---|
CaseResult
|
The outcome, |
MathCase
dataclass
¶
A case of the math of PEtab.
Attributes:
| Name | Type | Description |
|---|---|---|
index |
int
|
the position of the case in |
expression |
str
|
the math expression. |
expected |
float | str
|
its value, a number or a symbolic expression. |
run
¶
Compile the expression and compare its value.
A symbolic expression is evaluated with both at values of its symbols.
Returns:
| Type | Description |
|---|---|
CaseResult
|
The outcome, |
PetabSuite
dataclass
¶
The cases of a commit of the PEtab v2 test suite.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
Path
|
the directory which holds the directories of the groups, i.e.
|
commit |
str
|
the commit of the suite. |
cache_path
staticmethod
¶
Get the directory a commit of the suite is unpacked into.
SBMLSIM_PETAB_SUITE_PATH overrides it. Otherwise it is
sbmlsim/petab-test-suite/<commit> in the user cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commit
|
str
|
the commit of the suite. |
PETAB_SUITE_COMMIT
|
Returns:
| Type | Description |
|---|---|
Path
|
The directory the groups of the commit live in. |
cached
classmethod
¶
Get a commit of the suite if it is already on this machine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commit
|
str
|
the commit of the suite. |
PETAB_SUITE_COMMIT
|
Returns:
| Type | Description |
|---|---|
PetabSuite | None
|
The suite, or |
load
classmethod
¶
Get a commit of the suite, downloading it if it is not cached.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
commit
|
str
|
the commit of the suite. |
PETAB_SUITE_COMMIT
|
Returns:
| Type | Description |
|---|---|
PetabSuite
|
The suite with its cases unpacked in the cache. |
Raises:
| Type | Description |
|---|---|
OSError
|
if the commit cannot be downloaded. |
case_ids
¶
Get the numbers of the cases of a group of models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group
|
str
|
the group, i.e. the name of its directory. |
SBML
|
Returns:
| Type | Description |
|---|---|
list[str]
|
The names of the case directories, sorted, empty for a group the |
list[str]
|
suite does not have. |
run
¶
Run the cases of the suite.
Returns:
| Type | Description |
|---|---|
list[CaseResult]
|
The results of the group |
list[CaseResult]
|
order. |