sbmlsim.diff

Helpers for numerical comparison of simulation results between different simulators.

Allows to test semi-automatically for problems with the various models. Used to benchmark the simulation results.

Module Contents

Classes

DataSetsComparison

Comparing multiple simulation results.

Functions

get_files_by_extension(base_path, extension = '.json')

Get all files by given extension.

Attributes

logger

sbmlsim.diff.logger[source]
sbmlsim.diff.get_files_by_extension(base_path, extension='.json')[source]

Get all files by given extension.

Simulation definitions are json files.

Parameters
  • base_path (pathlib.Path) –

  • extension (str) –

Return type

Dict[str, str]

class sbmlsim.diff.DataSetsComparison(dfs_dict, columns_filter=None, time_column=True, title=None, selections=None, factors=None)[source]

Bases: object

Comparing multiple simulation results.

Only the subset of identical columns are compared. In the beginning a matching of column names is performed to find the subset of columns which can be compared.

The simulations must contain a “time” column with identical time points.

Parameters
  • dfs_dict (Dict[str, pandas.DataFrame]) –

  • time_column (bool) –

  • title (str) –

  • selections (Dict[str, str]) –

  • factors (Dict[str, float]) –

tol_abs = 0.0001[source]
tol_rel = 0.0001[source]
eps_plot[source]
classmethod _process_columns(cls, dataframes)[source]

Get the intersection and union of columns.

Parameters

dataframes

Returns

classmethod _filter_dfs(cls, dataframes, columns)[source]

Filter the dataframes using the column ids occurring in all datasets.

The common set of columns is used for comparison.

Parameters
  • dataframes

  • columns

Returns

List[pd.DataFrame], List[str], list of dataframes and simulator labels.

df_diff(self)[source]

Dataframe of all differences between the files.

https://github.com/sbmlteam/sbml-test-suite/blob/master/cases/semantic/README.md Let the following variables be defined:

  • abs_tol stand for the absolute tolerance for a test case,

  • rel_tol stand for the relative tolerance for a test case,

  • c_ij stand for the expected correct value for row i, column j, of the result data set for the test case

  • u_ij stand for the corresponding value produced by a given software simulation system run by the user

These absolute and relative tolerances are used in the following way: a data point u_ij is considered to be within tolerances if and only if the following expression is true:

|c_ij - u_ij| <= (abs_tol + rel_tol * |c_ij|)

is_equal(self)[source]

Check if DataFrames are identical within numerical tolerance.

__str__(self)[source]

Get string.

Return type

str

__repr__(self)[source]

Get representation.

report_str(self)[source]

Get report as string.

Return type

str

report(self)[source]

Report.

plot_diff(self)[source]

Plot lines for entries which are above epsilon treshold.