Release notes for sbmlsim 0.8.0
A feature release: hybrid problems of an SBML model and neural networks (PEtab SciML), simulations without intermediate data frames, reports which show their figures again, and every dependency at its latest release.
Features
- PEtab SciML: hybrid problems of an SBML model and neural networks (#207, #226). Problems of PEtab SciML, in which an SBML model is hybridized with neural networks, are read, simulated with roadrunner, evaluated, fitted and written back.
sbmlsim.sciml(the extrasciml:petab-sciml,h5py,pyyaml) holdsNetworkwith its files, its forward pass in numpy and the ids of its elements, the layers of the format (convolution, pooling, normalization,Linear,Bilinear,Flatten, the activations),Hybridizationwith its three patterns, andcompile_network, which writes a feed-forward network into the SBML model as parameters with assignment rules. A network before the simulation runs in numpy and sets changes of the simulation, a network in the right hand side or in an observable is simulated by roadrunner - the fit of a hybrid problem: derived changes of a problem (
OptimizationProblem(hybridizations=...)),FitParameter.scaleper parameter, infinite bounds on the linear scale,SamplingType.STARTandHybridization.fit_parameters; a hybrid fit is defined in python without PEtab and runs in parallel - the PEtab v2 layer:
log_likelihoodandgradientof a problem with the noise models of PEtab v2, the reader of PEtab SciML problems (withouttorch), the export of hybrid problems with an exact round trip,to_petab(parameter_set=...)and the record of a derived model (model/provenance.py); a foreign extension withrequired: trueis refused - the PEtab SciML test suite runs pinned by its commit (
tox r -e sciml, and thetestsuitejob of a release):ml_model_import53 of 54,initialization3 of 3,sciml_problem_import36 of 39 (032 to 034 need priors, #190), and the 36 problems which are read are written back exactly - the console and the report of a fit show a network as one row per array, the networks are in the overview, the bound warnings and the Fisher table are per array and the profiles default to the parameters which are no elements of a network
- the examples
examples/sciml/: the Lotka-Volterra problem of the test suite read, fitted and written, and a neural ODE defined in python and fitted in parallel; PEtab documents the layers
Performance
- simulations answer with the arrays of roadrunner instead of data frames (#215, #228). A timecourse built a pandas
DataFrameper timecourse, concatenated the frames and looked their columns up again, which took a third of the time of the residuals of a fit and half of the time of a scan.TimecourseResult(sbmlsim.result) is the array roadrunner returns with the names of its columns,XResult.from_timecoursesplaces the results of a scan with one assignment per simulation, and the residuals of a fit read the columns as views: the residuals of the HCTZ PK problem take 17.2 ms instead of 21.3 ms and a scan of 200 timecourses 475 ms instead of 670 ms, with identical results. pandas stays for the tables of the reports and forDataSet. polars was evaluated and is slower than pandas for these frames; numba was evaluated for the fits and the sensitivity analyses (#217) and is not used, since the integration by roadrunner is 86% of a fit and 91% of a sensitivity analysis
Fixes
- the reports of the experiments show their figures (#221, #230). The index of the HTML report used the description of a figure as the path of its image and showed no figure, the LaTeX report failed copying the figures, and the markdown report did not render its index and referred to images at the root of the file system, which the preview of VS Code does not show. The markdown pages are written with paths relative to the page, the LaTeX report includes the copied images from
<filename>_figures/unless alatex_path_prefixis given and leaves a figure without a png out with a warning; a figure of one panel is no longer stretched to the width of the page and models and code are shown by their file name - the residuals no longer depend on earlier evaluations. The absolute tolerance of the integrator was scaled by the compartment volumes of the current state, so the first evaluation of every fit integrated at
1e-18; it is scaled by the smallest finite positive initial volume - the profile likelihood converted its values with
10**thetawhatever the scale of the parameters, so the profiles of a fit on the linear scale were wrong - an export after an evaluation of a problem wrote the values of the parameters as conditions; the reader merged an observable measured in two experiments into one dataset and handed the natural
logof PEtab to the decadiclogof the formula parser of SBML; the JSON of a problem with its experiment classes could not be written optimization_result.tsvis a table with one line per run and one column per parameter, the arrays were printed over several lines- a case of the SBML Test Suite whose variables are named like the time column is compared on its variables instead of being reported as missing (#216)
load_pkdb_dataframeraises aFileNotFoundErrornaming every path when a dataset is in none of the data paths, it created aValueErrorwithout raising it;DataSet.from_dfadds the units of theudictas*_unitcolumns, it set them as attributes of the frame where they were lost;species_dfhad a columnspecieswithout data- the Sobol analysis samples with
SALib.sample.sobolinstead of the deprecatedsaltelli, which changes the numbers of the sensitivity example; the tests run without warnings - the example of the simple chain writes its ODEs with sbmlode,
sbmlutils.converters.odefacno longer exists; the tests of the example scripts read the output of a script as utf-8 on windows
Changes of interfaces
SimulatorSerial._timecoursesreturnsTimecourseResultinstead ofDataFrame,sbmlsim.testsuite.simulate_casereturns aTimecourseResultandcompare_casetakes one;XResult.from_dfsis kept and converts the framesDEFAULT_EXPERIMENTof the PEtab layer isdefault_experiment, a PEtab model namedmodelcollided with it- the
sbmlsimextension of an exported problem is version 0.2.0 (observableskeyed by the fit mapping,scaleper parameter,inputs), 0.1.0 is still read optimization_result.tsvhas the columnsx0.<pid>instead ofxandx0
Dependencies
- sbml4humans (
>=0.12.2, human readable reports of SBML models) and pkpdutils (>=1.3.0, pharmacokinetic and pharmacodynamic analysis of timecourses) are dependencies (#229) sbmlmath>=0.4.1,<0.5is a declared dependency;torchis only in thedevextra, as the CPU build, the package never imports it- every dependency at its latest release: sbmlutils 0.16.0 (the ODE export moved to sbmlode), pymetadata 0.8.0, python-libsbml 5.21.2, python-libsedml 2.0.34, SALib 1.6.0, pandas 3.0.6, xarray 2026.9.0, pint 0.26.1 and matplotlib 3.11.2