Release notes for sbmlsim 0.42.0
Two changes: the interpolation of data and the data-driven inputs of a model moved from sbmlutils into sbmlsim, and every figure is now drawn by the renderer of sbmlsim-core, which removes matplotlib, seaborn and plotly from the dependencies. The second one changes the look of every figure and a number of plotting APIs, read the lists below before you upgrade.
Interpolation and data-driven model inputs from sbmlutils
sbmlsim.interpolation holds what was sbmlutils.data.interpolation: Interpolation, Interpolator, InterpolationMethod and the INTERPOLATION_* aliases. A table of data points becomes constant, linear or natural cubic spline assignment rules, which write a standalone SBML model, drive an existing document in place (drive), drive a model through comp (drive_comp) or become factory assignment rules (assignment_rules). The targets are validated before a document is modified, and the driven models are simulated with Simulator in the tests. The implementation needs no new dependency. docs/interpolation.md is the page, examples/interpolation/ has three examples which run without network access and save their figures. (#662)
Migrating from sbmlutils. Replace imports from sbmlutils.data.interpolation with sbmlsim.interpolation. The classes, the enum, the method constants and their behavior are the same.
Figures on the renderer of sbmlsim-core
Every figure is drawn by the renderer of sbmlsim-core (sbmlsim.plot.chart, plot/resolve.py), so figures change their look. The package requires sbmlsim-core>=0.29.0. Reports show the figures as inline SVG and are interactive (figures.js). (#666, closes #661)
Performance
| before | after | |
|---|---|---|
| HCTZ experiment figures | 1.05-1.21 s | 0.16 s |
| HCTZ fit report | 18.4 s | 1.54 s |
| Sensitivity figures | 1.73 s | 0.29 s |
Added
Chart,ChartPlot,ChartAxisand colour names insbmlsim.plot.
Changed
- Unknown colour-map names raise.
- Asymmetric
vminandvmaxaround a centre are supported. FigureSettingsfields which the contract figure/1 cannot carry are not supported:fig_facecolorandlegend_loclog one warning per figure (the renderer has no background colour, themes come from CSS, and it places the legend itself). The renderer has one title size:axes_titlesizefor a figure with plot titles and no figure title,fig_titlesizeotherwise, and a figure with both usesfig_titlesizeand logs it.- Numeric font weights of 600 or more (and
"700",bold,semibold, ...) are bold, the only other weight is normal. - Figure formats are
svg,pngandjson. Thejsonspec is always written, the formathtmlraises. figures_mpl()is a warned hook: its figures are saved withsavefig(bbox_inches="tight").- Plot functions return a
Chartand no longer takeax=,path=ordpi=:plot_bands,plot_distribution,plot_heatmap,plot_indices,plot_morris,plot_profile,plot_profiles,plot_diffand theFitReport.plot_*methods.draw_boxestakes aChartPlot. identifiability.plot_all(png_dpi="figure")writes the PNG at the resolution of the figure itself.- The section of the console leaves its icon out when the stream is not UTF-8, so a Windows console no longer fails on it.
Removed
- The dependencies matplotlib, seaborn and plotly. Pillow stays for
verify png. Both may still be installed transitively. sbmlsim.plot.serialization_matplotlib(FigureMPL,MatplotlibFigureSerializer; annotate withfrom matplotlib.figure import Figure) andsbmlsim.plot.serialization_plotly.label_axes,units.setup_matplotlib(callureg.setup_matplotlib(True)yourself),create_mpl_figures,save_mpl_figures,show_mpl_figures,close_mpl_figures,save_interactive_figures,FigureOutputs.rcandrc_params.
Dependencies
sbmlsim-core>=0.29.0: the forward sensitivities carry the changes and the steady state of a request, so the Fisher information of a fit of doses at times or of conditions which start from a steady state (every condition of the HCTZ model of pkdb_models) comes from the sensitivities and not from the central differences; on the HCTZ PK fit the standard errors agree with the ones of the central differences to 3.5e-4.
The analysis of a model uses the machine (#665, closes #664)
The parts of the analysis of a model which left the cores idle, measured on the HCTZ model of pkdb_models on 20 CPUs:
| step | before | after |
|---|---|---|
28 experiments over 100 draws (simulate with uncertainty)
| 1 m 43 s on 2 cores | 39 s |
visual predictive check (credibility with variability)
| 4 m 28 s on 1 core | 1 m 26 s |
| credibility over 128 draws | 1 m 41 s | 1 m 09 s |
- The bands of an uncertainty run.
point_timecourseandpoint_bandindex the values with numpy instead of aniselof the whole result per draw, andnan_quantilestakes the vectorizedquantilefor the columns withoutNaN(value for valuenp.nanquantile); the bands of the HCTZ parameter scan over 100 draws from 150 s to 15 s.curve_linesreads the values of a curve once, aDatareads the labels only of the dimensions it selects. - A worker takes its share of the CPUs. A worker of a pool of
nuses1/nof the CPUs for the threads of the engine core (parallel.worker_cores), also when a run names more. With the engine core an experiment of a scan leaves the pool only for a scan of a pool of every CPU, and the experiments in this process run beside the pool, not before it: with the draws of an uncertainty run every experiment had run one after the other in this process. Roadrunner keeps the behavior of #554. - The credibility in a pool.
sbmlsim.fit.pool.map_evaluationsevaluates independent evaluations of a problem in a pool whose workers initialize the problem once, the results those of one process in order. The draws of the uncertainty of a fit and the vectors and studies of a predictive check (predictive_check(..., workers=)) run in it;assess(..., workers=), and the kindcredibilityuses the cores of the run (uses_cores=True). The tables of the HCTZ assessment are unchanged to the byte. - The rebuild of the battery builds the models without the web assets (
Project.create_models(out, web_app=False),sbmlsim.webapp.assets.is_web_asset): compiling the variants for the browser was most of the time of the check, andrun_simulation --action factory --rebuildchecks them. - The Fisher jacobian of the engine core is one batch of the engine in this process (
evaluate_residuals_many) and no longer a pool of one worker which initialized the problem again: about ten seconds of every fit of the HCTZ PK problem.