Repository navigation
bngsim 0.17.3
pip install bngsim==0.17.3
Added
-
Result.rerun(linear_solver=...)andcheck("linear_solver")(#1888).rerun()takes an ODE run's linear solver,"dense","klu"or"auto", through the Simulator'sforce_dense_linear_solverandforce_sparse_linear_solver, so a run that fails on KLU can be made again dense with one call.check("all")addslinear_solver: the run on the other solver (dense for a KLU run, KLU for a dense one), judged species by species like the other paths, orskipwith the reason where KLU cannot run the model (a build without KLU, no sparse Jacobian pattern, a JAX Jacobian). -
Result.digest(sensitivities=True)(#1883). For each listed column, the digest now says which parameters and initial amounts move it most at the last time: up tomax_parameters(default 5), ranked by|p·dY/dp|so a parameter's units do not decide the order, each with its raw derivative,p·dY/dp, and the scaled sensitivity(p/y)·dY/dp(Nonewhereyis within its tolerance of 0). A parameter at 0 or of no recorded value is listed apart, a non-finite derivative is counted, and a one-sided column carries its side. -
Notice codes are listed with what to do about each (#1858). The error-code reference page, now "Error and notice codes", has a table of every code a run's notice can carry, with its meaning and an action, generated from the same source as the notices themselves.
-
A run that fails keeps its notices on the error (#1857). A
BngsimErrorraised by a run now carries the notices the run had collected, ase.noticesand ine.to_dict(): that it started from the last run's end state, say, or retried on a difference-quotient Jacobian. A warnings filter or logging level does not drop them. An error raised from a run's error carries that run's notices too, and a sensitivity chunk that fails and is retried column by column passes what it noted on to the result. -
Model.describe()says whether a steady state can be solved for (#1844).methods["steady_state"]isrefusedfor a model with an event, a compartment size that jumps, a state the time reaches, one the ODE Simulator refuses, or one with no species, listing every reason with the messagesteady_state()raises for the first;steady_state()andsteady_state_batch()now raise from the same check. Otherwiseok, with a note that the call still checks the model's conservation laws and that a solve can fail to converge. -
What a model is, asked by another tool's name, now names
describe()(#1843).model.summary(),.info(),.to_dict(),.compartments,.reactions,.unitsand their neighbours raised a bareAttributeError, as did libRoadRunner'sgetInfo,getCompartmentIds,getReactionIdsandgetNumReactionson aModelor aSimulator. Each now names the call to make:model.describe(), or the part of it that holds the answer, with every entry (limit=None);getNumReactionsthe file's count, as RoadRunner gives it. The agent guide's translation table lists the libRoadRunner ones. -
The test suite now validates the SED-ML bngsim writes against the SED-ML L1V3 schema (#1734). #1677's schema failure, in every archive
net_to_omex(bngl=...)made, was found by hand withxmllint.test_sedml_schema.pycheckswrite_sedml, thenet2sbml --sidecaroutput,write_sedml_protocolover the repository's.bnglcorpus, and the SED-ML in archives of each shape the writer has, withlxml.etree.XMLSchemaagainst a vendored copy of the schema intests/data/sedml_schema.lxmljoins thetestextra. It found one: aminormax, which SED-ML L1V3's MathML does not have, in an action's expression or a derived parameter said again as the model runs. Each is now written as apiecewise, andread_sedml_protocolreads apiecewiseas BNGL'sif, which a replay evaluates; it refusedpiecewise(...). -
A
bngsimcommand, alsopython -m bngsim(#1708).bngsim doctorsays what this install can do, what is missing and the fix for each, with the Python, the platform and the C compiler codegen would use;bngsim exampleslists the bundled models and their files;bngsim inspect MODELprintsModel.describe();bngsim guideandbngsim skillprint the agent guide as before. The converters and the cache tool are alsobngsim convert TOOL ...andbngsim cache ..., unchanged. With--jsona command prints exactly one JSON object on standard output, and anything else written there, by Python or by C, goes to standard error; an error is theBngsimError.to_dict()object on standard error. Exit codes are distinct: 0 success, 1 error, 2 usage error, 3 refusal, and 4 and 5 kept for a failed run and a timeout.runandcheckare to come. -
bngsim run MODELandbngsim check MODEL(issue #1708, part 2).runmakes one run from the model's initial state and prints the run's record andResult.digest(), never the arrays:--outwrites those to.npz,.csvor.h5.checkmakes the same run, thenResult.check(), and exits 6 when the check is not ok, with the report on standard output. Both take the method, the time window or sample times,--set NAME=VALUE, a seed and the tolerances;run --replicates Ndigests a stack of stochastic runs. Every run has a wall-clock limit,--timeout(600 s by default; exit 5 past it). A.bnglfile needs--network, so the caller says it means one run of the generated network and not the file's own actions. -
Result.check(): the run made again with one setting changed, and whether the answer moved (issue #1707). Each check is arerun()from the run's own start on a fresh model, so the session is untouched. By default an ODE run is checked at a tenth of its tolerances and at 8x the output points;check("all")adds a difference-quotient Jacobian, compiled against interpreted code, and libRoadRunner where it is installed. A stochastic run is made again at 10 other seeds, with each observable's mean and standard error. Each species is judged on its own scale, past the atol the run applied to it, so a small species is not hidden by a large one; a path may not differ by more than 1% of a species' peak for the tolerance alone. A disagreement is reported with what to do next, not raised;budget=bounds the wall time. -
Example models with exact solutions, and
bngsim.ModelBuilderfor building a model in Python (#1706).bngsim.exampleshas six small models that ship with BNGsim:binding(A + B <-> C),decay,chain,birth_death,bolus(an event), andschlogl(a bistable switch). Each comes with its exact solution,bngsim.examples.exact(name, t)orsteady_states(name), so you can try BNGsim with no model file and check its answers.bindingcomes in every format:.net, BNGL, BNG-XML (for NFsim and RuleMonkey), SBML, Antimony, and Python.bngsim.ModelBuilderbuilds a model in Python: add parameters, species, reactions, observables, functions, and events, thenbuild()returns aModel. The events guide's example used the internal builder and did not run; it now usesModelBuilder. -
Model.from_biomodelsloads a BioModels entry by its id (#1706).bngsim.Model.from_biomodels("BIOMD0000000010")asks BioModels for the entry's main SBML file, checks it against the sha256 BioModels publishes, and keeps a copy in~/.cache/bngsim/biomodels(or$BNGSIM_BIOMODELS_CACHE_DIR), so the next call needs no network. Passversion=to pin a version, orrefresh=Trueto fetch the latest again.model.describe()["source"]records the id, version, file name, and sha256. With no network and no cached copy, the error says so and names the cache directory.Model.load("BIOMD0000000010")used to read the id as a file with no suffix; it now says to callModel.from_biomodels. -
Model.describe(): what a model is, in one call (#1705).repr(model)gave four counts, and what kind of quantity a species holds, its compartment, the file's reactions and which methods the model admits could not be read; a refused stochastic or network-free run was found by running it.describe()returns a JSON-serializable dict whosestr()is a plain-text report: where the model came from (format, path, SHA-256), counts, parameters, compartments, species with their initial value, compartment and quantity (SBML and Antimony; absent for.netand BNGL), the file's reactions as written, events, what reads the clock, where the next run starts, and forode,ssa,psa,nf,rmand forward sensitivities, a status and the reasons each is refused, read from the checks the Simulator makes. Lists pastlimit=(default 50) are cut and say how many they left out. -
Result.digest(): what a result's values did, for a caller that cannot look at a plot (issue #1704). A JSON-ready dict, bounded in size, whosestr()is a line per column: first and last values, extremes and their times, turns, whether the column has settled by the end of the window, and flags for a non-finite, negative or never-moving column. Turns and "settled" are judged by the steady-state code'scriterion="scaled"tolerance at the run's ownrtolandatol, so an integrator's wobble is no turn. A single stochastic run gets its values alone; a stack, statistics across runs at the last time. Pastmax_columns(20) it lists the widest ranges and counts the rest.Result.save("run.npz")writes the arrays, names and record with NumPy alone; a.csvor.tsvpath is refused, namingto_csv. -
A
Resultsays what its numbers are and how its run went (#1703).Result.record, a JSON-serializable dict thatsummary()andsave()carry, gives each column's quantity (concentration, amount or count), compartment, size and SBML units; the method, times, start state and parameters; the tolerances as the solver was given them; which code ran, including an analytical Jacobian retried on a difference quotient; the model file's hash; and the build.Result.noticeslists every warning of the run, whatever the warning filters or logging level let through. -
A
Resultcan make its run again:Result.rerun()(#1703). It builds the model from the recorded file, once its sha256 still matches, or from the text a string load kept, gives it the parameters, start state and event state the run started from, and runs at the recorded method, seed, times, tolerances as applied, Jacobian, linear solver and right-hand side: an ODE run comes back bit for bit, a stochastic one too on the same build. The model the run used is neither read nor changed.rerun(rtol=1e-10)changes one setting and keeps the rest, and the new record'srun.rerun_ofsays what was repeated and changed. Where the record cannot promise the same run (a stack, a network-free run, stop conditions, carried sensitivities, an edited model, a file or table data changed on disk) it refuses with arerun.*code. A string-loaded model keeps its text, whichsave()writes into the file. The record gains keys for what a rerun reads. -
Every BNGsim error carries a stable code, its details and remedies a program can act on (#1702). A tool or an agent can branch on
e.codeinstead of matching the message, which changes between releases.e.detailssays what the error is about (the name and its close matches, the path, the constructs, the solver flag),e.remedieslists fixes as dicts with akind(such asinstall_packagewith itspip installcommand),e.docs_urlpoints at a new error-code reference page, ande.to_dict()gives all of it as plain data. An error with no code of its own carries its class's generic one. A missing optional package is nowbngsim.DependencyError, a missing filebngsim.MissingFileErrorand a missingxml_path=bngsim.UsageError; each is still theImportError,FileNotFoundErrororValueErrorit was. Messages are unchanged. -
A second
run()continued the first run's end state with its clock set back, and its Result said nothing of it (#1701).A -> Brun twice over(0, 5)fromA = 10gaveA(0) = 10, then0.0674. The behaviour stays, as BNG2.pl's has it, and is now recorded and checked:Result.started_from("initial"or"live") andResult.start_state_sha256, also insummary(),save()andto_xarray().- A
bngsim.LiveStartWarningbefore a call starts from exactly the state the last run left, before the time it ended at:run(),run_until(by its clock),run_replicates,parameter_scan,bifurcate, andrun_protocol's first run. run(start="initial")resets the model first, undone if the run raises;run(start="live")continues without the warning.
-
An agent guide in the wheel, and an
llms.txtindex of the documentation (#1699).bngsim.agent_guide()returns one page for the installed version, with no network: the calls, eight rules that otherwise give wrong answers, what a refusal means, what each feature needs, a translation table from libRoadRunner, Tellurium, AMICI, COPASI, BioNetGen and PySB (generated from the table the wrong-name errors read), how to check a result and how to report a bug.python -m bngsim guideprints it andpython -m bngsim skillprints it as aSKILL.mdfile. The documentation includes the same file, and its build writesllms.txt,llms-full.txtand each page's Markdown, which Read the Docs serves atbngsim.readthedocs.io/llms.txt. A test runs every block of the guide and holds it to a 32,000-character budget. The module docstring, which pointed to a README the wheel does not hold, now points to the guide. -
Wheels for CPython 3.14 and 3.15 (#1491).
pip install bngsimon either version took the sdist and built from source, needing a C++ toolchain and CMake, and SuiteSparse for the KLU solver. The wheel matrix now covers cp314 and cp315 on Linux x86_64, macOS arm64 and x86_64, and Windows x86_64, and the classifiers, the installation page, the support matrix andscripts/local_ci.py matrixsay so.pypa/cibuildwheelmoves from v4.1.0 to v4.3.5, which builds 3.15 by default against a final release, 3.15.2. Linux aarch64 gets wheels too, cp310–cp315 built on a nativeubuntu-24.04-armrunner, wherepip install bngsimon Linux/ARM (Docker on Apple Silicon, ARM cloud and cluster nodes) built from source; theantimonyextra still has no wheel there. Free-threaded builds (cp314t,cp315t) are not included.
Changed
-
Result.check()judges every species, and reads a run's scatter at its tolerance (#1887). A species within 100 atols of zero, or not converged at the run's tolerance, was left out of every path check, so a rerun on which it departed from zero, or went non-finite, passed; each is now held to the run's whole scale and its own scatter. A path's allowance reads a species' drift as the larger of its move at a tenfold tighter tolerance and half its move at twice the tolerance: one tighter run understated a correct run's scatter where the run's own error was small by luck, and a correct path read as a disagreement.check()makes one more rerun for it. Where an event or a rule promotes a parameter into the state, each species now takes its own atol, matched by name, not the scalar ceiling. The developer-side differential harness, paths and steady states alike, judges by the same rule, species by species, where it judged the whole trajectory against the largest species' peak. -
The user guides, the quickstart and the agent guide are rewritten in plain English (#1846). Each guide opens with the common case: the call, a short example and what to watch out for, with details further down. The guides are much shorter, and they no longer cite issue numbers; a test keeps them out. The agent guide's title is now "BNGsim agent guide", and its translation table and the wrong-name errors it is generated from call the tool BNGsim.
-
A pull request that adds a test file no check runs now gets a warning (#1764).
mir.ymland the three Windows workflows run hand-picked test lists, and thepython-testslegs build without what they have (MIR, MSVC, KLU on Windows), so a new file that only does real work there skipped on every leg, ran nowhere else, and left every check green. A newpython-testsjob, "New test files run somewhere" (ci/new_test_coverage.py), reads every leg's per-file counts and every other workflow's pytest commands andpull_requesttrigger. It warns, naming the file, when the pull request adds a test file that skipped on every leg and that no workflow running on that pull request runs, and says which lists and paths filters it could join. A workflow counts only when its paths filter fires for the change, soforced-jit(whole suite, nightly) counts only when the change edits its files; an argument it cannot read (a shell array, a matrix value,-k) never counts, so neither doessanitizers. It warns rather than fails, as does a missing or unreadable report. -
A pull request that adds tests no longer has to raise a count in
ci/test_floors.env(#1757). The Python suite counts job now holds each test file's collected and skipped counts, forpython/testsandparity_checks/tests, to the same leg's counts on main (ci/test_file_counts.py): a file the change does not touch may not lose a test, and untouched files may not gain more than 10 skips. A deliberate loss is accepted with thedrops testspull request label. The four bounds this replaces, and the merge conflicts two pull requests adding tests at once had over them, are gone. -
Every error BNGsim raises about a model, a run or an argument now has a code (#1702). The ones raised as built-in
ValueError,TypeError,KeyError,NotImplementedErrororRuntimeErrorare now BNGsim errors that are still those built-ins:UsageError, the newArgumentTypeError,NotFoundError,NotSupportedError,InvalidModelErrorandCodegenBuildError, each with acodea program can branch on. Messages are unchanged, but for the class name a few quote of the error behind them (a failed codegen build is nowCodegenBuildErrorthere, notRuntimeError). One behavior change: every BNGsim error is aRuntimeError, so anexcept RuntimeErrornow also catches an argument error that used to be a plainValueError. A CVODE failure's code now comes from the engine as data rather than from the message, and so does a missing compiler's. -
The PyPI summary, the module docstring, the docs front page, and
llms.txtnow say that bngsim simulates SBML, Antimony, and BNGL models (#1698). They used to call bngsim a simulation engine for BioNetGen reaction networks. The package now has keywords. The README is shorter and links to two new docs pages: "When to use bngsim", a table of tasks and alternatives with tips on compilers, solvers, sensitivities, steady states, SSA vs. PSA, NFsim and RuleMonkey, and JAX; and "What bngsim does", the feature list that was in the README. The quickstart no longer says that PSA preserves Gillespie statistics. PSA preserves means, not variances. -
Re-runs of models with events, time switches or state switches cost less (#1669). CVODE's root function evaluated every model function at every call, after every step and at every output row, though most triggers read the clock alone; it now evaluates only the observables and functions its expressions read. A state switch's residual, written out with every rule it reads, now computes each repeated subexpression and call once: BIOMD0000000385's ten residuals were 64,746 nodes of 183 different ones. A re-run of BIOMD0000000385 takes 19 ms where it took 117 ms (libRoadRunner: 4.8 ms), BIOMD0000000386 10 ms where it took 21 ms, and most of the other BioModels #1669 lists 10-30% less. Results are unchanged to the bit on the 1,271 rr_parity models that run, at two tolerances, and on the 1,113 that run with forward sensitivities; a shared residual can round a few units in the last place differently, which moved a run of a deep chain of rules under abs() by 5e-12 relative at rtol 1e-9.
-
Result.check()names theroadrunnerextra. Where libRoadRunner is not installed, thesecond_enginecheck now sayspip install 'bngsim[roadrunner]'rather thanpip install libroadrunner, and the installation page lists the extra. The extra, already published, was described as developer-only; it is the supported way to get the independent enginecheck("all")compares an SBML or Antimony run with.
Fixed
-
run_protocol: afterresetParameters, a parameter asetParameterset to an expression could follow the network's own expression instead, and a derived parameter that read it stayed a number (#1876). Writing back the parameter's saved number re-attaches it to the network's expression where the two agree before what that one reads is back. Withk3 k2*3andk4 k3*2,setParameter("k3","k1*9")saved, then k2, k3 and k4 changed and reset, k4 stayed at 18 aftersetParameter("k1",2), where BNG2.pl gives 36. The reset now has such a parameter follow its own expression again before it re-attaches the derived ones. AsetParameterwhose expression does not evaluate only while what it reads is on its way back (sqrt(d), d briefly negative) is no longer refused, after a reset or otherwise. -
The "New test files run somewhere" check read all of a workflow's pytest commands as one, and a shell glob that expands to a directory as no directory (#1874). One step's
--ignoreor--deselectwas applied to a file another step runs, so a file run in a step of its own was warned about; each command is now read on its own, and a file counts as run when any command runs it. A glob such aspython/tests/su?is now the directory bash expands it to, which pytest walks: the files under it count as run, and an--ignorebelow it applies to a file also named under it, which the check had counted as run; an--ignoreargument the shell expands is read the same way. No workflow on main has either shape, and the six that run pytest read the same as before. -
run_protocolcould leave a derived parameter a number afterresetParameters, in some runs and not in others (#1870). The reset re-attaches each derived parameter asetParameteroverrode since the save by writing back its saved value, which works only once the parameters it reads are back. They were written in the order of a set, so one written before a parameter it reads stayed a number and stopped following; the order follows the string hash seed. Withk2 k1*0.5andk3 k2*2both overridden, then reset,setParameter("k1",3)left k3 at 1 underPYTHONHASHSEED0 and moved it to 3 under 1: Ctot(0.5) was 12.3121 or 29.1667, where BNG2.pl gives 29.1667. The saved values are now written back twice, in the model's order: after the first every value is back, so at the second each expression gives its own. -
The "New test files run somewhere" check read a test file named on pytest's command line as never left out by
--ignoreor--ignore-glob, though pytest 9 leaves it out when a directory holding it is named too (#1869). pytest 9 drops a collection argument that lies under another one, so the ignore applies to it, and the check counted such a file as run. It now walks the outermost named directory that holds a file, however it is written (./python/tests,python,.), and applies the ignores below it, unless--keep-duplicatesis given. A--deselectis read as a prefix of the node ids, as pytest reads it, a shell glob's expansion and a trailing::included; an--ignoreor--deselectglob after=leaves nothing out, quoted or not; and a literal@@quoted:word no longer raises. -
run_protocollet a held derived parameter follow a write again where it read another held parameter (#1865). Since #1738, a derived parameter that asetParametersets to the number its expression gives is held at that number through later writes. Withk2 k1*0.5andk3 k2/k1both set so,setParameter("k1",3)moved k2, which was written back, and that write moved k3 to 0.5/3, which was not: Ctot(0.5) was 2.6008 where BNG2.pl gives 7.4306. The hold now repeats until no held parameter has moved. -
The "New test files run somewhere" check no longer counts a new file as run where a later change to it would run it nowhere, and no longer drops a quoted pytest pattern (#1861). A file added to
mir.yml's pytest list but not to its paths filter counted as run, though a later change to the file alone fires no workflow that runs it; it is now warned about, andmir.ymlandwindows-tail.ymlgain the three test files each ran outside its own filter. A quoted--ignore-globpattern or--deselectnode id is kept as the option's argument,--ignore-globis matched with fnmatch as pytest matches it, directories included, and a quoted node id selects its file. A paths filter with?,+or[is not evaluated, since GitHub reads those differently from bash, and agit diffthat fails is a warning rather than a red job. -
Model.compartment_size_paramssaid a forward-sensitivity column for a compartment size is refused; it is computed (#1845). Thed/dVcolumn matches a central difference across models rebuilt atV ± h. What is refused is the column of a sizeset_paramcannot write, whichdescribe()'srefused_parametersnow names, with the parameters a rule or function sets, beside those folded at load; it named only those. The loading guide also no longer says thatmin,max,absand comparisons stop a sensitivity run. -
Forward sensitivity refused a model whose switch times coincide because a parameter is on its bound (#1822). With
sigma = t0 + t_deltaandt_delta = 0, the crossings att0andsigmashare an instant andt0has no parameter that moves it alone: bngsim raisedSensitivityUnsupportedError, and a bounded optimizer that had clampedt_deltato 0 stopped there. One such crossing per instant is now given what is left of the instant's jump once the others are separated. Where a rate law composes the two crossings (U()*Lambda()), the solution has a kink int_deltaat 0 and its column is the derivative fort_deltaincreasing, the feasible direction at the bound: the newbngsim.OneSidedSensitivityWarningnames the parameter and the direction, andResult.one_sided_sensitivitieslists them. Still refused: two crossings of one instant with no parameter of their own (t_delta = t_delta2 = 0), two composed crossings that each have one (#951), such a pair on two clocks or apart by more than half the clock nudge, and one in a model with a power singular at its switch. -
method="nfsim"froze, with no error, when a function rate law divided by an observable a firing empties for a moment (#1818). NFsim read rate laws while a firing had its molecules out of the observables: with one X,kgap*(1+9*Xp/Xtot)was 0/0 there, the NaN stayed in NFsim's running total, and every later row repeated the state at the first X firing, though each state the model reaches is finite. The vendored NFsim now carries the upstream fix (RuleWorld/nfsim#117), and the model agrees withssaon its network. A NaN that is the model's own (B -> 0atsqrt(k), k = -1, #1788, or a rate dividing by a count that reaches 0) is now refused byNfsimSession.simulate,step_toand the one-shot run, naming the reactions, where it was returned as a frozen run. Found after a step, the session refuses to advance untilinitialize(), as it now does after any error raised inside a step, which leaves a firing partway done; found before any step, it is left as it was. -
A derived initial condition's sensitivity seed read
rint,modandfracas numpy does, not as the engine does, so its column was wrong from t = 0 with no error (#1800).X0 = rint(p)*kat p = 2.5 seeded dX/dk = 2 for 3: numpy'srintrounds a half to even, itsmodis floored, and sympy'sfracisx - floor(x), where the engine's arefloor(x + 0.5),fmodandx - trunc(x). The seed now reads them, and the%operator, as the engine does, as the compiled and JAX right-hand sides already did. So does a derived parameter's value where a crossing reads it (fracread wrong there;rintandmoddid not evaluate, so the crossing was refused). -
sbml_to_netwrote a.netthat BioNetGen'srun_networkrefused, where an assignment rule read one listed after it (#1791). The functions block followed the SBML's rule order, andrun_networkreads it top to bottom:y := 3*xbeforex := k/2stopped it with "Could not find variable 'x'", and BIOMD0000000268 has five such rules. bngsim sorts functions when it loads a.net, so its own reload, and the converter's validate gate, read the file fine. Each function is now written after the functions it reads; a block already in order is written as it was. Of the 1291 files main and this write from the corpus (1323 BioModels and the test models), 77 had such a read, and the other 1214 come out byte-identical. Functions that read each other, or themselves, have no order: each such group is kept together, with aConversionWarning. The same holds forbngsim.convert.write_net, whichsbml_to_netwrites through. -
A sensitivity run of a switch the clock carries across against the state stalled or came back wrong (#1776). A narrow pulse in
3*time() - Tobs, withTobsrising at 2 per unit time, failed with "CVODE made no progress" at every tolerance. The same crossing as a jump,if(3*time() - Tobs > c, kx, 0), ran to the timeout, and with0.1*Tobsit returned its clock-rate column 100% off with no error. Plain runs were right. The restart past such a crossing now moves the species onto the far side, each by a flow-weighted share and at most 16 times what the restart already moves it; the stall carry (#1229) takes such crossings too; and the clock-rate column no longer counts the clock's share twice. These pulses are now within 6e-6 of the closed form at rtol 1e-11. Plain runs are unchanged. Where the clock outruns the species beyond that bound, as in3*time() - 0.05*Tobs, runs still stall or are wrong; see issue #1779. -
On Debian-based slim images
Model.from_bnglfailed with Perl's "Can't locate FindBin.pm", and BNGL loading was reported available (#1761). Theperlthere isperl-base, without the core library that BNG2.pl's line 34 (use FindBin) and itsPerl2modules load, and the check for a usable BioNetGen asked only whether someperlwas onPATH. It now asks that perl to compile the BNG2.pl it found (perl -c; a success is remembered per perl, script and library environment, and a refusal is checked again on the next resolution), soHAS_BNGL,capabilities()["missing"]["bngl"]andfrom_bngl's refusal agree and say the same thing: which module Perl could not find, in Perl's own words, and the fix. For a module of Perl's own that isapt-get install perl; for one of BioNetGen's own, it is$BNGPATHor$BioNetGenRoot, which point BNG2.pl at another library. A found BNG2.pl with no perl at all is reported as before. -
On a slim container image, every SBML and Antimony load failed with a bare
ImportError: libexpat.so.1(#1760). python-libsbml's Linux wheel reads the system expat library, which images such aspython:3.13-slimdo not ship, soimport libsbmlfails inside the package whileimport bngsimand.netmodels work, andcapabilities()still reported SBML as available, sinceHAS_LIBSBMLonly looked the package up. The loader's import now raises a message that says python-libsbml is installed but its compiled module did not load, quotes the cause, and names the fix,apt-get install libexpat1, keeping the exception's kind andname;Model.from_sbmlandModel.from_antimony_stringnow name the cause and the fix too.bngsim.HAS_LIBSBMLandcapabilities()try the import, lazily likeHAS_BNGL, so they readFalsethere with the same text; the flag is probed when read, so assigning it no longer changescapabilities(). An antimony that is installed but cannot load is relayed with its cause instead of the extra's install hint. The installation page says what slim images need. -
A protocol given numpy values could not be written, and was written or run wrong in three other ways (#1750). A step may hold a seed from
rng.integers(), ann_pointsor a sweep fromnp.linspace.run_protocolran it, butProtocolSpec.to_jsonandwrite_sedml_protocolraisedTypeError: Object of type int64 is not JSON serializable(float32 values and numpy bools did too).write_bngl_protocolwrote an int64 seed as the stringseed=>"42"and a numpy bool as"True"or"False", both true to Perl. A scan's float32 bounds made float32 points in the run. AStateChange, anExperimentand aProtocolSpecnow hold the Python value a numpy value holds, asEvaluationSpecholds its seed, so each equals, writes and runs as the same protocol with Python numbers. An array given for a tuple field is held as a tuple. And an integer seed above 253, numpy or not, now goes through the actions block exactly:write_bngl_protocolwrote 264 - 1 as 2**64, out of a seed's range, andparse_bngl_protocolread it so. -
An ODE sensitivity run from a state an SSA or PSA run left seeded dx(0)/dθ = 0 with no error, where one from a state an ODE run left is refused (#1749). Only the CVODE write-backs set GH #210's carried-over mark. A stochastic run now sets it too, and the mark issue #1528 reads for
sensitivity_ic, and drops any seed an earlier sensitivity run left, whichcarry_sensitivities=Truewould otherwise have read for a state the stochastic run had moved on from. So each such run is now refused, as after an ODE run. The refusal says how to take the state as fixed data, with dx(0)/dθ = 0:set_state()the run's last result row after areset()to a baseline no run advanced, or on a freshModelonce an advanced state has been saved as the baseline; thecarry_sensitivities=Truerefusal names the stochastic run that dropped the seed. As after an ODE run,set_param()of an initial-condition parameter no longer re-doses a species in the state an SSA or PSA run left, andsteady_state(sensitivity_params=...)of one that sets a conservation law's total is refused there. -
net_to_sbmlandnet_to_omexrefused a derived parameter that uses_pi()or_e(), and wrote a symbol named like a MathML constant, or liketime, as that constant (#1741). BNG2.pl writesk2 _pi()*k1into the.net; the call's()was left on pi's placeholder, and_ewas not translated. Both are now<pi/>and<exponentiale/>, bare or called, in the SBML and in a SED-ML action's value.write_bnglhad the same fault (3.141592653589793()*k1, and a bare_e, which BNG2.pl refuses) and now writes each as its number. A parameter, observable or function namedexponentiale,avogadro,true,false,inf,infinity,nan,notanumberortime(any case) was read as that constant, or as the clock, wherever an expression referred to it, with no warning: the trackedtests/data/exprtk_reserved_words.net(issue #18), whose parameterstrueandfalseare 0, converted with its rate at 2 instead of 1. Such a symbol is now written as a reference to itself, aspialready was; the calltime()is still the clock. The refusal of_pi(2)now names_pi, not an internal placeholder. -
net_to_omexrefused BNG2.pl's own network after anaddConcentrationbeforegenerate_networkto a seed that a latersetParameterchanges (#1740). The check that a.netis the network its.bnglgenerates (#1683) read every seed at the parameters' final values. BNG2.pl'saddConcentrationreads the seed when it runs and makes the species a number, which a latersetParameterdoes not move. So seedB() B0(B0 = 10),addConcentration("B()",60)andsetParameter("B0",20)give B = 70 in BNG2.pl's.net, where the check wanted 80. The actions are now replayed in order, each with the parameters of its moment. A parameter asetParameterwrites is read, before that step, as the.bngldeclares it: a number, or an expression (B0 10*k1) that follows what it reads. AnaddConcentrationafter asetConcentrationto an expression adds to the seed, as BNG2.pl does. A compartment volume asetParameterchanges before generation does not stop the check. A seed, and asetConcentrationto an expression, still follow their parameters to generation, as BNG2.pl keeps them. A.neta run rewrote is still refused. -
read_sedml_protocol, reading a document's standard elements, dropped, repeated or reordered runs where chains shared their first runs (#1739).write_sedml_protocolwrites a run that continues earlier ones as a chain that replays them, and the reader dropped every task whose steps were the start of another's. Sosimulate; simulate; resetConcentrations(); simulateread back two runs of three; a scan,saveConcentrations(), a run,resetConcentrations(),setConcentrationand a run read back the scan twice; and a run continuing a saved state after an unrelated run read back before it (t_end 2, 1, 3 for 1, 2, 3). None was reported lossy. Each task is now read once, in order, from where the tasks before it left the model, from a state they reached earlier (saved there, withsaveConcentrationsandsaveParametersunder a label of its own), or from the initial state, and replays to the bit what the annotation's protocol runs. A chain another tool wrote continues the longest start of it already run, and a task or chain that starts a chain already run is not run again, wherever the document lists it. -
run_protocolkept a derived parameter following what it reads after asetParameterset it to the number it already had (#1738). BNG2.pl'ssetParameterreplaces the network's expression with the number, whatever the number. Withk2 k1*0.5declared,setParameter("k2",0.5)thensetParameter("k1",3)ran k2 = 1.5 where BNG2.pl runs 0.5: A(0.25) = 54.977 against BNG2.pl's 50.017. The same happened after a scan or a bifurcate of k2 that ended on that number, and in a scan ofk1aftersetParameter("k2",3)atk2 k1*3.set_paramoverrides a derived parameter only while the value differs from its expression's (#188), so the replay now holds such a parameter at its number through every later write, and asaveParametersandresetParameterskeep it so. A parameter held so reads nothing, so a latersetParameter("k1","k2*2")is no longer refused as defined through itself. The hold is the replay's: on the modelrun_protocolreturns,set_paramfollows its own rule (#188), and a k2 that holds the number its expression gives follows k1 again. The issue's two protocols now give BNG2.pl's numbers. -
A SED-ML change that set a species from a parameter followed that parameter, so a scan of it moved the species, with no warning (#1737). SED-ML evaluates a
computeChange's orsetValue's math once, where it applies, asread_sedml_protocolalready read a parameter's (#1682), but a species' was kept as a live expression until the next run. A model changeA = A0*2and a resetting scan of A0 over 10, 20, 30 replayed A(1) = 11.35, 22.71, 34.06 where the document gives 113.53 at each point. The change is now read as evaluated once, andrun_protocolapplies it so. AsetValuein the sweep that reads the sweep's own range still follows it (#1733), and a BNGL block written from the protocol (write_bngl_protocol, orwrite_bnglwith aprotocol) now warns where BNG2.pl runs it from another amount: where a run starts from thesetConcentration's expression, which BNG2.pl keeps until a run and a reset to a save of it brings back (a resetting scan's, at each point), after a parameter it reads was changed or scanned, and where anaddConcentrationfinds the expression and adds to the declared amount. -
net_to_omex's SED-ML left a value the SBML computes by aninitialAssignmentwhere the simulator computed it on loading, when a parameter it reads was set as the model ran (#1733). A scan ofk1beside a derivedk2 = k1*3gave A(1) = 75.46, 50.12, 37.52 on libRoadRunner for BNG2.pl's 75.46, 75.00, 75.00, and a dose scan ofA0, with the seedA() A0, was flat at 56.77. Each suchsetValueis now followed by one of what the assignment computes, and a seed follows its parameter until a run; so does a species set to an expression,setConcentration("A()","A0*2"). The changes before a run are written in the order the actions made them, each after what it reads:setParameter("kr","k2*2")aftersetParameter("k1",5)rankr = 6for 30, and anaddConcentrationto a seed added to the amount the SBML holds. Thesedml_lossynote goes, except for an assignment SED-ML math cannot say (an SBML function, or time).read_sedml_protocol, given the SBML, reads thesesetValues beside a scan as the model's seed or expression, not as a loss. A chain now starts with its first run's own task, on that task's model, read once. -
Model.loadon BioNetGen's XML, the file NFsim and RuleMonkey read, gave an empty model with no error (#1712). Its<sbml>root is inhttp://www.sbml.org/sbml/level3, which is no SBML namespace, and the elements in its<model>are not SBML's: libSBML reports error 20101 and reads the<model>element but nothing inside it, so bngsim builtModel(species=0, reactions=0, observables=0, parameters=0), which ran and returned nothing.Model.load,Model.from_sbmlandModel.from_sbml_stringnow refuse an empty model that is BioNetGen's XML (told by<ListOfMoleculeTypes>or<ListOfReactionRules>) or whose root is in no SBML namespace. BioNetGen's XML is named, with the routes this build has that run it:NfsimSessionorRuleMonkeySessionon the file, orxml_path=beside the model from its.net. SBML with a missing or slightly wrong root namespace, whose model libSBML reads whole, loads as before. Of 4,359 XML files in the repository and the BioModels corpus, the 125 refused are all BioNetGen XML. -
The calls a caller brings from libRoadRunner, Tellurium, SciPy or BioNetGen name bngsim's call (#1700).
Model(path)andSimulator(path)failed inside bngsim ('str' object has no attribute 'param_names'); they now say to useModel.load(path).sim.simulate,sim.reset,bngsim.load,Model.from_file,result.to_dataframe()and other foreign names, andrun(0, 10, 11),run(t_end=10),run(n_steps=10)andrun(times=[...])(andt_end=,n_steps=and the like inrun_batch,run_replicates,parameter_scan,bifurcate,compute_all_sensitivitiesandrun_until), raise the error Python raised, now naming the call to make. None is an alias: BioNetGen'sn_steps=10isn_points=11.ParameterErrorlists close names, and says when a name is a species or an observable.result.species["A"]is species A's column, asresult.observables["A"]is. The table isbngsim._foreign_names.FOREIGN_NAMES. -
On an install with no BioNetGen,
Model.from_bngl's error andcapabilities()["missing"]["bngl"]ended with advice for bngsim's own developers (#1692). The closing sentence about theparity_checks/suite anduv sync --extra dev --group paritymeant nothing to a user of the wheel. Both messages now end at the fix that applies to them:pip install 'bngsim[bngl]', or point$BNGPATHat a BioNetGen folder. Contributors still get the--group parityadvice: from theparity_checks/entrypoints when they abort, and from the test suites' skip summaries. -
The first example on the docs index and the quickstart could not be run as written after
pip install bngsim(#1691). Each loaded amodel.netthe reader did not have; the README's had been fixed already (#1698). Both pages now write the README's two-species network tomodel.netbefore loading it, run it to t = 10 and print the closed-form check, so the three front-door examples agree and run in an empty directory. The docs test that executes them no longer supplies a model file or skips without pandas: it runs each block where a new user would, with no extra installed, and checks its answer against 100 e^(-0.5 t) at t = 10, and each value a comment says the block prints. The quickstart's parameter-sweep example setkf,krandkcat, which that model does not have; it now setsk, and the test runs it after the first block. -
run_protocolskipped a set before the first run of an actions block with nogenerate_network, as already in the network (#1687). On a.netloaded on its own,setConcentration("A()",50)then a run gave A(1) = 36.79 for 18.39; that is the actions fileomex_to_netwrites.parse_bngl_protocolnow generates the network at the first run only where the text holds a model; an actions block alone runs every action on the network it is given, or from areadFileof a.net.omex_to_net's actions file holds the actions from the protocol's generation point, with any save before it made again, so anaddConcentrationbefore generation is not added twice; one it cannot make is refused, or noted understrict=False.write_bngl_protocolwritesgenerate_networkwhere a protocol generated its network after its first step. -
The SED-ML written from a BNGL protocol had no data generators and no outputs (#1686). It did not say what any experiment reports, and nothing told its experiments from their parts: a run / add / run protocol wrote five tasks, three of them pieces of a chain. Each experiment now has a report, of the time and the model's observables (its species where it has none), read from the task that runs it; that of a run that continues earlier ones holds their rows first.
bngsim-net2sbml --sidecarpasses the network, so its reports name the observables. -
bngsim could not replay an archive it wrote when an action named a species with a component, a state or a compartment (#1685). The archive's protocol names
L(r)as the BNGL file does, and its SBML has the idL_r:run_protocolonload_model()andload_full_protocol()raised, andomex_to_net's actions file stopped BNG2.pl.read_sedml_protocol(..., sbml=)andload_full_protocol()now name each species and parameter by the SBML's id, so the protocol runs on the master model;load_full_protocol(entry)names them as another model entry does, the bundled.netby their BNGL names. -
net_to_omexleft no record in the archive of what its SED-ML's standard elements do not hold (#1684). Areset_conc=>1scan after a run is exported from the initial state (A(1) = 36.79, 56.77, 68.33 for 20.88, 50.92, 66.17); a warning at export said so, and the report,bngsim-conversion.jsonandmetadata.rdfread as for an exact export. Each such warning is now recorded inConversionReport.sedml_lossyand inbngsim-conversion.jsonundersedml_lossy, andmetadata.rdfsays how many there are.okandlossystill judge the network. -
The documented export pipeline packed the
.netBNG2.pl rewrote mid-protocol, and the archive started from the wrong state with every gate level PASS (#1683). At asimulatewith nosuffix, BNG2.pl writesmodel.netagain with the state of that moment, andbngsim-omex pack model.net --bngl model.bnglreplayed the protocol on top of it: forA -> 0with anaddConcentrationof 50 before the run, the archive started at 200 for 150, andegfr_path.bngl's first run at Grb2 = 100163 for 100000. Given a.bngl,net_to_sbmlnow checks the.net's parameters and seed species against what it declares, with the actions beforegenerate_networkapplied, and warns of and notes inlossya.netthat differs;net_to_omex(bngsim-omex pack) andbngsim-net2sbml --sidecarrefuse it, or pack it with the warning and the note understrict=False/--allow-lossy. The interchange guide writes the network withModel.from_bngl(..., net_out=...). -
A parameter set to an expression of other parameters was evaluated once, where BNG2.pl keeps it as that expression (#1682). After
setParameter("k2","k1*3")andsetParameter("k1",5), BNG2.pl runs k2 = 15 (A(1) = 75.00);run_bngl,run_protocoland the SED-ML export ran k2 = 3 (37.52), and a scan over k1 gave 50.12 for 75.00. The replay now keeps such a parameter as its expression through later actions, scans andsaveParameters/resetParameters, until a number is set, and refuses one defined through itself, or through the network's own expressions, as BNG2.pl does. The SED-ML sets it again after each change to what it reads, a reset included, and at each point of a scan of it; a change to a parameter the SBML computes by aninitialAssignmentremoves that assignment first, which overrode it. A value read from another tool's SED-ML is still evaluated once, as SED-ML says (StateChange.evaluated_once). -
An ODE run that starts far from t = 0 returned a wrong trajectory with no error (#1681). The integrator advances its clock by
t + h, and far out the doubles are coarse:A -> 0at k = 1 over(1e15, 1e15 + 10)gave A(+5) = 0.00144 for 0.00674, and over(1e17, 1e17 + 64)A stayed at 1. A model that reads no clock (no function oftime(), no table indexed by time, no event) is now run (method="ode") on the time elapsed since its start (its end, for a run below 0 that starts over twice as far out), wherever the run's end nearer 0 is at 2^20 or beyond, and reports the times asked for: counted from its start, it is the run from 0, to the bit, where its start is on the spacing of the doubles at the far end (always, below 0), and as accurate where it is not. A run nearer 0 is unchanged. A failure of a moved run whose message names a time names it on the run's clock and says which time to add. A model that reads the clock keeps the absolute one, as before; a switch on a counter clock moves with the run, its switch time placed from the counter (#1828);run_diffraxis not moved. -
SUNDIALS' warnings were written to the process's standard output (#1680). They pass by
sys.stdout,warningsandlogging, so a run that is right could put lines into the output of the script that called it:A -> 0at k = 1e9 from t = 1e6 wrote eleven[WARNING] ... t + h = t on the next steplines there, mixed into whatever the script printed or piped. They now go to standard error, where SUNDIALS'[ERROR]lines already went.SUNLOGGER_WARNING_FILENAME, SUNDIALS' own environment variable, still decides where they go when it is set:stdoutputs them back, the null device drops them, and that holds too for the runs that drop their own warnings (a model with discontinuity or state-switch roots, KINSOL), which overrode it before. The solvers guide's Logging section says so, and that the variables are read once per solver context. A name SUNDIALS cannot open (a directory that does not exist) stops every run and solve, and the error now names the variable, where it said onlySUNContext_Create failed. -
An ODE run whose solution leaves through minus infinity in finite time returned a number near -1e286, with no error, when the species was declared at 0 or above (#1679).
X' = -(1 + X^2)fromX = 1istan(pi/4 - t), with no value fromt = 3*pi/4on; a run tot = 3returnedX(3) = -3.5e+286, where the same law withXdeclared negative, or run to plus infinity, was refused. OnceX*Xoverflowed, the non-finite retry (GH #135) readXat 0, where the law is -1, and the run carried on. An overflow in the species' own law that is finite one atol below 0 is not an edge at 0, so such a slot now keeps its value and CVODE cuts the step: the run fails at the blow-up. An overflow that reaches up to 0, asexp(-1/S)does, one in another species' law, or one whose own law pushes the species back up toward 0 (an undershoot consumed atW*exp(-W/1e-7)), is read at 0 as before. -
net_to_omex(bngl=<absolute path>)wrote that path into the archive's SED-ML annotation (#1678). An archive made to be shared carried the exporter's directory names, a user name among them. The protocol'ssourceis now written as the file's name alone, in every SED-ML documentwrite_sedml_protocolwrites, soread_sedml_protocolreads backm.bngl, not the path it was exported from. -
The SED-ML written from a BNGL protocol failed the official SED-ML L1V3 schema (#1677).
write_sedml_protocol, and sonet_to_omex(bngl=...),bngsim-omex pack --bnglandbngsim-net2sbml --sidecar, wrotelistOfModelsbeforelistOfSimulations; the lists are now in the schema's order. Experiments are numbered by position, so a protocol that holds oneExperimenttwice (combine_protocols([p, p])) no longer writessim_1andtask_1twice. -
read_sedmlpaired the first time course with the first model and every data generator, reading no task (#1675). A task on the second model listed ran the first, and a two-task document's spec carried the other task's outputs. It now reads the first task's simulation, its model (the file at the end of the model'ssourcechain) and the generators of that task, and carries a parameter change of the model asparams; a change it cannot carry is said, and so are the tasks it leaves unread. -
An ODE row on the instant a counter reaches an event's threshold read the state before or after the event according to the run's length (#1673).
x(0) = 0.1,x' = 1,at (x >= 2.6): S = 1: the row at t = 2.5 read S = 3 fort_endin (2.5, 4] and (32, 64], and S = 1 for (4, 32], with nothing else changed. The crossing time came from a two-point solve over a power of two at or above the run's end, which in doubles moves by an ulp with that scale. For a trigger whose truth changes where its residual first reaches 0 (>=or<on a rising counter,>or<=on a falling one) it is now moved to the first double at which the residual, as bngsim's threshold evaluator computes it, is 0 (or the nearest where none is), so the stop and the row no longer move with the run's length, and a row on that first zero holds the state after the event (#1124). So is one written withabs()or a square (abs(x - 3.1) <= 0.5), whose edges had been registered as strict. Solved over the crossing's own scale, not the run's end, a strictx > 2.6,==or!=also stops at one double for every run length. -
A
saveParametersorsaveConcentrationsmade beforegenerate_networkwas lost from the SED-ML, and refused by the replay (#1668). Saved at k2 = 0, A = 50, set back, generated and reset, BNG2.pl runs A(1) = 18.39; the exported task ran the network as generated (56.77) underok=True, andrun_protocolrefused it. Both now go back to the save: the network, with the actions that made the saved values applied again. A save of a value as the model declares it, which the network no longer holds, is refused by the replay and said by the writer. -
bngsim read and wrote text in the locale's encoding, so a UTF-8
.bnglfailed to load where the locale is ASCII, and was misread under Latin-1 or Windows' cp1252 (#1665). One non-ASCII character, even an em dash in a comment, madeModel.from_bnglraise a bareUnicodeDecodeError; 83 of the 895 BNGL files in the parity models have one. Every text file bngsim opens, and the output of BNG2.pl it reads, is now UTF-8: 33 places, 7 of which ruff'sPLW1514does not see. That includes what bngsim writes:Result.to_csv,.gdat/.cdat,.net, BNGL and SED-ML files are UTF-8 on every platform, where on Windows they were in the ANSI code page. A.bnglwith a byte that is not UTF-8 (a Latin-1 comment) is handed to BNG2.pl as it is. Its actions are read too, with such a byte as U+FFFD. A compiler's output is read in the encoding it writes to a pipe (the OEM code page on Windows, UTF-8 elsewhere). Output that is not valid has its bad bytes replaced, so BNG2.pl's own error is shown, not a decode error. A test reads the package's source and fails on a text-mode open that names no encoding, so the next one is caught. -
A SED-ML scan ran its first range's raw values, whatever its
setValue's math and whichever range it named (#1664).k = 10^xover x = 0, 1, 2 ran k = 0, 1, 2 (A(1) = 1, 0.368, 0.135 for 0.368, 4.5e-5, ~0), and so did a scan over afunctionalRange10^x or over a secondvectorRange1, 10, 100.read_sedml_protocolnow runs the value thesetValue's math gives at each iteration, over the range it names, afunctionalRangeevaluated over the range it is on. A sweep whose math reads the model's values, or uses math the reader does not evaluate, is said and recorded as lossy. -
read_sedmlread a data generator as its first variable and dropped its math (#1663). A generatorA + Bcame back asspecies:A(0.135 for 1), and100*Aasspecies:A, with no warning. A generator is now an output only where its math is one variable as it stands; one that computes a value from its variables (a sum, a scaling, a normalization) is left out ofspec.outputs, with aConversionWarningthat names it and its formula, since no output selector names it. -
read_sedml_protocolread a foreign SED-ML document as one run per time course, chained, with every model change dropped and no task read (#1662). A task whose model set k2 = 0 ran the unchanged model (A(1) = 56.77 for 36.79); two independent tasks ran the second from where the first ended (50.92 for 56.77); two tasks on one time course were one run. On BioModels' SED-ML for BIOMD0000000010 the second task gave MAPK_PP(12000) = 79.8 for 92.7, with no warning. The document is now read by task: each task runs its model from its initial state, with the model'schangeAttributeandcomputeChangechanges (a species' value, a parameter's, a kinetic law's local as_lp_<reaction>_<id>, an addition) as the steps before it; arepeatedTasksweeps (a constantsetValuebeside it as a step) or chains its subtasks on one state; the state is reset between tasks; a chain that repeats the start of a longer one is read once. A change the replay cannot apply is said and recorded inspec.lossy, whichrun_protocolrefuses unlessallow_lossy. A species'initialAmountneedssbml=for its compartment's size, else it is lossy too. -
A species negative where the model has it so, but not declared negative, followed the wrong ODE with no warning once another species tipped a rate law non-finite (#1661). The non-finite retry (GH #135) read every concentration below 0 at 0, so a voltage written to -61 by
set_concentration, or one declared at 10 that its own law takes below 0, was read at 0 beside asqrtof an emptied species: V(40) = -328.6 for -69.8. The retry now reads at 0 only the slots the non-finite rows of f, or of the Jacobian, read, and the #1340 band reading likewise; of those, it puts back each slot further below 0 than any rounding of 0 (10^6 of its atol) wherever the reading stays finite without it (also beside another slot at 0,P^1.5*log(-V)), and at any depth for the rest of the run once put back. AtExactAtol(1e-4)that threshold is 100, so a V crossing 0 on its own is read at 0 until it passes -100. This holds in the time course and the steady-state run test. Where no such reading is finite, the retry reads as before. -
A
run_batchrow, or aparameter_scanorbifurcatepoint, was held to the default atol of the state the call was made from, not the one it started from (#1660). A row that doses a growing species decades below the model's value was held to a tolerance above that species, with no warning: a logistic grower declared at 1, dosed at X0 = 1e-9, returned X(20) = -4.6e-7 for 0.327 (-1.5e+292 atn_points=41), and a continuation scan of X' = -X returned -1.25e-8 for 2.06e-9. A scalar atol, the default or one passed, is now also read from each row's own start, asrun()reads it, and each species takes the tighter of that and the model's reading, so no row is held looser than before; AtolScaleWarning reads the tolerance each row ran at.atol="auto"is still one vector per call, but each species takes its smallest scale over the rows' starts, not its scale in the live state, which gave the same -4.6e-7;steady_state_batch's does too. A batch reads the model's side at its initial conditions, not where a run left it. -
SSA and PSA stored an event's concentration assignment over the load-time size in a compartment an assignment rule sizes (#1659). In
c := 1 + time,at (time >= 2): S = 50stored an amount of 50 where the size was 3, and[S](3)read 12.5 for 37.5. The event now stores the concentration times the size the rule gives at the event, as it already did for an event-resized or rate-rule compartment. -
SSA and PSA recorded a row on a state trigger's crossing as before the event for some grids and after it for others (#1658). With
q' = 0.1from 0 andat (q >= 2.5): S = 1, the row at t = 25 heldS = 3att_end= 25, 27, 30 and 50 andS = 1at 26 and 40: the integral landed a few ulps either side of 2.5. A row now reads the rate-rule state a bisection tolerance ahead of it, with the clock at the row, as the ODE run reads it half a root tolerance ahead (#1133), so a crossing on the row fires before the row is taken. A trigger on the clock alone is read at the row as before, sotime > 25still holds the row at 25 before its event; one that compares the rate-rule state with the clock within that tolerance (q' = 1; at (q > time), with q equal to time) now fires at the first row, as it does under ODE. -
A
.netfile that is not UTF-8 failed with a bareUnicodeDecodeError(#1653). A species name saved in Latin-1 (Aµ(), the byte 0xb5) loaded, and its name then raised an error that named neither the file nor the line; a refusal quoting such a line lost its words to the same error.Model.from_netandparse_net_filenow refuse a line of the five blocks that is not UTF-8 with theModelErrorandValueErrorthey document, quoting the line with the byte shown as\xb5, and show such a byte the same way in any other refusal, the table-function reader's of a table file among them. A byte in a comment, a block passed over or an action line still loads.write_netnow writes UTF-8 whatever the locale: under a Latin-1 or cp1252 locale (Windows) it wrote such a byte, and could not write a name outside that encoding at all. -
A
.netHill law whose exponent was moved into (0, 1) after loading failed at zero substrate (#1636). #1497's guard, which reads the law as 0 at S = 0 for 0 < h < 1, was written only where h was in (0, 1) at load, soset_param, arun_batchrow,parameter_scanor a BNGLsetParameteraftergenerate_networkthat moved it there evaluatedinf*0and the run failed withCV_FIRST_RHSFUNC_ERR. The guard is now written for every Hill law, and the issue's model gives BNG2.pl's S(5) = 2.796028127 on each route. An SSA or PSA run after h is moved there no longer fails on a NaN propensity at S = 0. A run, with or without sensitivities, a steady-state solve andrun_diffraxread a condition the parameter values decide, such as the guard's(h <= 0) or (h >= 1)at h = 2, as that constant and root nothing for it, so a model at h >= 1 does not pay the root's cost, and runs wherever it ran, but for one case:run_diffraxof a model loaded with h outside (0, 1) and given an h inside it byparam_dictis now refused, as a model loaded there already was. A model with events keeps every root. -
An expression's output sensitivity after
run()readssum,avg,asinh,acosh,atanhand other smooth built-ins (#1531).output_sensitivitiesraised for a function such assc*sum(Atot,K)("could not parse expression for differentiation") orsc*asinh(Atot/K)("not representable in C"), whilesc*(Atot+K)andsteady_state()answered. These now return the derivative, as doerf,erfc,log1p,expm1,mul,logn,ncdf,deg2radandrad2deg.hypot,cot,sec,csc,sincandtgammaare still refused, as before. -
A sensitivity parameter on a kink of a derived rate constant is refused, and a tie of one slope in one is weighed once (#1530). BNG2.pl writes an inline rate law such as
0 -> X() 10*min(q,1)+sas a derived parameter on an elementary reaction, and #1332's refusal read only functional rate laws:minat q = 1 returned dX*/dq = 23.81 (neither side's slope, 47.62 or 0),clampat an edge andif()on its switch at a steady state one side's, with no error. Those are now refused inrun(),run_batch,compute_all_sensitivitiesandsteady_state(), for a derived parameter that an elementary or MM reaction's rate constant, a functional law or a species' initial amount reads, however deep the chain.max(q, q*a, q*b)at a = b = 1, which has a derivative, returned 71.43 for 47.62 in a derived rate constant, kcat or initial amount; it is 47.62 now. -
The steady-state stability certificate could call a stable root unstable, and report a wrong spectrum, where a near-zero eigenvalue's row fed a species nothing reads (#1529). A
$-fixed source S feeding X at k = 1e7, X read by nothing:steady_state(method="newton")returnedroot_stability == "unstable"with+6.9e-05for an exact 0 and-1.000069for -1, where numpy andsteady_states()give the exact spectrum; at k = 6.31e7 it reported -1 as -0.968. The dense eigensolver's balancing skipped such an isolated row without moving it, and the zero's condition number was k. It now isolates rows and columns as LAPACK'sdgebaldoes, and reads their eigenvalues exactly. Over the corpus, every certificate's label is unchanged and every spectrum moves by under 1e-12 of its radius. -
save_concentrations()cleared the carried-over mark of a state a run had advanced, so the next sensitivity run started fromdx(0)/dθ = 0with no error (#1528). Without the save such a run raises, since the state isx(θ); with it, it returneddA(0)/d(kp, kd) = [0, 0]for[2, -8]: equilibrate, save, measure, and the doseset_concentration's docstring says to save.reset()to that baseline, a named snapshot or aSimulator.snapshot()of it restored, a clone ormake_subset_modelof it,run_batchrows from it andsteady_state(sensitivity_params=...)on it did the same. The save now keeps the mark, the baseline and both kinds of snapshot keep it forreset(), the restores andclone(), and all of these raise. A save of a state no run advanced, such asset_concentrationdoses on a fresh model, is still literal initial conditions. Sodifferentiable_solveafter a run and a save, which #1521's warning offered as a start with derivative 0, now refuses, and so doessensitivity_icfrom a restored snapshot of an advanced state, where a laterset_paramof an initial-condition parameter no longer moves species. -
A
SatorHillrate law on a repeated reactant now loads (#1527). BNG2.pl writesA() + A() -> B() Sat(kcat,Km)as1 1,1 2 0.5*Sat kcat Km, andModel.from_bngl,Model.from_netandparse_net_filerefused it with "does not yet support repeated/non-unit reactant stoichiometry". The rewrite to a Functional law now reads reactant positions, as run_network does, so these models give run_network's trajectory (A(1) = 4.407330663 for Sat, 3.881617517 for Hill), in ODE, SSA and sensitivity runs. A second saturation constant on a repeated reactant (0.5*Sat kcat Km K2) is counted against the reactant positions, as BNG2.pl counts it. -
steady_state_batchstarted every entry from the initial conditions, not a state the caller had written, with no word (#1521). Afterset_concentration("A()", 20)inA <-> Bit returned the steady state of the seed total, [3.33, 6.67] for [6.67, 13.33], and in a bistable model the other branch, eachconverged=True, whererun_batchwarns on the same state (#1362). The reset stays, since it is what puts an initial-condition parameter's dose into each entry. The batch now warns where the model's state differs from its initial conditions andstates=is not given, and its docs, the steady-state guide and the API reference say where an entry starts.bngsim.jax.differentiable_solve, which resets its clone the same way, warns too. Each warning,run_batch's included, now says that a start from the current state drops a dose written to an initial-condition parameter, and zeroes its derivative: after a run, a batch overA0= 5 and 40 gave totals 10 and 10 from either remedy.Model.reset()first keeps the dose. -
steady_states()merged distinct roots closer thantolin concentration, and dropped one of a nanomolar switch's three (#1518). The clustering tooktol, a residual tolerance in concentration per time, as an absolute merge distance in concentration. In molar units at nanomolar scale the Schlogl switch's roots at 0.2 nM and 0.5 nM were one root, the seed decided whether the attractor or the saddle survived, and nothing warned; the same model at unit scale gave all three. The floor is now a distance in concentration: for each species,1e-9of the largest value it takes at any converged start, or double precision's resolution beside the largest magnitude the solves saw, whichever is larger, beside the law floor that was already there;SteadyStates.cluster(atol=None)derives it, and a givenatolis used as given.tolplays no part. A start KINSOL leaves short of its root (Newton distance above 1), accepted undertol, is now solved once more from where it stopped: withouttolas the floor it would come back as a root of its own. -
A kinetic law's local parameter named like a compartment, or like a species outside the reaction, was read as that global in a mass-action law (#1503). In
C*k*Swith a localC = 7, the local was cancelled against the storage volume as the compartment, and ink*S*Qwith a localQit was multiplied in as the speciesQ: S = 2.456 and 2.222 where SBML scoping gives 0.740. The right-hand side, the Jacobian, the SSA propensity, both codegen paths and forward sensitivities shared the wrong rate, with no warning. The mass-action classifier now reads a law's locals first, as the Functional path already did, so the reversible splitter and a local shadowing the reactant itself (L3V1) read them too. A shadowing local also no longer marks the reaction as reading the compartment's size, which refused a write to that size for nothing. -
A
.netMMreaction with three or more reactants left all but two out of its rate (#1502).S + E1 + E2 -> P + E1 + E2atMM kcat Kmran with E1 as the whole enzyme, P(1) = 0.896350 where run_network gives 3.318492, and with E2 when the enzymes were listed the other way round, with no warning. Every engine read the first two reactants only.Model.from_net,parse_net_fileandModelBuildernow refuse anMMreaction with more than two reactants, as BNG2.pl refuses such a rule, and say how to write run_network's reading of it as a functional rate law. One or two reactants load as before. -
write_sbmlflattened a comparison of a comparison, even BNG2.pl's bracketedif(((0<x)<1),k,0)(#1499). ExprTk, BNG2.pl and run_network read(0<x)<1as a comparison of the truth value of0<x; libsbml'sparseL3Formuladropped the brackets and wrote0 < x < 1, and turned the "not" idiom(x>1)==0into(x>1) && (1 == 0), so the written SBML gave A(1) = 3.679 for 10 and B(1) = 10 for 3.679, andnet_to_sbml's gate passed a band model that stopped at 20 for 30. The writer now brackets every relational chain as ExprTk groups it (1<x<2,a==b<1, ...) and writes a truth value that a relational compares, a relational or a logical, aspiecewise(1, cond, 0), which libsbml keeps and which is well-typed SBML. Function assignment rules and derived-parameter initialAssignments both go through it. -
SSA and PSA computed observables and expressions on the stored count over the load-time size in a compartment whose size moves (#1464). After an event resized
cfrom 2 to 4,B := 2*Xreported 64 for 32, and every observable or expression that readXread it at twice its concentration; the same under a rate rule, and in a compartment an assignment rule sizes (c := 1 + time), wherep := 2*Sand the observableSnever moved. The rows' observables and expressions now read such a species at its count over the compartment's live size, as the ODE run reads it. The run itself still goes on from the stored count. -
SSA and PSA started a concentration species from its count at the compartment's load-time size, where its starting size had been written (#1463). With
set_concentration("c", 3)on an event-resized compartment loaded at 2,X = 50started at 100 molecules for 150 and stayed low by 3/2; the same for a rate-rule compartment, and for one an assignment rule sizes from a parameter that was written (c := V0 + time). A run that starts from the model's concentrations now counts them at the size the compartment has at its start. A run that goes on from where an SSA run left the model (a secondrun,run_until,run_replicates,save_concentrationsandreset, a named snapshot, a clone) keeps the counts it left, and an SSA run after an ODE run counts the ODE's concentrations at the size then. A concentration written withset_concentrationover the state an SSA run left is still read as a count, as it was before. -
Forward sensitivities across a narrow pulse's corner were up to 1e-3 off on some output grids, with no error (#1456). CVODE finds the corner inside a step that went past it, and that step's corrector applies the post-corner rate to the whole step, so the sensitivities it hands over at the corner can be 1e-4 to 1e-2 off even though the step passed its error test. Those columns are now integrated again over that one step from its start; this is used only where the re-integration checks out as accurate. On the issue's triangle at rtol 1e-8 the worst grid moves from 1.4e-4 to 1.5e-5.
-
Forward sensitivities across a narrow pulse whose rate law reads
time()were off by up to 3e-4, with no error (#1455). The restart a hair past a rate-law switch moves the state and keeps the clock, and where the right-hand side reads the clock, where it restarts depends on when the switch crossed, which moves with each parameter. The sensitivities now carry that term. A triangle 0.003 wide inTobs + time()is now right to the clock's own rounding, 1e-5 at t = 25. Models that do not read the clock are unchanged. -
Forward sensitivities across a narrow pulse that jumps were slightly off, with no error (#1454). After a rate-law switch that jumps, the run restarts a hair past the switch, and the sensitivities were left behind the state there, as #1285 fixed for continuous switches. On a rectangle 0.003 wide in a clock, dY/dk_clock was 4.6e-5 off at every tolerance; it is now right to 3e-9 at rtol 1e-12. A re-taken step could also stop on the crossing it was re-taking and lose that crossing's jump in the sensitivities, which now restarts at the crossing instead.
-
SSA runs with recurring events far from t = 0 came back slow, with no error (#1436). On the continuous loop (a rate that reads the clock, or a rate rule), each event's restart counted the hazard to the event's time and moved the clock to the double it rounds to, up to half a spacing of the doubles later; and a firing whose rounded time reached the double where an event's trigger turns over drained that event and restarted its waiting time from the rounded time. 500 events a unit busy at t = 1e12, where the doubles are 1.2e-4 apart, fired 2.27% too slowly (z = -17.6). The hazard now runs to the double the clock moves to, what passes E there goes on to the next waiting time, and a firing's restart carries the time its rounding moved the clock past it: that case comes back within about 0.05% of the exact rate, and 1000 events a unit at a rate of 500 within noise. Near t = 0 these agree with what ran before to rounding.
-
The "New test files run somewhere" check read a pytest command that names no path as running nothing, though pytest then runs
testpaths(python/tests). Such a workflow was skipped, and a new file only it ran was reported as run by no check. A command with no path now runs the whole suite; one with--version,--help,--collect-only,--fixturesor--markersruns none. A redirect's file descriptor (2>&1) is not read as a path, and a step whose command ispytestalone is read. No workflow runs pytest that way today, and the six that run it read the same as before. -
A network-free run with connectivity on no longer reads three uninitialized NFsim flags. NFsim's
Systemconstructors leavetrackConnected,printConnectedandtrackRxnNumberunset; only NFsim's own command line sets them. Whatever the heap held could turn on per-firing debug logging to files that were never opened, which slowed runs and is undefined behaviour; under the sanitizers it stopped six connectivity tests every night since #1818 (#1816). bngsim now sets all three to false when it loads a model. -
Two nightly checks failed on their own test setup, not on bngsim. The sanitizer job stretches each run's timeout through a wrapper around
Simulator.run. A warning raised with a fixedstacklevelnamed the wrapper's frame instead of the caller's line, andResult.rerun()stretched an already-stretched timeout a second time: three tests failed there and nowhere else (#1816). The weekly live parity run built AMICI from source with the newest swig, and AMICI then refused to compile any model against the swiguv.lockinstalls, so every AMICI sensitivity reference failed (#1824). The wrapper is now skipped when frames are counted, the rerun test's timeout is one the wrapper leaves alone, andpyproject.tomlpins the swig AMICI is built with touv.lock's. -
parameter_scanover a parameter that seeds an initial condition dropped the dose after a run, and no warning said so. Each point starts from the state at the call, and a parameter write moves a species only while it sits on its initial condition: a scan over A0 = 5 and 40 after a run started both points at the run's A = 6.07 (found on #1643). The scan keeps that start, which a pre-equilibrated protocol relies on, and now warns, naming the species it does not move, through a derived initial condition too (A = A0*s), a compartment size and aftersave_concentrations()with no label; in a sensitivity scan, where no write moves a species, it names every species the parameter seeds. The warning, aScanDoseWarning, namesModel.reset()first, for a dose scan from the initial conditions (outside a sensitivity scan, which refuses that start), and anon_pointhook, to dose from the current state. Where the scan also raisesLiveStartWarning, that warning no longer offerssave_concentrations(), which would not dose them. Each Result records the dose warning innoticesasscan.dose_dropped.