testsuite.compare¶
Comparison of a simulation with the expected results of a case.
The SBML test suite accepts a value when
|value - expected| <= absolute + relative * |expected| at every time point,
with the tolerances of the case; the special values inf, -inf and nan
match only themselves. Species are expected either as amounts or
as concentrations (the amount and concentration lists of the settings);
a converted model carries every species in one quantity, so the columns are
converted with the compartment before the comparison.
VariableComparison
dataclass
¶
Result of one variable.
Comparison
dataclass
¶
Result of a case: every variable and the verdict.
max_excess
property
¶
Largest excess over the tolerance, negative when everything passes.
nan for a structural failure without variables.
CompareError
¶
Bases: ValueError
A result cannot be brought into the requested quantity.
compare
¶
Compare a simulation with the expected results.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
DataFrame
|
timecourse with a |
required |
expected
|
DataFrame
|
expected timecourse of the case. |
required |
settings
|
Settings
|
settings of the case (variables and tolerances). |
required |
Returns:
| Type | Description |
|---|---|
Comparison
|
The comparison; |
Comparison
|
at every time point. |
is_informative
¶
Whether the expected results move more than the tolerance band.
A case whose expected frame is (numerically) constant for every variable passes the comparison trivially no matter what the converters do; this flags that so it can be told apart from a genuine check.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
expected
|
DataFrame
|
the expected frame, i.e. the case's expected results or, when there are none, the roadrunner simulation of the original model. |
required |
settings
|
Settings
|
settings of the case (variables and tolerances). |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True when at least one settings variable present in |
bool
|
between the minimum and maximum of its finite values, by more than |
bool
|
|
species_quantities
¶
Quantity of the species variables of a converted model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
Model
|
the original SBML model. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, tuple[bool, str]]
|
Species id to |
dict[str, tuple[bool, str]]
|
converted variable is an amount when the flag is set, else a |
dict[str, tuple[bool, str]]
|
concentration. |
requested_frame
¶
The settings variables in the quantity the case expects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
timecourse of a converted model (every variable a column, including the compartments). |
required |
quantities
|
dict[str, tuple[bool, str]]
|
result of |
required |
settings
|
Settings
|
settings of the case. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
|
DataFrame
|
and concentration with their compartment column when needed. A |
DataFrame
|
variable missing in |
Raises:
| Type | Description |
|---|---|
CompareError
|
|