Repository navigation
Release notes for sbmlsim 0.64.0
This is a breaking release. Live figures derive from equilibrated, time shifted and scanned experiments, so 47 of the 52 study figures of the HCTZ model of pkdb_models are live figures; at the defaults of its knobs a live figure is still the static figure bitwise, and the recipe of a bundle reproduces the service bitwise (#814). The contracts move to livefigure/2 and panelbundle/3, the panel annotation to the namespace https://sbmlsim.org/ns/panel/2, and the floor to sbmlsim-core 0.62.0. Panels take 16 knobs, a colour map of the renderer, a selection of a missing value and name declared units as declared (#813); a rule can be drawn over the data (Rule.above, #812); the migration of a fit record keeps the text of what it does not change (#811). The web app of a model vendors sbmlsim-web 0.11.0. See Migration for what a model package does.
Breaking
- Requires
sbmlsim-core>=0.62.0(from 0.58.0). 0.59.0 is the panel endpoint ofpanelbundle/3andlivefigure/2, andfitproblem/1withoutvariable_step_size(sbmlsim-core#264). 0.60.0 draws the error bars of a curve below its markers (sbmlsim-core#268). 0.61.0 wraps titles and legends into their width (sbmlsim-core#272). 0.62.0 fixes the root finding which stalled a grid with a change, e.g.Q_pump=0(sbmlsim-core#277: the secant step of the vendored SUNDIALS and guards with the flag -1001). The SVG and PNG of figures with error bars or long titles and legends therefore change: the outputs of the documentation were drawn again, and a model package which compares images (e.g.verify png) sees differences. livefigure/2,livefigure/1is refused.LiveBinding.simulationmay benull; the newpointsare the keys of the simulations of a curve of one point each andatthe time every point is read at, in the time of the model with the shift. TheLiveElementPayloadof an answer hassimulation: null,points, andxvalues which may benull. Simulations carrysteady_stateandtime_shift. A renderer needs sbmlsim-web 0.11.0 or newer.panelbundle/3, which an endpoint ofpanelbundle/2refuses:- Every run carries
steady_state(nullor{absolute_tolerance, relative_tolerance, max_time}) andx_shift, and thexof an exact output includes the shift. - The bindings of points.
- One SBML and one compiled model per variant (
models/<variant>/model.xml, which every model key of the variant names assbmlandcompiled, shared by variants of one SBML). Derived targets are selected by the parameterpanel_derivedin thepreinitof a run. - Exported bundles (
--export) and the web apps of model packages (<name>_app.html, written by the factory) must be written again.
- Every run carries
- The panel annotation is the namespace
https://sbmlsim.org/ns/panel/2(with<steadyState>,timeShiftandmissing="true"). An annotation ofpanel/1is refused with a problem which says to run the factory of the model again, and the factory replaces it. The reader is strict: an unknown element or attribute of the namespace is a problem of its panel. An sbmlsim 0.63 or earlier finds no panels in apanel/2annotation, instead of drawing curves without the steady state or the shift. fitproblem/1withoutvariable_step_size.document_settingsno longer writes it, and sbmlsim-core 0.59 and newer refuse it. This only affects a document built by hand; stored fit records were migrated in 0.63 already.- Spec hashes change. Every
spec_hashof a simulation, map and live figure answer includes the versions of sbmlsim and sbmlsim-core (VERSIONSofsbmlsim.serve.app), sinceGET /api/sim/{hash}is served as immutable, so the hashes change with every release of either. An oldGET /api/sim/{hash}link answers 404. Thespec_hashof the run layer is unchanged. - Payloads change within the kept versions:
panel/1andmappanel/1:simulationalways carriessteady_state(null) andtime_shift(0.0), andlimits.endis1000000.0,limits.knobs16.app/1:information_figure(a path in the declaration, adata:image/svg+xml;base64,URL ornullin the answer of/app); the head of a live figure carriescolumns, its plot columns, and the head of a panel and a mapcolumns: null.- The strict readers of sbmlsim 0.63 refuse these payloads.
Project.app,panels,variant_panels,mapsandlive_figuresmay be references"module:attribute". Code which reads these fields directly gets the reference string; useload_app(),load_panels(),load_variant_panels(),load_maps()andload_live_figures().- The variant of a live figure: a variant named by
SimulationExperiment.variant_ofmust be the file of the model of the task, else aContractError; it used to bind silently. The BloodPressure figures of HCTZ are refused until pkdb_models declares thefluidvariant.
Migration
- Run the factory of every model package again, so its SBML carries the annotation
panel/2and its web apppanelbundle/3and sbmlsim-web 0.11.0. The committed SBML of pkdb_models (apixaban, glimepiride and hctz, e.g.apixaban_body_flat.xml,apixaban_body_female_flat.xml,glimepiride_body_flat.xml,hctz_body_flat.xml) carriespanel/1and has no panels until its factory runs again. - Write the browser exports again (
python -m sbmlsim.serve --export, the committed exports of pkpdsim and pkdb_models): they arepanelbundle/2and stale. Panels which declare a reordered unit or a unit id of the model also name their units differently now (see below). - Read the declarations of a project with
Project.load_*(load_app(),load_panels(),load_variant_panels(),load_maps(),load_live_figures()) instead ofproject.app,project.panels, ... wherever they may hold references or callables (e.g.tests/models/test_panels.pyof pkdb_models, which readsproject.appand keeps working only while the project holds an object). - Compare images again after the floor: figures with error bars or long titles and legends are drawn differently.
Live figures of equilibrated, shifted and scanned experiments
- Steady state (
PanelSteadyState,PanelSimulation.steady_state, the<steadyState>child of<simulation>): every point of a panel or a live figure starts from the steady state of its condition, so a knob of the condition equilibrates again by construction (one request per point, no state kept between requests). A condition without a steady state is a failed point. The derivation maps the steady state of a plan to it; a steady state with a pre-initialization of its own, or one after the end, is refused. - Time shift (
PanelSimulation.time_shift,timeShift): added to the time of the result in the time unit of the model, before the conversion intox_unit. - Curves of one point per simulation (
LiveBinding.points,LiveBinding.at): a line over one dimension of values of a scan (x a coordinateD.targetor a formula) whose y is a selection or aFormulawhose reductions are allat(e, t)at a row. A point reads the last row whose time equalsat, and a failed point isnull. Anatbetween rows,max/min/mean, PK parameters and curves at two times are refused. - A knob of a temperature in °C on a live figure converts as its target holds it (
knob_conversion, its offset). MAX_ENDrises from 10000 to 1e6, also the bound of-start.- Measured on HCTZ: a knob move is 12 to 155 ms in the browser and 0.06 to 0.13 s in the service, each simulation equilibrating again, so no steady state is cached.
- Demo:
examples/panels/equilibrium.py, a panel and four live figures.scripts/panel_fixture.pywrites the fixtures of the panel endpoint of sbmlsim-core (tests/data/panel_fixtures/,docs/development.md).
Panels, apps and the service
- 16 knobs (#813):
MAX_KNOBSis 16 (was 8), for a declaration (panel, map, live figure, the scans of a page) and a request alike;MAX_GRID(64) still bounds the work. - A colour map the renderer draws:
ColorScaleSpec.nameis checked againstCOLOR_SCALESof sbmlsim-core when the scale is declared; the error names every valid name and suggests the lower-case one (Bluestoblues). Before, a wrong name was written into the SBML and the bundle and the page could not draw the map. - A selection of a missing value: a
NoneinPanelData.sel(JSONnull,<select column="..." missing="true"/>in the annotation) selects the rows whose column is missing (NaN,None,pandas.NA, in a column of any dtype), and the text"nan"matches nothing.sbmlsim.data.matching_rowsdoes it, whichData.get_data(sel=)uses as well, which matchedNonein a string column only. - Declared units are named as declared: a unit which a curve, a map readout, an
x_unitor a series declares is named by its declaration in the short form of pint and the order of the declaration, e.g.mMstaysmM(wasmmol/lwhenmMis also a unit id of the model),μmol/min/gstaysμmol/min/g,uMbecomesμM. Within one panel and one map every unit equal to a declared one takes the text of the first declaration (declared_unit,panel_curve_unitsofserve/runner.py). App.information_figure: an SVG below the root of the project, at most 1 MiB (MAX_INFORMATION_FIGURE_BYTES), read and checked when the service starts and served as an image data URL.LiveFigure.columnsandPanelSummary.columnssize a card before its figure is drawn.- References to callables: a reference of
app,panels,variant_panels,mapsorlive_figuresmay name a callable which takes theProjectit is loaded for. In a rebuild (create_models(out)) that is the project of the rebuild root, so a declaration built from a factory output reads the files the factory just wrote. A callable which raises is aValueErrornaming the field and the reference, whichcheck_modeland the service report. python -m sbmlsim.serve --timeout SECONDS: the wall clock deadline of every simulation of the service, 30 s by default (the deadline of the pool of a page),0for none; without the option aSBMLSIM_CORE_TIMEOUT_MSof the environment is kept. The deadline belongs to the runtime of the engine, one per process, so it also bounds the derivation of the live figures and the jobs. A point past the deadline is a failed point (null, listed infailed, still a 200) whose message names the deadline, and its thread is freed. An answer with a point the deadline may have failed is kept in no cache of the service, while a failure of the model stays cached.--exportsets no deadline, and the library and the run layer keep none.- The web app of a model vendors sbmlsim-web 0.11.0:
livefigure/2, the dashboard of a page and the information figure.
The figure model
- A rule over the data (#812):
Rule(above=True),Plot.rule(..., above=True)andFigure.rule(..., above=True)draw the rule atRULE_ABOVE_Z(1.0) over every line, marker and band median of its plot, e.g. the medium change of the machine perfusion figures of pkdb_models. The default keepsRULE_Z(-0.25), so existing figures are unchanged.
Bug fixes
- The migration of a fit record keeps the text of what it does not change (#811).
python -m sbmlsim.run migrateof 0.63.0 wrote a changed record out again withjson.dumps(indent=...)and expanded the arrays a record held compactly (a record of pkdb_models grew from 636 to 184526 lines). It now writes again only what it changes: an object member by member, an array of the same length element by element, a value on one line stays on one line, the keys keep their order with the added ones after them. A rewritten text which does not read back as the migrated record is refused with aMigrationErrorbefore anything is written; a second migration changes nothing, byte for byte. - The domains of a model are no uncertainties of a fit: the distrib uncertainties named
domain(sbmlsim.domains) no longer count as uncertainties of a fit (model_distributions), so the band of a model with domains names its fit again (the bundle carrieduncertainty.fit == ""). - A grid over a knob whose id equals the id of its target no longer fails; the dimension of a grid is
panel-grid. - The web app of a rebuild (
create_models(out)) carries the map panels and the live figures, and reads the information figure from the rebuild when the factory writes it. - The web app embeds the answers of the default variant once (31 % smaller for a model with derived targets in several variants).
- The message of a point which a wall clock deadline interrupted names the deadline.
- A bound of a live figure (e.g.
MAX_LIVE_SIMULATIONS) is aContractErrornaming the figure, the experiment and the model; a model file which is no variant gets a message which says to declare it as one. check_modelreads the information figure.
Documentation
docs/serve.md: the steady state, the time shift, curves of points,livefigure/2,panelbundle/3, the annotationpanel/2,--timeoutand the caches;docs/project.md: references and callables of the declarations andload_*;docs/plotting.md:Rule.above;docs/fitting.md: the layout a migrated record keeps;docs/development.md: the fixtures of the panel endpoint.