diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e745bf97..9b55c6911 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,124 @@ release commit, so no two branches ever edit this file (issue #668). Add a fragment — see [`changelog.d/README.md`](changelog.d/README.md) — rather than an entry here. +## [0.19.0] - 2026-12-04 + +### Added + +- **`Simulator.compute_all_sensitivities` takes explicit output times, `sample_times=`, as `run()` does (issue #2100).** It wrote only a uniform grid of `n_points` over `t_span`, so sensitivities at measurement times, or on a log-spaced grid over many decades (0, then 1e-2 to 1e8), could not come from it: no uniform grid from 0 lands on both 1e-2 and 10^-1.5. The times are read as `run()` reads them: at least two, all finite, sorted, a repeated time a row of its own; with `t_span` given too, each chunk integrates over it and reports at the sample times, and one outside it is refused. Every chunk, and every column the retry of a failed chunk runs alone, reports at those times, so the stitched tensor is on them; with one chunk it is `run(sample_times=...)`'s, to the bit, on the models tested (mass action, and a functional rate law with a time switch). `times=` and SciPy's `t_eval=` now point to `sample_times=`, as they do for `run()`. + +- **A stack of replicates gives the standard error of its mean ([#2017](https://github.com/lanl/bngsim/issues/2017)).** For a stack of replicates (`run_replicates(..., squeeze=True)`: rows whose seeds all differ), `Result.digest()` gives `last_sem` and `replicates: True`. `Result.check()` of the stack, which raised before, gives each observable's mean and its standard error at each output time, judging nothing, and says how many replicates would bring the largest relative standard error under 1%. `bngsim check --replicates N` does the same. Any other stack gets no standard error, and `check()` still refuses it, now saying why. `Result.record` gains `row_seeds`, each row's seed of a stack; as with any key added to the record, a rerun's `rerun_of.record_sha256` now differs from the one 0.18.0 wrote for the same run. + +- **`--deadline SECONDS` bounds a whole `bngsim` command ([#2016](https://github.com/lanl/bngsim/issues/2016)).** `--timeout` counts the run only, and loading the model, BNG2.pl, a cold compile and `check`'s reruns each had a limit of their own or none, so `bngsim check model.bngl --network --timeout 60` could run for about half an hour, past an agent's shell limit, which then killed it with no JSON and no exit code. `--deadline`, on every command that loads a model, counts from the command's start over every phase. Past it the command stops BNG2.pl or the compiler, and exits 5 with `run.timeout`, the phase it was in (`load`, `generate`, `compile`, `run`, `check`, `describe`), the seconds spent in each, and the `--out` files it wrote. `check`'s `--budget` is cut to what the deadline leaves, so the run and a report come back (exit 6) with the reruns that did not fit as `timeout`. + +- **Under `--deadline`, a file `--out` names is written whole or not at all ([#2016](https://github.com/lanl/bngsim/issues/2016) review).** Written directly, a file the deadline stopped was left cut short at a whole row with nothing to say so. The arrays now go to a temporary file, then into the file `--out` names in place (a new file made as writing it directly makes it; one that is there keeps its links and attributes), with the deadline waiting for that step; where no folder can be made for the temporary file, or it runs out of room, the file is written directly. Without `--deadline` the file is written as before. + +- **A BioModels entry's SED-ML experiments, fetched with the model they run ([#1972](https://github.com/lanl/bngsim/issues/1972)).** `describe()` of a model from `Model.from_biomodels` lists the entry's SED-ML files with BioModels' descriptions, and `Model.from_biomodels(id, experiment="figure1.sedml")` returns the model the file runs and its `ProtocolSpec`, for `bngsim.run_protocol`. Each file is checked against its published sha256 and cached. Nothing chooses a file for you. A template, BioModels' generic time course from 0 to 10, is labeled by its description or by the ids its generator writes, warns when asked for, and gives each run the notice `biomodels.template`. `record["run"]["experiment"]` names the file only on a `run_protocol` run of it as written: the protocol as read, on the model as loaded, with its own tolerances and no lossy step. New codes: `model.biomodels_no_experiment`, `model.biomodels_experiment_files`, `model.biomodels_unexpected`. `bngsim run` and `bngsim check` take `--experiment FILE`. + +- **SBML display names are kept, shown and read ([#1970](https://github.com/lanl/bngsim/issues/1970)).** A loaded SBML or Antimony model dropped each element's `name`, so BIOMD0000000073's "Mb" was only `species_0` and `r.species["Mb"]` raised "not found". `Model.describe()` now gives each species, state, parameter (local ones too), compartment and reaction named other than its id a `display_name` beside the id, which `name` stays. A display name the file gives one element, and no id, reads it in `result.species`, `result.observables`, `get_param`, `set_param`, `set_params`, `get_concentration`, `set_concentration`, the sensitivity arguments, `parameter_scan`, `run_batch`, `steady_state_batch` and `compute_all_sensitivities`. One several elements share is refused with each named. `result.record["columns"]` gives each species column, and the observable named after it, its `display_name`, with `display_name_shared` or `display_name_is_an_id` where it reads nothing; a saved Result keeps them. A net_to_sbml file's BNGL patterns come back as display names. Annotations are not read yet. + +### Changed + +- **`compute_all_sensitivities`' `t_span` defaults to `None` (issue #2100).** Without `sample_times` it means `(0, 100)`, the old default, so a call that gives neither runs as before; with `sample_times`, the sample times' own span. The default changed so that a `t_span` passed beside `sample_times` can be told from one that was not, as #2012 did for `run()`. + +- **Building the analytic sensitivity right-hand side of a large model takes more than a third less time (issue #2099).** `generate_sens_from_model` redid two pieces of fixed work for every expression: it split the model's parameter names into the ones a single tokenizing pass can find and the rest (one regex search per name) for each derived parameter, and it copied the symbol tables of the model into new sets for each rate law. The split now runs once per name set (each expression still builds the set to look it up, a sixth of the split's cost), and a rate law reads the tables in place. On Froehlich_CellSystems2018 (1,396 species, 8,350 parameter names) the call took 4.5 s against 7.3 s (median of three cold builds each), and so leaves more of the 20 s derivation budget for the derivatives themselves. The generated code is unchanged: byte for byte the same on the 502 SBML and `.net` models in the repository that load. + +- **A test now keeps the ODE integrator's tolerance table whole, and an event's assigned value is differenced over the step its constant names (issues #2045, #2073).** `python/tests/test_tolerance_table_ratchet.py` fails a pull request that adds a `constexpr` constant named `k…`, of any type, to the integrator's sources without a row in `docs/development/tolerance-table.md` and a test that pins it, or that leaves a row naming a test that does not exist; a removed constant's row is marked removed, not deleted. The three difference steps of an event's assigned value, which were written `1e-6`, now read `kAssignedDifferenceStep`, which is 1e-6: no result changes. + +- **`check()`'s libRoadRunner and AMICI checks skipped every run at changed parameters or at `sample_times=` (issue #2014).** After a `set_param`, the commonest thing a caller does, only BNGsim-against-BNGsim checks ran, so a scan, a dose or a fit was never checked by another engine. Both engines are now given the run's parameters that are not the file's, by their SBML ids, where each is a global parameter of the file that no rule and no initial assignment sets, and the run's sample times. libRoadRunner computes what the file derives from such a parameter at the start, as `set_param` has BNGsim do. The verdict's new `applied` key, and the end of its note, name what the engine was given. A compartment's size or a reaction's local parameter is still a skip, with its reason, and so is a changed start state (a `set_concentration`, or a run that continued another). + +- **`check()`'s libRoadRunner and AMICI checks skipped every run whose start a `set_concentration` had set (issue #2014).** The record could not tell such a start from one that continued another run, so a dose was never checked by another engine. The record's `run` part now has `concentrations_set`: the species the caller set with `set_concentration` since the loaded initial conditions, with their values (`{}` for none; one saved with `save_concentrations` is in the state `reset()` returns to), checked against the start itself, and `None` for a start of another history (the end of an earlier run, `set_state`, a restored named snapshot). Both engines are given each set species' start, as a concentration, or for one the file holds in amounts as that times its compartment's size, after what the file computes at the start, so nothing derived from it follows, as in BNGsim; AMICI with an initial sensitivity of 0 (a species set to the file's own start is no change). `applied` gains `concentrations`. A start of another history, a species the file declares constant or a rule sets or in a compartment of no constant size, or a file with events, is a skip with its reason. + +- **A model built with `ModelBuilder` could not be rerun or checked (issue #2013).** `Result.rerun()` raised "there is no source to build it again from", so `check()` of the agent guide's own builder example was a tolerance `exception` and a grid `unsupported`. The builder now keeps its calls, which take plain data, as the model's source: the record's `model.format` is `"builder"`, with the sha256 of the calls, and a rerun makes them again, a Result saved with `save()` and loaded in a new process included. `check()` works on such a run as on a loaded model's, with `second_engine` `unsupported`, as there is no file for libRoadRunner to read. A run whose record holds no source (a model built through the core's builder, or one a builder call raised partway through) gets `unsupported` from every check, never `exception`. + +- **`bngsim steady-state` exits 7 when the solve did not converge (issue #2011).** It exited 0 and printed the values where the march stopped, under a command named `steady-state`. `steady-state-batch` now exits 7 when any row did not converge, and `steady-states` when its search finds no steady state. The JSON is unchanged and still on standard output, with `converged: false`. A caller that read exit 0 as "no error" should treat 7 as an answer that is not a steady state. + +- **`check()`'s default on a sensitivity run could not catch a column that is wrong at every tolerance (issue #2010).** The default checks all reran the same sensitivity code at a tighter tolerance or on a finer grid, so issue #1937's column of exact zeros passed them, and only `check("all")`'s difference quotient saw it. A run that computed forward sensitivities now gets `sensitivity_fd` by default as well: it moves each parameter by 0.1% and 0.2% of itself and differentiates the trajectories with the sensitivities off, so it reads nothing of the sensitivity code. It costs four runs per column and one more, which `budget=` bounds; the columns a budget does not reach are named in the verdict's `timed_out`, counted in its new `n_timed_out`, and named in `next`; an ok report's `next` also names the columns a check left out (`not_judged`, counted in the new `n_columns_not_judged`: a value at 0, a derived parameter). `timed_out` no longer lists a column at 0, which is `not_judged`. A genuinely zero column still passes. A caller who wants the old default names it: `check(["tolerance", "grid", "sensitivity"])`. + +- **`check()`'s `ok` was True on a run no other engine checked, and its `next` said only "No check moved the answer past its bound" (issue #2009).** A `.net` run's `check("all")` was ok with `second_engine` `unsupported`, so a caller reading `ok` could report a run "checked against libRoadRunner" that it never saw. An ok report's `next` now names each check that did not run and why, and says whether another simulator was involved; `independent` says the same for a program. `check(require=[...])` and `bngsim check --require` name the checks a report must pass to be ok: they run whether or not `checks` names them, one that did not pass makes the report not ok (exit 6), and `next` says why and what would make it run. A check now meets `budget=` at its first rerun: one that the record or the build shows cannot apply is `skip` or `unsupported`, not `timeout`, and one whose reruns another check made gives its verdict from them. `required` and `required_not_passed` are new keys; `check_version` stays 2. + +- **The `bngsim` command takes a BioModels id wherever it takes MODEL ([#1971](https://github.com/lanl/bngsim/issues/1971)).** `bngsim run BIOMD0000000010 --t-end 100` and the same for `inspect`, `check`, `run-until`, `run-batch`, `parameter-scan` and the steady-state commands load the entry as `Model.from_biomodels` does, fetched once and then cached; `--biomodels-version N` and `--biomodels-refresh` are its `version=` and `refresh=`. Before, each refused the id with advice for Python under the generic `model.error`. The JSON's `model` is the id, and the `steady-state` payloads gain `source`. A fetch that fails is `model.fetch_failed`, with the id, host, reason, cache directory and cached versions in its details; a missing entry or version is `model.biomodels_not_found`, and an entry whose main file is not SBML `model.biomodels_not_sbml`; and `Model.load` of an id is `model.biomodels_id`, with `Model.from_biomodels` as its remedy. A failed `refresh=True` now says a copy is cached where one is, in place of "No copy of it is cached". + +- **Forward sensitivities and other compiled code run on a machine with no C compiler (issue #1852).** The published wheels now carry the MIR JIT, and codegen falls back to it where no C toolchain can build: none on `PATH` (a container, a compute node, stock Windows) or one that builds nothing (`/usr/bin/cc` on a Mac without the Command Line Tools). Such a run raised `CodegenToolchainError` (#1690); it now gives the same results from somewhat slower code, and the toolchain is reported at INFO, not as a warning. `cc` is still used where it builds, and a library it built earlier is used from the cache. `BNGSIM_CODEGEN_JIT=cc` restores the error. `bngsim doctor` and `Model.describe()` say when MIR builds instead. + +- **The vendored MIR JIT moves to upstream `dc2c763` (issue #1490).** Upstream's 45 commits (25 not merges) since our pin `439a90a2` include aarch64 and x86-64 code-generation fixes: an aarch64 addressing check that used the log2 of an access size where the encoder uses the size, a false dependency on x86-64 scalar SSE converts, an address folded into an insn the target cannot encode, and plain `char` on Linux aarch64. All five local carries are re-applied unchanged, and the #1216 one (the x86-64 loop-padding NOPs that Rosetta 2 refused) is still needed. mir.yml gains a Linux aarch64 leg. This only affects builds with MIR on (`-DBNGSIM_ENABLE_MIR=ON`). + +- **The vendored MIR JIT moves to upstream `b1360f38`.** Upstream merged three fixes bngsim carried, so those local carries go: the x86-64 loop-padding NOPs that Rosetta 2 refused (#1216), c2mir's allocations, now all through the allocator `MirJit` hands it (#1215), and the aarch64 link register in leaf functions (#1575). Two carries remain: `mir.c`'s accessor for the default code allocator (#1215) and the aarch64 branches past a megabyte (#1575). The move also brings two fixes to MIR's -O2 optimizer, for a load reused past a store that may alias it and for an address whose variable a narrower store reaches. The C bngsim generates reaches neither: its machine code is unchanged. This only affects builds with MIR on, which the wheels are from #1852. + +### Removed + +- **`scripts/local_ci_linux_docker.sh` and its manual pre-commit hook `local-ci-linux` are removed (issue #1492).** The script still assumed the old monorepo layout: outside a checkout named `bngsim` it failed or built another checkout, and from `~/Code/bngsim` it copied the whole parent directory into the container. Its pinned cibuildwheel was two major versions behind CI and could not build the cp314 and cp315 wheels. CI's `wheels.yml` builds and tests the manylinux wheels on every pull request; `scripts/local_ci.py` remains the local wheel check. + +### Fixed + +- **A species set by `set_concentration` (or `set_state`) took back its initial condition once a `set_param` moved that condition onto the value set (issue #2120).** With `B = 2*k0` in the file (3 at k0 = 1.5), `set_concentration("B", 4)` then `set_param("k0", 2)` left B at 4, as it should, but read it as its condition from then on: forward sensitivities gave dB/dk0 = 2 at the start (1.558 at t = 5) where a central difference over the same calls gives 0, a steady state's dA_ss/dA0 was 1/3 where it is 0, and the next `set_param("k0", 2.5)` re-dosed B to 5 over the caller's 4, with no word. The same held for a compartment size that moves an amount-declared species' start onto the value set. Each species now keeps the mark of the assignment that took it off its condition until `reset()`, `save_concentrations()`, or an assignment that changes it again; parameter scans, batches' warnings, snapshots, replicates, reruns, clones and the `.net`, BNGL and SBML writers keep it too. A species set to exactly the value its condition gives still follows the condition, as before, and the record's `concentrations_set` lists it only once saved. + +- **Where no seeds are handed to the core (sympy unavailable), a forward-sensitivity run from a baseline `save_concentrations()` saved seeded each species whose declared start names a parameter from that parameter.** With `A() A0` and A set to 4 and saved, dA/dA0 was 1 at the start where a central difference gives 0: no parameter reaches a saved baseline. The steady-state seeding and the Python path already said so; the time course's own loop, and `Model.effective_ic_sensitivity()` on that path, now do too. The same loop seeded 1 for a species declared in amounts, whose stored start is the parameter over its compartment's size (0.5 at size 2); it now divides, as the steady-state loop does. + +- **An SBML `piecewise` with no `otherwise` is undefined where none of its pieces holds, not 0 (issue #2114).** SBML leaves its value undefined there, and bngsim read 0, so a rate law or a rule switched off without a word: `piecewise(2, time < 5)` as a rate gave A(10) = 10, where libRoadRunner stops at t = 5. The value is now NaN, held by an internal parameter, `_piecewise_undefined`, and a load warns naming each element with such a piecewise. A run that reaches such a time or state fails there, and a value that only reports reads NaN. Conditions that are complements as written (`x < a`, `x >= a`) read as before, with no warning, and the analytical Jacobian is kept. `write_sbml` writes the piecewise with no `otherwise` again; `write_net` and `write_bngl` write the value inside a function as `(0/0)`, which BNG2.pl reads. `write_bngl` writes each function as `name() = expr`: without the `=`, BNG2.pl read `time() >= 5` as `time() > 5`. + +- **On Windows, a MIR context never gave back the memory that held its generated code ([#2106](https://github.com/lanl/bngsim/issues/2106)).** MIR's default code allocator releases a code mapping with `VirtualFree` and the mapping's length, but `VirtualFree` with `MEM_RELEASE` takes a length of 0 only and fails otherwise ([vnmakarov/mir#496](https://github.com/vnmakarov/mir/issues/496)). Every context that `MirJit` finished, and every one it abandoned after a failure, therefore left its code committed for the life of the process, so the committed memory of a Windows process that compiled models with the MIR JIT grew with each one. Only builds with the MIR JIT (`BNGSIM_ENABLE_MIR=ON`) were affected. `MirJit` now releases each code mapping itself on Windows, with a length of 0. Other platforms are unchanged. + +- **A sensitivity build that ran out of its derivation budget was cached, and every later build of the model on that cache got it ([#2101](https://github.com/lanl/bngsim/issues/2101)).** The budgets are wall-clock, so a model near one (Froehlich_CellSystems2018, 19.7 to 20.1 s against 20 s on a cluster node) declined the analytic sensitivity RHS on some runs and not others, and whichever came first was kept under the model's cache key: a decline there kept every later build on CVODES' difference quotient, where an N_p = 100 run did not finish in 1,800 s against 22.8 s analytic. A build that any budget cut (∂f/∂p or the expression output sensitivities) is now cached under its source's hash, so the next process derives again, and only a completed build is kept under the model's key. Loading sympy (about 2 s on a cluster node) is no longer counted against a budget, and it is loaded only where a derivation is about to use it, so a model with nothing for sympy to do loads none, as before. + +- **An action before `generate_network` that read an observable was put back with the network's amounts, where BNG2.pl reads every observable as 0 before the network exists ([#2090](https://github.com/lanl/bngsim/issues/2090)).** `addConcentration("A()","Btot")` with B = 4, saved and then reset to, started the run from A = 5 for BNG2.pl's 1; so did one through a function of an observable (`f() = 2*Btot`: 9) and a `setConcentration` to an expression that read one. `run_protocol` now reads them as 0 where it puts such a save back; an observable read after generation is the network's, as before. The actions block `omex_to_net` writes, and SED-ML, write such an observable as 0, and say they cannot go back to a save that read one through a function. + +- **An SBML reaction with a non-integer stoichiometry listed its divided rate function once per species ([#2077](https://github.com/lanl/bngsim/issues/2077)).** In a compartment whose size is not 1, or can change, such a reaction reads its law divided by each species' compartment, `_vd__`. The loader registered that function once for every species the reaction changes, and every copy was kept, so `Model.function_names`, a result's `expression_names` and `expressions`, and the `.net` that `sbml_to_net` writes each repeated it (37 times for one reaction of BIOMD0000000496). It is now registered once per name, so the species of one compartment share it. The values were right before and are unchanged. + +- **`steady_state(mask=..., criterion="residual")` by integration came back unconverged where its march stalled within tolerance between two checks of the masked inputs ([#2074](https://github.com/lanl/bngsim/issues/2074)).** A march that waits for masked species the kept ones read checks those inputs by a Newton step only at the 1st, 2nd, 4th, ... step at which the kept species pass and the inputs do not, and one called stalled (or ended by the integrator) between two such steps was not checked where it stopped. With the inputs at rest and a kept species coming within its tolerance at the 1,385th such step, a march stalled at the 2,005th came back unconverged, 2e-9 (relative) from its steady state. It is now checked where it stops, as the default criterion's march is. The schedule of the checks is unchanged. + +- **A masked `steady_state` solve under the default criterion that ran out of `max_time` returned the state of its first steps, not the state it reached (issue #2042).** With `0 -> M`, `M -> 0`, `M -> M + X`, `X -> 0` and only X kept, `max_time=3` came back unconverged after 80 steps at M = 2.5e-10, X = 6.5e-20, where the model is at M = 0.950, X = 1.207: X had passed the residual test at the first step, while M, which X reads, was still moving. The state the kept species passed at is now returned only where the criterion takes it (converged, as before), where the masked species they read are at rest there too, or where the march ended on a failed step or a state that is no number; otherwise the solve returns where it stopped, as it does with no mask and as `method="newton"` did. On BioModels, four masked solves that came back unconverged now converge, since the polish starts from the state reached. + +- **A steady-state `mask=` that kept an SBML assignment-rule species tested nothing for it, and could return a state far from rest as converged (issue #2034).** A rule target's slot never moves, so with `M' = k0 - k1 M`, `Z := 2 M` and only Z kept, `steady_state` came back converged after one step at Z = 3e-11 for 2; with Z and a fast W kept, at Z = 0.0705, the moment W came to rest. A kept rule target now keeps the species its rule reads in its place (through observables, functions, table-function indexes and `rateOf`, and through a rule that reads another rule target), so keeping Z is the solve that keeps M, in `steady_state`, `steady_state_batch` and `steady_states`. A kept total that stays constant while the species it sums move is therefore at rest only once they are; a pure sink a rule reads is not added, so `mask=~model.is_pure_sink()` is the solve it was. The core reports what each function reads as `function_species_reads`. + +- **A stop condition now ends the run where it holds; it was asked only after the run had gone to its end.** `A' = A²` from A = 1 passes 10 at t = 0.9 and blows up at t = 1: with `add_stop_condition("Atot > 10")` over (0, 2) the run raised `SimulationError`, and now returns `StopConditionMet` at t = 0.9. An ODE, SSA or PSA run asks an expression condition at each sample and ends at the first it holds at; an ODE run ends where a comparison or a number starts to hold, at the crossing. The model is left at the stop, with `current_time` its time. An SSA run of A → 2A to `Atot > 1e4` over (0, 30) ran to its timeout, and ends at t ≈ 7. Where several hold at one sample, the first added names it. Callables, conditions on species reported after the run, network-free runs and `.net` models whose rate law switches on its state are still asked after the run. A condition that never holds gives the same run, bit for bit, unless it meets its threshold where an event fires: the event, or the stop, can then move within the root tolerance. A comparison only rounding decides (a total against its own value) can now stop a run main ran whole; compare with a margin. + +- **A BNG2.pl that failed loaded as a different model ([#2016](https://github.com/lanl/bngsim/issues/2016) review).** BNGsim never read BNG2.pl's exit status, so a network it left behind loaded, ran with exit 0, and was cached for every later load: one cut short at a line break, a `print_iter` snapshot (42 of 258 species), or one a read file's own `generate_network` wrote before its `simulate` failed, missing the `setParameter` after it. Loading now refuses any network from a BNG2.pl that failed, saying what BNG2.pl said, and caches nothing; the cache's key changed, so the networks it held are made again once. `validate="bng2"` takes one only where BNG2.pl said it finished writing it, and runs BNG2.pl through `perl`, as loading does. After a BNG2.pl that finished, the network is the last one it says it wrote (its name read back as perl printed it, encoded under `PERL_UNICODE` or `-C` too; where no reading of it is a file, found as before, if BNG2.pl wrote only that one): a read file's own `generate_network` no longer stands for a later one with a `suffix` or `prefix` (main loaded k = 1 for a file that sets k = 5), and a finished `print_iter` run with a `suffix` loads. + +- **`bngsim run --out .npz` failed after the run ([#2016](https://github.com/lanl/bngsim/issues/2016) review).** A name that is only the suffix has none as `Result.save` reads it, so the run was written as HDF5, or failed after the run without h5py. It is refused before the run now, for the commands that write a Result; `.csv`, `.h5` and the steady-state commands' `.npz` are taken as before. A run's own timeout now names the command's `--timeout` in its remedy, not the keyword `timeout`. + +- **A `.bngl` network a `prefix=>` put outside the loader's folder could be another load's ([#2016](https://github.com/lanl/bngsim/issues/2016) review).** With `prefix=>"../x"`, BNG2.pl wrote the network beside the loader's work folder, in the temporary folder every load shares, where a load running at the same time could replace it before it was read, and left it there. It is now written inside the work folder and removed with it; a network an absolute `prefix=>` puts elsewhere is refused, since another load may write the same file. + +- **`run(t_span=(0, 10), sample_times=[5, 10])` dropped the `t_span` and integrated from 5, so the row labeled t = 5 held A(0) (issue #2012).** Given both, the run now integrates over `t_span` and reports at `sample_times`, as SciPy's `t_span` and `t_eval` do; a sample time outside `t_span` is a `UsageError`. `sample_times` alone behaves as before. `NfsimSession.simulate` and `RuleMonkeySession.simulate` take `t_start` and `t_end` beside `sample_times` the same way, `Result.rerun(sample_times=...)` keeps the run's start (an earlier sample time needs `t_span=` too), and `bngsim run` and `bngsim check` accept `--t-start` and `--t-end` with `--sample-times`. The `t_eval` error's suggested call is now right. + +- **A `folded_at_load=` comment written by hand in a `.bngl` could freeze the wrong parameter, or none.** `Model.from_bngl` read each line of the parameters block as one declaration, and the first blank-separated word as its name. BNG2.pl joins a line that ends in `\` with the next, so `f \` then `k # folded_at_load=...` declares `f = k`: the comment froze `k`, which the file says nothing about, and `f` took `set_param`. With a number on the second line, nothing was frozen. BNG2.pl also takes the name as the identifier a declaration starts with, so `f(2.0)`, `f(k+1)` and `f-2.0` declare `f`, and on those the comment froze nothing. A comment in a block opened `beginparameters`, which BNG2.pl reads as `begin parameters`, was not read at all. The comment is now read off the declaration BNG2.pl reads, and freezes the parameter it declares. A `.net`, which bngsim's loader reads one line to a declaration, and every file `sbml_to_net` and `sbml_to_bngl` write, are read as before. + +- **`sbml_to_net` and `sbml_to_bngl` wrote a compartment size the SBML model refuses to change as a free parameter.** A size in `Model.unwritable_compartment_size_params` (one an initialAssignment folds into another compartment's size, for one) is not in `Model.frozen_params`, so the converters' handling of frozen parameters passed it over: the model loaded from the written file took `set_param` on it, which could move a rate law that names the size and not what the size was folded into, held there as a number. In the issue's model `set_param("c1", 3)` gave A(2) = 0.0498 where the SBML model at that size gives 0.1353. Such a size is now written as a frozen parameter is: left out where nothing in the file reads it, so that a write to it is refused as a name the model has not, and marked `folded_at_load=` where something does, so that the model loaded from the file lists it in `frozen_params` and refuses the write. The conversion report names each in `folded_left_out` or `folded_marked`. + +- **A network-free run or session rounded a seed amount that was not a whole number without a word, where NFsim and RuleMonkey run on their own truncate it (issue #1954).** `B() 19.703` starts at 20 in `NfsimSession`, `RuleMonkeySession`, `method="nf"` and `method="rm"`, as in `run_network`, and at 19 in NFsim and `rm_driver`, so a comparison with either engine's own program started one molecule apart (Posner 2004: 1807 ligands for 1806) and nothing said so. Each of the four now gives a `SsaRoundingWarning` when it rounds a seed amount: it names the first species, its amount and count, and, for an amount the XML or a parameter gives, what the engine alone would start it at. A `Simulator` run also records it on `result.notices` (`network_free.rounded_seeds`). The counts themselves are unchanged. `docs/user-guide/network-free.md` says that the engines truncate the same XML. + +- **A stack of PSA runs reported `time = 0.0` and both event integrals `0.0` beside `active = True`, and `psa_cost_decision` failed on every ensemble (issue #1953).** `run_replicates(..., squeeze=True)` (and `Result.squeeze` over PSA runs) built the stack's `psa_diagnostics` from the report of a run that used no partial scaling, so the stack read as a run that took no time and fired nothing, and its NaN `speedup` made `psa_cost_decision` raise "speedup must be > 0, got nan". A stack of replicates now reports the sum of each event integral over its runs, their ratio as `speedup` (the ensemble's event-rate ratio), and the `time` of each run. A stack whose rows are not replicates of one run (a scan, a batch, rows of different methods, a repeated seed) has no one ratio: its integrals and `speedup` are NaN, and `psa_cost_decision`'s error for a NaN names `psa_diagnostics_per_run`. A stacked result saved by an earlier release loads with the same report. + +- **A forward sensitivity through one of ExprTk's implicit products was exact zeros, with no warning, and a plain run stepped over a pulse centred on one (issue #1937).** The engine reads `2j`, `2 j`, `(1+1)j`, `(j)2` and `j(2)` as `2*j`. The Python readers scanned the text for the word `j`, found none, and took the expression to name no parameter: with `A0 = 2j`, dA/dj came back [0, 0, 0] for 2·e^(-t/2); a rate law `k*2j` failed its build on Python's imaginary `I`; and `1000*exp(-((time() - c)/0.0005)^2)` with `c = 2j` gave A(10) = 0 for 0.886. The products are now written out, by the pass the C emitter already uses, before a derived parameter's expression is scanned or parsed (seeds, the chain rule, the kink check, pulse stops), and a rate law's lexer-level ones before its parse. A law with ExprTk's square or curly brackets (`j[2]`), or with a name against a bracket beside another product (`0.5Atot(2)`), declines as before. Also: a reserved word in another case is a name, as it is to the engine (`2In` was zeros too), and a derived parameter that is a logical operation (`j and k`) has a zero column, not 1. + +- **SED-ML, the SBML a change reads, an OMEX manifest and a fetched BioModels file in an encoding other than UTF-8 are read as XML says, not refused (issue #1881).** XML names its own encoding: a byte-order mark, else (UTF-16 or UTF-32 with no mark) its first bytes, else the XML declaration, else UTF-8. `read_sedml_protocol` decoded a SED-ML file and the SBML beside it as strict UTF-8, as `read_omex` did its manifest and a rebuild did a BioModels model from its record, so a file in ISO-8859-1 or UTF-16 (valid XML) raised a bare `UnicodeDecodeError`; a fetched SED-ML file in Shift_JIS, or a model in UTF-16, was refused as not SED-ML or not SBML. Each now decodes through one decoder, and a string handed to `from_sbml_string` or stored by `write_omex` has its declaration named UTF-8, so libSBML reads its characters. The BioModels fetch read UTF-8 before the declaration; it now reads the declaration, as libSBML does. Bytes that do not decode as declared, a mark or first bytes the declaration contradicts, a wide encoding declared on 8-bit bytes, or a codec that rewrites text (`unicode_escape`, `utf-7`, `hz`) raise an error saying which (a `ModelError` for a model). + +- **A `.net` value that was a parameter's name alone was read as a number where the name is `inf`, `nan` or `Infinity` (issue #1856).** BNG2.pl accepts a parameter of such a name and writes `k2 inf`, or `2 B() inf`, for a parameter or a seed species set to it. `Model.from_net`, and `Model.from_bngl` through BNG2.pl's `.net`, tried the text as a number first, and `strtod` reads those words, in any case, as infinity or NaN: with `inf 5`, k2 and B(0) were infinite where BNG2.pl holds 5, and `k4 1/k2` was 0 with nothing said, so `A() -> B() k4` from A = 100 gave B(1) = 0 for BNG2.pl's 23.1269. Both sites now read a value that is a declared parameter's name as that parameter, wherever in the block it is declared. The same holds under a sign (`k2 -inf`), in an action (`setParameter("k2","inf")` set infinity under `run_bngl`), and in `net_to_omex(..., bngl=)`, which refused BNG2.pl's own network for `k2 nan`. The word beside no parameter of that name (and in another case than the parameter's) is the number it was. + +- **`Model.set_concentration` and `get_concentration` took only a species name exactly as the network writes it, where BNG2.pl's `setConcentration` finds the species ([#1833](https://github.com/lanl/bngsim/issues/1833), and the first case of [#1480](https://github.com/lanl/bngsim/issues/1480)).** BNG2.pl reads the name as one complete species and sets the one that is the same graph. `"A(y,x)"` for `A(x,y)`, a complex with its molecules in another order or other bond labels, `"@c:A()"` or `"A()@c"` for `@c::A()`, and a bare `"C"` for a molecule with no components raised `ModelError`, so a caller replaying a model's actions through the two methods could not run the model. Both methods now find that species, after the exact name. A name BNG2.pl aborts on (a component or state left out, a wildcard, an observable's name, a compartment before the name that the molecules' own contradict) is refused as before, but for a space inside or after a name and a `$` before its compartment; an SBML model's species are found only by id. The action replay uses the same lookup, so a complex written another way is set, and no longer counts as a dropped change. + +- **The `simulate` actions `sbml_to_bngl` writes for a model's fixed-time events named no tolerances, so BNG2.pl ran them at its own `atol = 1e-8`, above the species of a model in molar units (issue #1830).** BIOMD0000000571, converted with `ok=True` and nothing listed as lost, ran under BNG2.pl with 57 of its 76 species over 1e-4 of their peak off the SBML, the worst at 2.6 times its peak. Each phase now names `rtol=>1e-08` and an `atol` taken from the model's scale: `rtol` times the smallest value a species a reaction or a rate rule changes starts from or an event sets it to, but not under 1e-6 of the largest, and never above `1e-08` (where those all start at 0, the `$`-fixed species' values). With them BNG2.pl runs that model with no species over 1e-4 off (worst 3.2e-5). A model of counts gets `atol=>1e-08`, what BNG2.pl ran it at before. `sbml_to_net`'s note for the events it drops now names `sbml_to_bngl`, where it said to emit a SED-ML sidecar. An event-free model still gets no actions block, and `sbml_to_bngl` still takes no `sedml=`. + +- **A `saveConcentrations` before `generate_network` was put back with the parameters as they stood at generation, not as they stood when it was made ([#1829](https://github.com/lanl/bngsim/issues/1829)).** An `addConcentration` makes its species a number from the parameters of its moment, so one whose value reads a parameter a later `setParameter` (still before generation) moved gave another amount after a reset than BNG2.pl does, with no error: `setParameter("q",2)`, `addConcentration("A()","q")` on A = 1, a save, then `setParameter("q",9)`: A = 10 where BNG2.pl gives 3. `run_protocol` and the actions block `omex_to_net` writes now put such an add back with the parameters of its moment set before it and the network's restored after, following a parameter read through another's expression (`r 3*q`). Where the value of its moment is the one declared, which the network does not hold, the reset is refused, as for another save the network does not hold; SED-ML, whose changes to a model are made at once, says it cannot go back to that save. + +- **A rate law with a `%` between two numbers gave a wrong forward-sensitivity column, with no error (issue #1815).** The engine's `%` is `fmod`, whose sign follows its first argument: `-2.5 % 2` is -0.5. The parse that builds the sensitivity right-hand side and the analytic Jacobian handed `%` to sympy as written, which read it as a floored `Mod` and folded it to 1.5, so `k*((-2.5 % 2)+1)` was differentiated as `2.5*k`: the run was right, and dA(1)/dk came back -151.63 for -30.33. `%` is now read there as the engine's `mod`: two numbers fold as `fmod`, in the operator and in the `mod()` call alike, and sympy no longer rewrites `(p + 2) % 2` to `Mod(p, 2)`, which `fmod` is not for a negative `p`. A pulse centred on `mod(7, 3) + 3`, or on a derived `(b % 3) + 5` at b = -7, is no longer stepped over (A(10) = 0 for 0.886). + +- **`sbml_to_net` and `sbml_to_bngl` wrote a parameter that was folded into a number when the SBML loaded (`Model.frozen_params`) as a free one ([#1792](https://github.com/lanl/bngsim/issues/1792)).** The model loaded from the file took `set_param` on it, where the SBML model refuses: with no effect where nothing else read the parameter (BIOMD0000000040's `f`, a stoichiometry: Br(5) stayed 0.026263 for 0.0394), and with half an effect where a rate law still did. A frozen parameter that nothing in the written network reads is now left out, with a `dropped` note, so `set_param` on it fails in bngsim, and a `setParameter` in BNG2.pl. One that is still read is written with a `folded_at_load=` comment on its line, which `Model.from_net` and `Model.from_bngl` read back into `frozen_params`, so the reloaded model refuses the write too; these are listed under `bngsim_only`, since another reader of the file takes each as free. A parameter that actions written beside the file read stays in it, marked. The report names both kinds in `folded_left_out` and `folded_marked`, and `omex_to_net` notes an action that sets or scans either. Networks without such a parameter are written as before. + +- **`Model.from_bngl` could not load a model whose functions block reads a table file, `tfun("file.tfun", ...)`, under BioNetGen 2.9.5 (issue #1674).** BNG2.pl reads the file from the model's directory, where it runs, and writes its name into the `.net` as given; bngsim loaded the network from its cache (or `net_out=`) and looked for the file there: "cannot open file". The file is now read from the model's directory, and two copies of one model, which share a cached network, each read their own; a table kept only beside `net_out=` is not. `Model.from_net` takes `table_dir=`, which a rerun keeps. Tables BioNetGen 2.9.5 writes wrongly are refused: two rules' tables run as one, a table put where the model's `0.0` was, two tables in one expression, a table in the parameters block. A `.net` table index of more than one name, `time + 1`, ran as its first name and is refused. The guide says `tfun()` in BNGL needs BioNetGen 2.9.5, the latest release; 2.9.3, which PyBioNetGen bundles, aborts on it, and the error now says so. + +- **`steady_state(mask=...)` returned a state as converged while a species the mask left out, which a kept one reads, was still moving ([#1526](https://github.com/lanl/bngsim/issues/1526)).** With `0 -> M`, `M -> 0`, `M -> M + X`, `X -> 0` and only `X` kept, `method="newton"` under `criterion="residual"` returned X = 0, converged and `'stable'`, for a steady state of 2; the batch call did the same for every dose; integration under `"residual"` with `atol=1e-12` stopped at its first step; and BIOMD0000000341 with G left out came back (249.994, 0, 0) by Newton under the default criterion, for (100, 10, 300). A Newton root, the start, and a stop under `"residual"` are now taken only where every masked species a kept one reads, directly or through others, is at rest too (`$`-fixed ones aside), by the Newton step from the state where it can be had; the user guide gives the measure in full. Under the default criterion the run test decides as before. Under `"residual"`, a kept species at rest beside a masked input that never settles is no longer converged. `steady_states()` and `steady_state_batch(newton_burst=False)`, which hold masked species by documentation, are unchanged. + +- **An SBML id spelled like a name the loader makes up shared that name's value, silently ([#1520](https://github.com/lanl/bngsim/issues/1520)).** The loader holds a local parameter as `_lp__`, a reserved id as `_ant_`, a rate rule as `_rhs_`, and so on. A species `_lp_R_k` with a rule made reaction `R`'s `k` read the rule (`[S](2)` = 0.0074 for 2.456), other such ids were refused, and two made names could meet from ordinary ids (reaction `R` with local `f_k` beside `R_f` with local `k`; reaction `a_b` in compartment `c` beside `a` in `b_c`). Every made name is now checked against the file's ids and the names already made, and a taken one gets `_1`, `_2`, ..., as `_V0_` and `_rateLaw_` names did. No id of the file changes, and a model none of whose names meet is named as before. `Model.describe()`, the SBML event translation, `read_sedml`, `read_sedml_protocol(sbml=...)` and the AMICI check read the name the load gave. + +- **`bngsim run` and `bngsim check` with a species `--set` and `--sensitivity-params` gave 0 for every species' initial sensitivity.** `--set` made the start the model's saved initial state, a list of numbers, so a species whose start the file computes from a parameter lost that dependence: with `D = 2*k0`, `--set B=5 --sensitivity-params k0` gave dD/dk0 = 0 at every time, where it is 2 at the start (1.558 at t = 5 in the test model). A species `--set` is now the run's start as `Model.set_concentration` leaves it, so the record of these two commands says `started_from: "live"`, with the species in `concentrations_set`, where it said `"initial"`. `parameter-scan` never saved it; the other commands still do. + +- **`Model.effective_ic_sensitivity` listed another species' initial-value carrier in a species' row.** Where a species' initial assignment reads a species whose own initial assignment the SBML loader lowers to a carrier (`_ic_B`, issue #147), the reading species' row held that carrier beside the original symbols, though the row already had their whole effect: with B(0) = a·b and A(0) = 2·B·a, A's row was `{a: 12, b: 4.5, _ic_B: 3}`. A species whose id is a word the evaluator reserves (`log`, held as `_ant_log`) listed its own carrier the same way. A row now leaves out every carrier. + +- **An SBML reaction whose kineticLaw has no math, or an empty ``, failed to load with a bare ExprTk error, or loaded.** With no math, a reaction that moved a species reached the build with a rate named after the reaction that nothing defined, and failed with "Undefined symbol: 'R3'" (`model.error`), and one that moved none loaded; with ``, either failed with "unsupported AST node type". Such a law defines no rate, so all are now refused as a reaction with no kineticLaw is: `model.unsupported_construct`, with `details["constructs"]` holding `{"construct": "reaction with a kineticLaw with no math", "where": "reaction:"}`, and a message naming the reaction. A model that loaded with such a reaction, one that moved no species, is now refused. Both refusals now come before the initialAssignments are evaluated, so one that reads such a reaction's rate (`x = R3 + 1`, or `rateOf` of a species it makes) no longer fails first with "cannot be evaluated at load", naming no reaction. Since they run first, a model with another problem too (a parameter with no value, a conversionFactor that names nothing) now gets this refusal first. A reaction with math loads as before. + +- **SBML math holding an empty ``, or a `` with no pieces, was read as 0.** A rule `y := k + ` ran with y = k, and a rate law that was `` or `` ran at rate 0, with no error, where the file gives no value. Both are now refused as `model.unsupported_construct`; such a rate law is refused as a kineticLaw with no math is, naming the reaction. A `piecewise` whose pieces all fail and that has no `otherwise` is still 0 there ([#2114](https://github.com/lanl/bngsim/issues/2114)). A Level 1 rate formula libSBML cannot parse (`formula="k *"`) is now named as such in the refusal. + ## [0.18.0] - 2026-11-27 ### Added diff --git a/changelog.d/+cli-set-species-sensitivities.fixed.md b/changelog.d/+cli-set-species-sensitivities.fixed.md deleted file mode 100644 index df719dd39..000000000 --- a/changelog.d/+cli-set-species-sensitivities.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **`bngsim run` and `bngsim check` with a species `--set` and `--sensitivity-params` gave 0 for every species' initial sensitivity.** `--set` made the start the model's saved initial state, a list of numbers, so a species whose start the file computes from a parameter lost that dependence: with `D = 2*k0`, `--set B=5 --sensitivity-params k0` gave dD/dk0 = 0 at every time, where it is 2 at the start (1.558 at t = 5 in the test model). A species `--set` is now the run's start as `Model.set_concentration` leaves it, so the record of these two commands says `started_from: "live"`, with the species in `concentrations_set`, where it said `"initial"`. `parameter-scan` never saved it; the other commands still do. diff --git a/changelog.d/+ic-sensitivity-another-carrier.fixed.md b/changelog.d/+ic-sensitivity-another-carrier.fixed.md deleted file mode 100644 index f9b97ee8a..000000000 --- a/changelog.d/+ic-sensitivity-another-carrier.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **`Model.effective_ic_sensitivity` listed another species' initial-value carrier in a species' row.** Where a species' initial assignment reads a species whose own initial assignment the SBML loader lowers to a carrier (`_ic_B`, issue #147), the reading species' row held that carrier beside the original symbols, though the row already had their whole effect: with B(0) = a·b and A(0) = 2·B·a, A's row was `{a: 12, b: 4.5, _ic_B: 3}`. A species whose id is a word the evaluator reserves (`log`, held as `_ant_log`) listed its own carrier the same way. A row now leaves out every carrier. diff --git a/changelog.d/+kinetic-law-without-math.fixed.md b/changelog.d/+kinetic-law-without-math.fixed.md deleted file mode 100644 index 9e9a128cd..000000000 --- a/changelog.d/+kinetic-law-without-math.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **An SBML reaction whose kineticLaw has no math, or an empty ``, failed to load with a bare ExprTk error, or loaded.** With no math, a reaction that moved a species reached the build with a rate named after the reaction that nothing defined, and failed with "Undefined symbol: 'R3'" (`model.error`), and one that moved none loaded; with ``, either failed with "unsupported AST node type". Such a law defines no rate, so all are now refused as a reaction with no kineticLaw is: `model.unsupported_construct`, with `details["constructs"]` holding `{"construct": "reaction with a kineticLaw with no math", "where": "reaction:"}`, and a message naming the reaction. A model that loaded with such a reaction, one that moved no species, is now refused. Both refusals now come before the initialAssignments are evaluated, so one that reads such a reaction's rate (`x = R3 + 1`, or `rateOf` of a species it makes) no longer fails first with "cannot be evaluated at load", naming no reaction. Since they run first, a model with another problem too (a parameter with no value, a conversionFactor that names nothing) now gets this refusal first. A reaction with math loads as before. diff --git a/changelog.d/+mir-b1360f38.changed.md b/changelog.d/+mir-b1360f38.changed.md deleted file mode 100644 index f56add255..000000000 --- a/changelog.d/+mir-b1360f38.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **The vendored MIR JIT moves to upstream `b1360f38`.** Upstream merged three fixes bngsim carried, so those local carries go: the x86-64 loop-padding NOPs that Rosetta 2 refused (#1216), c2mir's allocations, now all through the allocator `MirJit` hands it (#1215), and the aarch64 link register in leaf functions (#1575). Two carries remain: `mir.c`'s accessor for the default code allocator (#1215) and the aarch64 branches past a megabyte (#1575). The move also brings two fixes to MIR's -O2 optimizer, for a load reused past a store that may alias it and for an address whose variable a narrower store reaches. The C bngsim generates reaches neither: its machine code is unchanged. This only affects builds with MIR on, which the wheels are from #1852. diff --git a/changelog.d/+sbml-math-that-names-nothing.fixed.md b/changelog.d/+sbml-math-that-names-nothing.fixed.md deleted file mode 100644 index 35b11ba20..000000000 --- a/changelog.d/+sbml-math-that-names-nothing.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **SBML math holding an empty ``, or a `` with no pieces, was read as 0.** A rule `y := k + ` ran with y = k, and a rate law that was `` or `` ran at rate 0, with no error, where the file gives no value. Both are now refused as `model.unsupported_construct`; such a rate law is refused as a kineticLaw with no math is, naming the reaction. A `piecewise` whose pieces all fail and that has no `otherwise` is still 0 there ([#2114](https://github.com/lanl/bngsim/issues/2114)). A Level 1 rate formula libSBML cannot parse (`formula="k *"`) is now named as such in the refusal. diff --git a/changelog.d/1490.changed.md b/changelog.d/1490.changed.md deleted file mode 100644 index 6df737ce0..000000000 --- a/changelog.d/1490.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **The vendored MIR JIT moves to upstream `dc2c763` (issue #1490).** Upstream's 45 commits (25 not merges) since our pin `439a90a2` include aarch64 and x86-64 code-generation fixes: an aarch64 addressing check that used the log2 of an access size where the encoder uses the size, a false dependency on x86-64 scalar SSE converts, an address folded into an insn the target cannot encode, and plain `char` on Linux aarch64. All five local carries are re-applied unchanged, and the #1216 one (the x86-64 loop-padding NOPs that Rosetta 2 refused) is still needed. mir.yml gains a Linux aarch64 leg. This only affects builds with MIR on (`-DBNGSIM_ENABLE_MIR=ON`). diff --git a/changelog.d/1492.removed.md b/changelog.d/1492.removed.md deleted file mode 100644 index 8b385c5be..000000000 --- a/changelog.d/1492.removed.md +++ /dev/null @@ -1 +0,0 @@ -- **`scripts/local_ci_linux_docker.sh` and its manual pre-commit hook `local-ci-linux` are removed (issue #1492).** The script still assumed the old monorepo layout: outside a checkout named `bngsim` it failed or built another checkout, and from `~/Code/bngsim` it copied the whole parent directory into the container. Its pinned cibuildwheel was two major versions behind CI and could not build the cp314 and cp315 wheels. CI's `wheels.yml` builds and tests the manylinux wheels on every pull request; `scripts/local_ci.py` remains the local wheel check. diff --git a/changelog.d/1520.fixed.md b/changelog.d/1520.fixed.md deleted file mode 100644 index 74274dbb9..000000000 --- a/changelog.d/1520.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **An SBML id spelled like a name the loader makes up shared that name's value, silently ([#1520](https://github.com/lanl/bngsim/issues/1520)).** The loader holds a local parameter as `_lp__`, a reserved id as `_ant_`, a rate rule as `_rhs_`, and so on. A species `_lp_R_k` with a rule made reaction `R`'s `k` read the rule (`[S](2)` = 0.0074 for 2.456), other such ids were refused, and two made names could meet from ordinary ids (reaction `R` with local `f_k` beside `R_f` with local `k`; reaction `a_b` in compartment `c` beside `a` in `b_c`). Every made name is now checked against the file's ids and the names already made, and a taken one gets `_1`, `_2`, ..., as `_V0_` and `_rateLaw_` names did. No id of the file changes, and a model none of whose names meet is named as before. `Model.describe()`, the SBML event translation, `read_sedml`, `read_sedml_protocol(sbml=...)` and the AMICI check read the name the load gave. diff --git a/changelog.d/1526.fixed.md b/changelog.d/1526.fixed.md deleted file mode 100644 index 8161d6f17..000000000 --- a/changelog.d/1526.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **`steady_state(mask=...)` returned a state as converged while a species the mask left out, which a kept one reads, was still moving ([#1526](https://github.com/lanl/bngsim/issues/1526)).** With `0 -> M`, `M -> 0`, `M -> M + X`, `X -> 0` and only `X` kept, `method="newton"` under `criterion="residual"` returned X = 0, converged and `'stable'`, for a steady state of 2; the batch call did the same for every dose; integration under `"residual"` with `atol=1e-12` stopped at its first step; and BIOMD0000000341 with G left out came back (249.994, 0, 0) by Newton under the default criterion, for (100, 10, 300). A Newton root, the start, and a stop under `"residual"` are now taken only where every masked species a kept one reads, directly or through others, is at rest too (`$`-fixed ones aside), by the Newton step from the state where it can be had; the user guide gives the measure in full. Under the default criterion the run test decides as before. Under `"residual"`, a kept species at rest beside a masked input that never settles is no longer converged. `steady_states()` and `steady_state_batch(newton_burst=False)`, which hold masked species by documentation, are unchanged. diff --git a/changelog.d/1674.fixed.md b/changelog.d/1674.fixed.md deleted file mode 100644 index bb4e2949f..000000000 --- a/changelog.d/1674.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **`Model.from_bngl` could not load a model whose functions block reads a table file, `tfun("file.tfun", ...)`, under BioNetGen 2.9.5 (issue #1674).** BNG2.pl reads the file from the model's directory, where it runs, and writes its name into the `.net` as given; bngsim loaded the network from its cache (or `net_out=`) and looked for the file there: "cannot open file". The file is now read from the model's directory, and two copies of one model, which share a cached network, each read their own; a table kept only beside `net_out=` is not. `Model.from_net` takes `table_dir=`, which a rerun keeps. Tables BioNetGen 2.9.5 writes wrongly are refused: two rules' tables run as one, a table put where the model's `0.0` was, two tables in one expression, a table in the parameters block. A `.net` table index of more than one name, `time + 1`, ran as its first name and is refused. The guide says `tfun()` in BNGL needs BioNetGen 2.9.5, the latest release; 2.9.3, which PyBioNetGen bundles, aborts on it, and the error now says so. diff --git a/changelog.d/1792.fixed.md b/changelog.d/1792.fixed.md deleted file mode 100644 index 9285ac421..000000000 --- a/changelog.d/1792.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **`sbml_to_net` and `sbml_to_bngl` wrote a parameter that was folded into a number when the SBML loaded (`Model.frozen_params`) as a free one ([#1792](https://github.com/lanl/bngsim/issues/1792)).** The model loaded from the file took `set_param` on it, where the SBML model refuses: with no effect where nothing else read the parameter (BIOMD0000000040's `f`, a stoichiometry: Br(5) stayed 0.026263 for 0.0394), and with half an effect where a rate law still did. A frozen parameter that nothing in the written network reads is now left out, with a `dropped` note, so `set_param` on it fails in bngsim, and a `setParameter` in BNG2.pl. One that is still read is written with a `folded_at_load=` comment on its line, which `Model.from_net` and `Model.from_bngl` read back into `frozen_params`, so the reloaded model refuses the write too; these are listed under `bngsim_only`, since another reader of the file takes each as free. A parameter that actions written beside the file read stays in it, marked. The report names both kinds in `folded_left_out` and `folded_marked`, and `omex_to_net` notes an action that sets or scans either. Networks without such a parameter are written as before. diff --git a/changelog.d/1815.fixed.md b/changelog.d/1815.fixed.md deleted file mode 100644 index d02dcc40f..000000000 --- a/changelog.d/1815.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A rate law with a `%` between two numbers gave a wrong forward-sensitivity column, with no error (issue #1815).** The engine's `%` is `fmod`, whose sign follows its first argument: `-2.5 % 2` is -0.5. The parse that builds the sensitivity right-hand side and the analytic Jacobian handed `%` to sympy as written, which read it as a floored `Mod` and folded it to 1.5, so `k*((-2.5 % 2)+1)` was differentiated as `2.5*k`: the run was right, and dA(1)/dk came back -151.63 for -30.33. `%` is now read there as the engine's `mod`: two numbers fold as `fmod`, in the operator and in the `mod()` call alike, and sympy no longer rewrites `(p + 2) % 2` to `Mod(p, 2)`, which `fmod` is not for a negative `p`. A pulse centred on `mod(7, 3) + 3`, or on a derived `(b % 3) + 5` at b = -7, is no longer stepped over (A(10) = 0 for 0.886). diff --git a/changelog.d/1829.fixed.md b/changelog.d/1829.fixed.md deleted file mode 100644 index 7d71ddc71..000000000 --- a/changelog.d/1829.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A `saveConcentrations` before `generate_network` was put back with the parameters as they stood at generation, not as they stood when it was made ([#1829](https://github.com/lanl/bngsim/issues/1829)).** An `addConcentration` makes its species a number from the parameters of its moment, so one whose value reads a parameter a later `setParameter` (still before generation) moved gave another amount after a reset than BNG2.pl does, with no error: `setParameter("q",2)`, `addConcentration("A()","q")` on A = 1, a save, then `setParameter("q",9)`: A = 10 where BNG2.pl gives 3. `run_protocol` and the actions block `omex_to_net` writes now put such an add back with the parameters of its moment set before it and the network's restored after, following a parameter read through another's expression (`r 3*q`). Where the value of its moment is the one declared, which the network does not hold, the reset is refused, as for another save the network does not hold; SED-ML, whose changes to a model are made at once, says it cannot go back to that save. diff --git a/changelog.d/1830.fixed.md b/changelog.d/1830.fixed.md deleted file mode 100644 index 2c41d0736..000000000 --- a/changelog.d/1830.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **The `simulate` actions `sbml_to_bngl` writes for a model's fixed-time events named no tolerances, so BNG2.pl ran them at its own `atol = 1e-8`, above the species of a model in molar units (issue #1830).** BIOMD0000000571, converted with `ok=True` and nothing listed as lost, ran under BNG2.pl with 57 of its 76 species over 1e-4 of their peak off the SBML, the worst at 2.6 times its peak. Each phase now names `rtol=>1e-08` and an `atol` taken from the model's scale: `rtol` times the smallest value a species a reaction or a rate rule changes starts from or an event sets it to, but not under 1e-6 of the largest, and never above `1e-08` (where those all start at 0, the `$`-fixed species' values). With them BNG2.pl runs that model with no species over 1e-4 off (worst 3.2e-5). A model of counts gets `atol=>1e-08`, what BNG2.pl ran it at before. `sbml_to_net`'s note for the events it drops now names `sbml_to_bngl`, where it said to emit a SED-ML sidecar. An event-free model still gets no actions block, and `sbml_to_bngl` still takes no `sedml=`. diff --git a/changelog.d/1833.fixed.md b/changelog.d/1833.fixed.md deleted file mode 100644 index db5bffff1..000000000 --- a/changelog.d/1833.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **`Model.set_concentration` and `get_concentration` took only a species name exactly as the network writes it, where BNG2.pl's `setConcentration` finds the species ([#1833](https://github.com/lanl/bngsim/issues/1833), and the first case of [#1480](https://github.com/lanl/bngsim/issues/1480)).** BNG2.pl reads the name as one complete species and sets the one that is the same graph. `"A(y,x)"` for `A(x,y)`, a complex with its molecules in another order or other bond labels, `"@c:A()"` or `"A()@c"` for `@c::A()`, and a bare `"C"` for a molecule with no components raised `ModelError`, so a caller replaying a model's actions through the two methods could not run the model. Both methods now find that species, after the exact name. A name BNG2.pl aborts on (a component or state left out, a wildcard, an observable's name, a compartment before the name that the molecules' own contradict) is refused as before, but for a space inside or after a name and a `$` before its compartment; an SBML model's species are found only by id. The action replay uses the same lookup, so a complex written another way is set, and no longer counts as a dropped change. diff --git a/changelog.d/1852.changed.md b/changelog.d/1852.changed.md deleted file mode 100644 index 7642b2797..000000000 --- a/changelog.d/1852.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **Forward sensitivities and other compiled code run on a machine with no C compiler (issue #1852).** The published wheels now carry the MIR JIT, and codegen falls back to it where no C toolchain can build: none on `PATH` (a container, a compute node, stock Windows) or one that builds nothing (`/usr/bin/cc` on a Mac without the Command Line Tools). Such a run raised `CodegenToolchainError` (#1690); it now gives the same results from somewhat slower code, and the toolchain is reported at INFO, not as a warning. `cc` is still used where it builds, and a library it built earlier is used from the cache. `BNGSIM_CODEGEN_JIT=cc` restores the error. `bngsim doctor` and `Model.describe()` say when MIR builds instead. diff --git a/changelog.d/1856.fixed.md b/changelog.d/1856.fixed.md deleted file mode 100644 index 0f577b842..000000000 --- a/changelog.d/1856.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A `.net` value that was a parameter's name alone was read as a number where the name is `inf`, `nan` or `Infinity` (issue #1856).** BNG2.pl accepts a parameter of such a name and writes `k2 inf`, or `2 B() inf`, for a parameter or a seed species set to it. `Model.from_net`, and `Model.from_bngl` through BNG2.pl's `.net`, tried the text as a number first, and `strtod` reads those words, in any case, as infinity or NaN: with `inf 5`, k2 and B(0) were infinite where BNG2.pl holds 5, and `k4 1/k2` was 0 with nothing said, so `A() -> B() k4` from A = 100 gave B(1) = 0 for BNG2.pl's 23.1269. Both sites now read a value that is a declared parameter's name as that parameter, wherever in the block it is declared. The same holds under a sign (`k2 -inf`), in an action (`setParameter("k2","inf")` set infinity under `run_bngl`), and in `net_to_omex(..., bngl=)`, which refused BNG2.pl's own network for `k2 nan`. The word beside no parameter of that name (and in another case than the parameter's) is the number it was. diff --git a/changelog.d/1881.fixed.md b/changelog.d/1881.fixed.md deleted file mode 100644 index 61f0a9dde..000000000 --- a/changelog.d/1881.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **SED-ML, the SBML a change reads, an OMEX manifest and a fetched BioModels file in an encoding other than UTF-8 are read as XML says, not refused (issue #1881).** XML names its own encoding: a byte-order mark, else (UTF-16 or UTF-32 with no mark) its first bytes, else the XML declaration, else UTF-8. `read_sedml_protocol` decoded a SED-ML file and the SBML beside it as strict UTF-8, as `read_omex` did its manifest and a rebuild did a BioModels model from its record, so a file in ISO-8859-1 or UTF-16 (valid XML) raised a bare `UnicodeDecodeError`; a fetched SED-ML file in Shift_JIS, or a model in UTF-16, was refused as not SED-ML or not SBML. Each now decodes through one decoder, and a string handed to `from_sbml_string` or stored by `write_omex` has its declaration named UTF-8, so libSBML reads its characters. The BioModels fetch read UTF-8 before the declaration; it now reads the declaration, as libSBML does. Bytes that do not decode as declared, a mark or first bytes the declaration contradicts, a wide encoding declared on 8-bit bytes, or a codec that rewrites text (`unicode_escape`, `utf-7`, `hz`) raise an error saying which (a `ModelError` for a model). diff --git a/changelog.d/1937.fixed.md b/changelog.d/1937.fixed.md deleted file mode 100644 index d9d7257dd..000000000 --- a/changelog.d/1937.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A forward sensitivity through one of ExprTk's implicit products was exact zeros, with no warning, and a plain run stepped over a pulse centred on one (issue #1937).** The engine reads `2j`, `2 j`, `(1+1)j`, `(j)2` and `j(2)` as `2*j`. The Python readers scanned the text for the word `j`, found none, and took the expression to name no parameter: with `A0 = 2j`, dA/dj came back [0, 0, 0] for 2·e^(-t/2); a rate law `k*2j` failed its build on Python's imaginary `I`; and `1000*exp(-((time() - c)/0.0005)^2)` with `c = 2j` gave A(10) = 0 for 0.886. The products are now written out, by the pass the C emitter already uses, before a derived parameter's expression is scanned or parsed (seeds, the chain rule, the kink check, pulse stops), and a rate law's lexer-level ones before its parse. A law with ExprTk's square or curly brackets (`j[2]`), or with a name against a bracket beside another product (`0.5Atot(2)`), declines as before. Also: a reserved word in another case is a name, as it is to the engine (`2In` was zeros too), and a derived parameter that is a logical operation (`j and k`) has a zero column, not 1. diff --git a/changelog.d/1953.fixed.md b/changelog.d/1953.fixed.md deleted file mode 100644 index 085c081d3..000000000 --- a/changelog.d/1953.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A stack of PSA runs reported `time = 0.0` and both event integrals `0.0` beside `active = True`, and `psa_cost_decision` failed on every ensemble (issue #1953).** `run_replicates(..., squeeze=True)` (and `Result.squeeze` over PSA runs) built the stack's `psa_diagnostics` from the report of a run that used no partial scaling, so the stack read as a run that took no time and fired nothing, and its NaN `speedup` made `psa_cost_decision` raise "speedup must be > 0, got nan". A stack of replicates now reports the sum of each event integral over its runs, their ratio as `speedup` (the ensemble's event-rate ratio), and the `time` of each run. A stack whose rows are not replicates of one run (a scan, a batch, rows of different methods, a repeated seed) has no one ratio: its integrals and `speedup` are NaN, and `psa_cost_decision`'s error for a NaN names `psa_diagnostics_per_run`. A stacked result saved by an earlier release loads with the same report. diff --git a/changelog.d/1954.fixed.md b/changelog.d/1954.fixed.md deleted file mode 100644 index d1188d891..000000000 --- a/changelog.d/1954.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A network-free run or session rounded a seed amount that was not a whole number without a word, where NFsim and RuleMonkey run on their own truncate it (issue #1954).** `B() 19.703` starts at 20 in `NfsimSession`, `RuleMonkeySession`, `method="nf"` and `method="rm"`, as in `run_network`, and at 19 in NFsim and `rm_driver`, so a comparison with either engine's own program started one molecule apart (Posner 2004: 1807 ligands for 1806) and nothing said so. Each of the four now gives a `SsaRoundingWarning` when it rounds a seed amount: it names the first species, its amount and count, and, for an amount the XML or a parameter gives, what the engine alone would start it at. A `Simulator` run also records it on `result.notices` (`network_free.rounded_seeds`). The counts themselves are unchanged. `docs/user-guide/network-free.md` says that the engines truncate the same XML. diff --git a/changelog.d/1970.added.md b/changelog.d/1970.added.md deleted file mode 100644 index 4f6fbcc43..000000000 --- a/changelog.d/1970.added.md +++ /dev/null @@ -1 +0,0 @@ -- **SBML display names are kept, shown and read ([#1970](https://github.com/lanl/bngsim/issues/1970)).** A loaded SBML or Antimony model dropped each element's `name`, so BIOMD0000000073's "Mb" was only `species_0` and `r.species["Mb"]` raised "not found". `Model.describe()` now gives each species, state, parameter (local ones too), compartment and reaction named other than its id a `display_name` beside the id, which `name` stays. A display name the file gives one element, and no id, reads it in `result.species`, `result.observables`, `get_param`, `set_param`, `set_params`, `get_concentration`, `set_concentration`, the sensitivity arguments, `parameter_scan`, `run_batch`, `steady_state_batch` and `compute_all_sensitivities`. One several elements share is refused with each named. `result.record["columns"]` gives each species column, and the observable named after it, its `display_name`, with `display_name_shared` or `display_name_is_an_id` where it reads nothing; a saved Result keeps them. A net_to_sbml file's BNGL patterns come back as display names. Annotations are not read yet. diff --git a/changelog.d/1971.changed.md b/changelog.d/1971.changed.md deleted file mode 100644 index e13ca57b7..000000000 --- a/changelog.d/1971.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **The `bngsim` command takes a BioModels id wherever it takes MODEL ([#1971](https://github.com/lanl/bngsim/issues/1971)).** `bngsim run BIOMD0000000010 --t-end 100` and the same for `inspect`, `check`, `run-until`, `run-batch`, `parameter-scan` and the steady-state commands load the entry as `Model.from_biomodels` does, fetched once and then cached; `--biomodels-version N` and `--biomodels-refresh` are its `version=` and `refresh=`. Before, each refused the id with advice for Python under the generic `model.error`. The JSON's `model` is the id, and the `steady-state` payloads gain `source`. A fetch that fails is `model.fetch_failed`, with the id, host, reason, cache directory and cached versions in its details; a missing entry or version is `model.biomodels_not_found`, and an entry whose main file is not SBML `model.biomodels_not_sbml`; and `Model.load` of an id is `model.biomodels_id`, with `Model.from_biomodels` as its remedy. A failed `refresh=True` now says a copy is cached where one is, in place of "No copy of it is cached". diff --git a/changelog.d/1972.added.md b/changelog.d/1972.added.md deleted file mode 100644 index c12198b2c..000000000 --- a/changelog.d/1972.added.md +++ /dev/null @@ -1 +0,0 @@ -- **A BioModels entry's SED-ML experiments, fetched with the model they run ([#1972](https://github.com/lanl/bngsim/issues/1972)).** `describe()` of a model from `Model.from_biomodels` lists the entry's SED-ML files with BioModels' descriptions, and `Model.from_biomodels(id, experiment="figure1.sedml")` returns the model the file runs and its `ProtocolSpec`, for `bngsim.run_protocol`. Each file is checked against its published sha256 and cached. Nothing chooses a file for you. A template, BioModels' generic time course from 0 to 10, is labeled by its description or by the ids its generator writes, warns when asked for, and gives each run the notice `biomodels.template`. `record["run"]["experiment"]` names the file only on a `run_protocol` run of it as written: the protocol as read, on the model as loaded, with its own tolerances and no lossy step. New codes: `model.biomodels_no_experiment`, `model.biomodels_experiment_files`, `model.biomodels_unexpected`. `bngsim run` and `bngsim check` take `--experiment FILE`. diff --git a/changelog.d/1992.fixed.md b/changelog.d/1992.fixed.md deleted file mode 100644 index 3470acd03..000000000 --- a/changelog.d/1992.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **`sbml_to_net` and `sbml_to_bngl` wrote a compartment size the SBML model refuses to change as a free parameter.** A size in `Model.unwritable_compartment_size_params` (one an initialAssignment folds into another compartment's size, for one) is not in `Model.frozen_params`, so the converters' handling of frozen parameters passed it over: the model loaded from the written file took `set_param` on it, which could move a rate law that names the size and not what the size was folded into, held there as a number. In the issue's model `set_param("c1", 3)` gave A(2) = 0.0498 where the SBML model at that size gives 0.1353. Such a size is now written as a frozen parameter is: left out where nothing in the file reads it, so that a write to it is refused as a name the model has not, and marked `folded_at_load=` where something does, so that the model loaded from the file lists it in `frozen_params` and refuses the write. The conversion report names each in `folded_left_out` or `folded_marked`. diff --git a/changelog.d/1994.fixed.md b/changelog.d/1994.fixed.md deleted file mode 100644 index 180a77c6a..000000000 --- a/changelog.d/1994.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A `folded_at_load=` comment written by hand in a `.bngl` could freeze the wrong parameter, or none.** `Model.from_bngl` read each line of the parameters block as one declaration, and the first blank-separated word as its name. BNG2.pl joins a line that ends in `\` with the next, so `f \` then `k # folded_at_load=...` declares `f = k`: the comment froze `k`, which the file says nothing about, and `f` took `set_param`. With a number on the second line, nothing was frozen. BNG2.pl also takes the name as the identifier a declaration starts with, so `f(2.0)`, `f(k+1)` and `f-2.0` declare `f`, and on those the comment froze nothing. A comment in a block opened `beginparameters`, which BNG2.pl reads as `begin parameters`, was not read at all. The comment is now read off the declaration BNG2.pl reads, and freezes the parameter it declares. A `.net`, which bngsim's loader reads one line to a declaration, and every file `sbml_to_net` and `sbml_to_bngl` write, are read as before. diff --git a/changelog.d/2009.changed.md b/changelog.d/2009.changed.md deleted file mode 100644 index e055e9fb0..000000000 --- a/changelog.d/2009.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **`check()`'s `ok` was True on a run no other engine checked, and its `next` said only "No check moved the answer past its bound" (issue #2009).** A `.net` run's `check("all")` was ok with `second_engine` `unsupported`, so a caller reading `ok` could report a run "checked against libRoadRunner" that it never saw. An ok report's `next` now names each check that did not run and why, and says whether another simulator was involved; `independent` says the same for a program. `check(require=[...])` and `bngsim check --require` name the checks a report must pass to be ok: they run whether or not `checks` names them, one that did not pass makes the report not ok (exit 6), and `next` says why and what would make it run. A check now meets `budget=` at its first rerun: one that the record or the build shows cannot apply is `skip` or `unsupported`, not `timeout`, and one whose reruns another check made gives its verdict from them. `required` and `required_not_passed` are new keys; `check_version` stays 2. diff --git a/changelog.d/2010.changed.md b/changelog.d/2010.changed.md deleted file mode 100644 index b2e1a3938..000000000 --- a/changelog.d/2010.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **`check()`'s default on a sensitivity run could not catch a column that is wrong at every tolerance (issue #2010).** The default checks all reran the same sensitivity code at a tighter tolerance or on a finer grid, so issue #1937's column of exact zeros passed them, and only `check("all")`'s difference quotient saw it. A run that computed forward sensitivities now gets `sensitivity_fd` by default as well: it moves each parameter by 0.1% and 0.2% of itself and differentiates the trajectories with the sensitivities off, so it reads nothing of the sensitivity code. It costs four runs per column and one more, which `budget=` bounds; the columns a budget does not reach are named in the verdict's `timed_out`, counted in its new `n_timed_out`, and named in `next`; an ok report's `next` also names the columns a check left out (`not_judged`, counted in the new `n_columns_not_judged`: a value at 0, a derived parameter). `timed_out` no longer lists a column at 0, which is `not_judged`. A genuinely zero column still passes. A caller who wants the old default names it: `check(["tolerance", "grid", "sensitivity"])`. diff --git a/changelog.d/2011.changed.md b/changelog.d/2011.changed.md deleted file mode 100644 index 9c73dabfc..000000000 --- a/changelog.d/2011.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **`bngsim steady-state` exits 7 when the solve did not converge (issue #2011).** It exited 0 and printed the values where the march stopped, under a command named `steady-state`. `steady-state-batch` now exits 7 when any row did not converge, and `steady-states` when its search finds no steady state. The JSON is unchanged and still on standard output, with `converged: false`. A caller that read exit 0 as "no error" should treat 7 as an answer that is not a steady state. diff --git a/changelog.d/2012.fixed.md b/changelog.d/2012.fixed.md deleted file mode 100644 index 6a6a3f6a2..000000000 --- a/changelog.d/2012.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **`run(t_span=(0, 10), sample_times=[5, 10])` dropped the `t_span` and integrated from 5, so the row labeled t = 5 held A(0) (issue #2012).** Given both, the run now integrates over `t_span` and reports at `sample_times`, as SciPy's `t_span` and `t_eval` do; a sample time outside `t_span` is a `UsageError`. `sample_times` alone behaves as before. `NfsimSession.simulate` and `RuleMonkeySession.simulate` take `t_start` and `t_end` beside `sample_times` the same way, `Result.rerun(sample_times=...)` keeps the run's start (an earlier sample time needs `t_span=` too), and `bngsim run` and `bngsim check` accept `--t-start` and `--t-end` with `--sample-times`. The `t_eval` error's suggested call is now right. diff --git a/changelog.d/2013.changed.md b/changelog.d/2013.changed.md deleted file mode 100644 index 9d5e90f8a..000000000 --- a/changelog.d/2013.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **A model built with `ModelBuilder` could not be rerun or checked (issue #2013).** `Result.rerun()` raised "there is no source to build it again from", so `check()` of the agent guide's own builder example was a tolerance `exception` and a grid `unsupported`. The builder now keeps its calls, which take plain data, as the model's source: the record's `model.format` is `"builder"`, with the sha256 of the calls, and a rerun makes them again, a Result saved with `save()` and loaded in a new process included. `check()` works on such a run as on a loaded model's, with `second_engine` `unsupported`, as there is no file for libRoadRunner to read. A run whose record holds no source (a model built through the core's builder, or one a builder call raised partway through) gets `unsupported` from every check, never `exception`. diff --git a/changelog.d/2014.changed.2.md b/changelog.d/2014.changed.2.md deleted file mode 100644 index 0949853ac..000000000 --- a/changelog.d/2014.changed.2.md +++ /dev/null @@ -1 +0,0 @@ -- **`check()`'s libRoadRunner and AMICI checks skipped every run whose start a `set_concentration` had set (issue #2014).** The record could not tell such a start from one that continued another run, so a dose was never checked by another engine. The record's `run` part now has `concentrations_set`: the species the caller set with `set_concentration` since the loaded initial conditions, with their values (`{}` for none; one saved with `save_concentrations` is in the state `reset()` returns to), checked against the start itself, and `None` for a start of another history (the end of an earlier run, `set_state`, a restored named snapshot). Both engines are given each set species' start, as a concentration, or for one the file holds in amounts as that times its compartment's size, after what the file computes at the start, so nothing derived from it follows, as in BNGsim; AMICI with an initial sensitivity of 0 (a species set to the file's own start is no change). `applied` gains `concentrations`. A start of another history, a species the file declares constant or a rule sets or in a compartment of no constant size, or a file with events, is a skip with its reason. diff --git a/changelog.d/2014.changed.md b/changelog.d/2014.changed.md deleted file mode 100644 index c4151353c..000000000 --- a/changelog.d/2014.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **`check()`'s libRoadRunner and AMICI checks skipped every run at changed parameters or at `sample_times=` (issue #2014).** After a `set_param`, the commonest thing a caller does, only BNGsim-against-BNGsim checks ran, so a scan, a dose or a fit was never checked by another engine. Both engines are now given the run's parameters that are not the file's, by their SBML ids, where each is a global parameter of the file that no rule and no initial assignment sets, and the run's sample times. libRoadRunner computes what the file derives from such a parameter at the start, as `set_param` has BNGsim do. The verdict's new `applied` key, and the end of its note, name what the engine was given. A compartment's size or a reaction's local parameter is still a skip, with its reason, and so is a changed start state (a `set_concentration`, or a run that continued another). diff --git a/changelog.d/2016.added.2.md b/changelog.d/2016.added.2.md deleted file mode 100644 index 520e4aa15..000000000 --- a/changelog.d/2016.added.2.md +++ /dev/null @@ -1 +0,0 @@ -- **Under `--deadline`, a file `--out` names is written whole or not at all ([#2016](https://github.com/lanl/bngsim/issues/2016) review).** Written directly, a file the deadline stopped was left cut short at a whole row with nothing to say so. The arrays now go to a temporary file, then into the file `--out` names in place (a new file made as writing it directly makes it; one that is there keeps its links and attributes), with the deadline waiting for that step; where no folder can be made for the temporary file, or it runs out of room, the file is written directly. Without `--deadline` the file is written as before. diff --git a/changelog.d/2016.added.md b/changelog.d/2016.added.md deleted file mode 100644 index 5e2f5ad76..000000000 --- a/changelog.d/2016.added.md +++ /dev/null @@ -1 +0,0 @@ -- **`--deadline SECONDS` bounds a whole `bngsim` command ([#2016](https://github.com/lanl/bngsim/issues/2016)).** `--timeout` counts the run only, and loading the model, BNG2.pl, a cold compile and `check`'s reruns each had a limit of their own or none, so `bngsim check model.bngl --network --timeout 60` could run for about half an hour, past an agent's shell limit, which then killed it with no JSON and no exit code. `--deadline`, on every command that loads a model, counts from the command's start over every phase. Past it the command stops BNG2.pl or the compiler, and exits 5 with `run.timeout`, the phase it was in (`load`, `generate`, `compile`, `run`, `check`, `describe`), the seconds spent in each, and the `--out` files it wrote. `check`'s `--budget` is cut to what the deadline leaves, so the run and a report come back (exit 6) with the reruns that did not fit as `timeout`. diff --git a/changelog.d/2016.fixed.2.md b/changelog.d/2016.fixed.2.md deleted file mode 100644 index f396d7309..000000000 --- a/changelog.d/2016.fixed.2.md +++ /dev/null @@ -1 +0,0 @@ -- **`bngsim run --out .npz` failed after the run ([#2016](https://github.com/lanl/bngsim/issues/2016) review).** A name that is only the suffix has none as `Result.save` reads it, so the run was written as HDF5, or failed after the run without h5py. It is refused before the run now, for the commands that write a Result; `.csv`, `.h5` and the steady-state commands' `.npz` are taken as before. A run's own timeout now names the command's `--timeout` in its remedy, not the keyword `timeout`. diff --git a/changelog.d/2016.fixed.3.md b/changelog.d/2016.fixed.3.md deleted file mode 100644 index 5e092862d..000000000 --- a/changelog.d/2016.fixed.3.md +++ /dev/null @@ -1 +0,0 @@ -- **A `.bngl` network a `prefix=>` put outside the loader's folder could be another load's ([#2016](https://github.com/lanl/bngsim/issues/2016) review).** With `prefix=>"../x"`, BNG2.pl wrote the network beside the loader's work folder, in the temporary folder every load shares, where a load running at the same time could replace it before it was read, and left it there. It is now written inside the work folder and removed with it; a network an absolute `prefix=>` puts elsewhere is refused, since another load may write the same file. diff --git a/changelog.d/2016.fixed.md b/changelog.d/2016.fixed.md deleted file mode 100644 index 7bf9b04d9..000000000 --- a/changelog.d/2016.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A BNG2.pl that failed loaded as a different model ([#2016](https://github.com/lanl/bngsim/issues/2016) review).** BNGsim never read BNG2.pl's exit status, so a network it left behind loaded, ran with exit 0, and was cached for every later load: one cut short at a line break, a `print_iter` snapshot (42 of 258 species), or one a read file's own `generate_network` wrote before its `simulate` failed, missing the `setParameter` after it. Loading now refuses any network from a BNG2.pl that failed, saying what BNG2.pl said, and caches nothing; the cache's key changed, so the networks it held are made again once. `validate="bng2"` takes one only where BNG2.pl said it finished writing it, and runs BNG2.pl through `perl`, as loading does. After a BNG2.pl that finished, the network is the last one it says it wrote (its name read back as perl printed it, encoded under `PERL_UNICODE` or `-C` too; where no reading of it is a file, found as before, if BNG2.pl wrote only that one): a read file's own `generate_network` no longer stands for a later one with a `suffix` or `prefix` (main loaded k = 1 for a file that sets k = 5), and a finished `print_iter` run with a `suffix` loads. diff --git a/changelog.d/2017.added.md b/changelog.d/2017.added.md deleted file mode 100644 index e65c37d7f..000000000 --- a/changelog.d/2017.added.md +++ /dev/null @@ -1 +0,0 @@ -- **A stack of replicates gives the standard error of its mean ([#2017](https://github.com/lanl/bngsim/issues/2017)).** For a stack of replicates (`run_replicates(..., squeeze=True)`: rows whose seeds all differ), `Result.digest()` gives `last_sem` and `replicates: True`. `Result.check()` of the stack, which raised before, gives each observable's mean and its standard error at each output time, judging nothing, and says how many replicates would bring the largest relative standard error under 1%. `bngsim check --replicates N` does the same. Any other stack gets no standard error, and `check()` still refuses it, now saying why. `Result.record` gains `row_seeds`, each row's seed of a stack; as with any key added to the record, a rerun's `rerun_of.record_sha256` now differs from the one 0.18.0 wrote for the same run. diff --git a/changelog.d/2018.fixed.md b/changelog.d/2018.fixed.md deleted file mode 100644 index bf117423f..000000000 --- a/changelog.d/2018.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A stop condition now ends the run where it holds; it was asked only after the run had gone to its end.** `A' = A²` from A = 1 passes 10 at t = 0.9 and blows up at t = 1: with `add_stop_condition("Atot > 10")` over (0, 2) the run raised `SimulationError`, and now returns `StopConditionMet` at t = 0.9. An ODE, SSA or PSA run asks an expression condition at each sample and ends at the first it holds at; an ODE run ends where a comparison or a number starts to hold, at the crossing. The model is left at the stop, with `current_time` its time. An SSA run of A → 2A to `Atot > 1e4` over (0, 30) ran to its timeout, and ends at t ≈ 7. Where several hold at one sample, the first added names it. Callables, conditions on species reported after the run, network-free runs and `.net` models whose rate law switches on its state are still asked after the run. A condition that never holds gives the same run, bit for bit, unless it meets its threshold where an event fires: the event, or the stop, can then move within the root tolerance. A comparison only rounding decides (a total against its own value) can now stop a run main ran whole; compare with a margin. diff --git a/changelog.d/2034.fixed.md b/changelog.d/2034.fixed.md deleted file mode 100644 index fc7f37614..000000000 --- a/changelog.d/2034.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A steady-state `mask=` that kept an SBML assignment-rule species tested nothing for it, and could return a state far from rest as converged (issue #2034).** A rule target's slot never moves, so with `M' = k0 - k1 M`, `Z := 2 M` and only Z kept, `steady_state` came back converged after one step at Z = 3e-11 for 2; with Z and a fast W kept, at Z = 0.0705, the moment W came to rest. A kept rule target now keeps the species its rule reads in its place (through observables, functions, table-function indexes and `rateOf`, and through a rule that reads another rule target), so keeping Z is the solve that keeps M, in `steady_state`, `steady_state_batch` and `steady_states`. A kept total that stays constant while the species it sums move is therefore at rest only once they are; a pure sink a rule reads is not added, so `mask=~model.is_pure_sink()` is the solve it was. The core reports what each function reads as `function_species_reads`. diff --git a/changelog.d/2042.fixed.md b/changelog.d/2042.fixed.md deleted file mode 100644 index c6fcc8bae..000000000 --- a/changelog.d/2042.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A masked `steady_state` solve under the default criterion that ran out of `max_time` returned the state of its first steps, not the state it reached (issue #2042).** With `0 -> M`, `M -> 0`, `M -> M + X`, `X -> 0` and only X kept, `max_time=3` came back unconverged after 80 steps at M = 2.5e-10, X = 6.5e-20, where the model is at M = 0.950, X = 1.207: X had passed the residual test at the first step, while M, which X reads, was still moving. The state the kept species passed at is now returned only where the criterion takes it (converged, as before), where the masked species they read are at rest there too, or where the march ended on a failed step or a state that is no number; otherwise the solve returns where it stopped, as it does with no mask and as `method="newton"` did. On BioModels, four masked solves that came back unconverged now converge, since the polish starts from the state reached. diff --git a/changelog.d/2045.changed.md b/changelog.d/2045.changed.md deleted file mode 100644 index 604b3e550..000000000 --- a/changelog.d/2045.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **A test now keeps the ODE integrator's tolerance table whole, and an event's assigned value is differenced over the step its constant names (issues #2045, #2073).** `python/tests/test_tolerance_table_ratchet.py` fails a pull request that adds a `constexpr` constant named `k…`, of any type, to the integrator's sources without a row in `docs/development/tolerance-table.md` and a test that pins it, or that leaves a row naming a test that does not exist; a removed constant's row is marked removed, not deleted. The three difference steps of an event's assigned value, which were written `1e-6`, now read `kAssignedDifferenceStep`, which is 1e-6: no result changes. diff --git a/changelog.d/2074.fixed.md b/changelog.d/2074.fixed.md deleted file mode 100644 index 786b84aa1..000000000 --- a/changelog.d/2074.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **`steady_state(mask=..., criterion="residual")` by integration came back unconverged where its march stalled within tolerance between two checks of the masked inputs ([#2074](https://github.com/lanl/bngsim/issues/2074)).** A march that waits for masked species the kept ones read checks those inputs by a Newton step only at the 1st, 2nd, 4th, ... step at which the kept species pass and the inputs do not, and one called stalled (or ended by the integrator) between two such steps was not checked where it stopped. With the inputs at rest and a kept species coming within its tolerance at the 1,385th such step, a march stalled at the 2,005th came back unconverged, 2e-9 (relative) from its steady state. It is now checked where it stops, as the default criterion's march is. The schedule of the checks is unchanged. diff --git a/changelog.d/2077.fixed.md b/changelog.d/2077.fixed.md deleted file mode 100644 index 80a17f863..000000000 --- a/changelog.d/2077.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **An SBML reaction with a non-integer stoichiometry listed its divided rate function once per species ([#2077](https://github.com/lanl/bngsim/issues/2077)).** In a compartment whose size is not 1, or can change, such a reaction reads its law divided by each species' compartment, `_vd__`. The loader registered that function once for every species the reaction changes, and every copy was kept, so `Model.function_names`, a result's `expression_names` and `expressions`, and the `.net` that `sbml_to_net` writes each repeated it (37 times for one reaction of BIOMD0000000496). It is now registered once per name, so the species of one compartment share it. The values were right before and are unchanged. diff --git a/changelog.d/2090.fixed.md b/changelog.d/2090.fixed.md deleted file mode 100644 index 835a490b8..000000000 --- a/changelog.d/2090.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **An action before `generate_network` that read an observable was put back with the network's amounts, where BNG2.pl reads every observable as 0 before the network exists ([#2090](https://github.com/lanl/bngsim/issues/2090)).** `addConcentration("A()","Btot")` with B = 4, saved and then reset to, started the run from A = 5 for BNG2.pl's 1; so did one through a function of an observable (`f() = 2*Btot`: 9) and a `setConcentration` to an expression that read one. `run_protocol` now reads them as 0 where it puts such a save back; an observable read after generation is the network's, as before. The actions block `omex_to_net` writes, and SED-ML, write such an observable as 0, and say they cannot go back to a save that read one through a function. diff --git a/changelog.d/2099.changed.md b/changelog.d/2099.changed.md deleted file mode 100644 index a939149f3..000000000 --- a/changelog.d/2099.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **Building the analytic sensitivity right-hand side of a large model takes more than a third less time (issue #2099).** `generate_sens_from_model` redid two pieces of fixed work for every expression: it split the model's parameter names into the ones a single tokenizing pass can find and the rest (one regex search per name) for each derived parameter, and it copied the symbol tables of the model into new sets for each rate law. The split now runs once per name set (each expression still builds the set to look it up, a sixth of the split's cost), and a rate law reads the tables in place. On Froehlich_CellSystems2018 (1,396 species, 8,350 parameter names) the call took 4.5 s against 7.3 s (median of three cold builds each), and so leaves more of the 20 s derivation budget for the derivatives themselves. The generated code is unchanged: byte for byte the same on the 502 SBML and `.net` models in the repository that load. diff --git a/changelog.d/2100.added.md b/changelog.d/2100.added.md deleted file mode 100644 index 5eb0b5ffe..000000000 --- a/changelog.d/2100.added.md +++ /dev/null @@ -1 +0,0 @@ -- **`Simulator.compute_all_sensitivities` takes explicit output times, `sample_times=`, as `run()` does (issue #2100).** It wrote only a uniform grid of `n_points` over `t_span`, so sensitivities at measurement times, or on a log-spaced grid over many decades (0, then 1e-2 to 1e8), could not come from it: no uniform grid from 0 lands on both 1e-2 and 10^-1.5. The times are read as `run()` reads them: at least two, all finite, sorted, a repeated time a row of its own; with `t_span` given too, each chunk integrates over it and reports at the sample times, and one outside it is refused. Every chunk, and every column the retry of a failed chunk runs alone, reports at those times, so the stitched tensor is on them; with one chunk it is `run(sample_times=...)`'s, to the bit, on the models tested (mass action, and a functional rate law with a time switch). `times=` and SciPy's `t_eval=` now point to `sample_times=`, as they do for `run()`. diff --git a/changelog.d/2100.changed.md b/changelog.d/2100.changed.md deleted file mode 100644 index a6d552fc4..000000000 --- a/changelog.d/2100.changed.md +++ /dev/null @@ -1 +0,0 @@ -- **`compute_all_sensitivities`' `t_span` defaults to `None` (issue #2100).** Without `sample_times` it means `(0, 100)`, the old default, so a call that gives neither runs as before; with `sample_times`, the sample times' own span. The default changed so that a `t_span` passed beside `sample_times` can be told from one that was not, as #2012 did for `run()`. diff --git a/changelog.d/2101.fixed.md b/changelog.d/2101.fixed.md deleted file mode 100644 index 1b6349d4f..000000000 --- a/changelog.d/2101.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A sensitivity build that ran out of its derivation budget was cached, and every later build of the model on that cache got it ([#2101](https://github.com/lanl/bngsim/issues/2101)).** The budgets are wall-clock, so a model near one (Froehlich_CellSystems2018, 19.7 to 20.1 s against 20 s on a cluster node) declined the analytic sensitivity RHS on some runs and not others, and whichever came first was kept under the model's cache key: a decline there kept every later build on CVODES' difference quotient, where an N_p = 100 run did not finish in 1,800 s against 22.8 s analytic. A build that any budget cut (∂f/∂p or the expression output sensitivities) is now cached under its source's hash, so the next process derives again, and only a completed build is kept under the model's key. Loading sympy (about 2 s on a cluster node) is no longer counted against a budget, and it is loaded only where a derivation is about to use it, so a model with nothing for sympy to do loads none, as before. diff --git a/changelog.d/2106.fixed.md b/changelog.d/2106.fixed.md deleted file mode 100644 index d87ea73aa..000000000 --- a/changelog.d/2106.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **On Windows, a MIR context never gave back the memory that held its generated code ([#2106](https://github.com/lanl/bngsim/issues/2106)).** MIR's default code allocator releases a code mapping with `VirtualFree` and the mapping's length, but `VirtualFree` with `MEM_RELEASE` takes a length of 0 only and fails otherwise ([vnmakarov/mir#496](https://github.com/vnmakarov/mir/issues/496)). Every context that `MirJit` finished, and every one it abandoned after a failure, therefore left its code committed for the life of the process, so the committed memory of a Windows process that compiled models with the MIR JIT grew with each one. Only builds with the MIR JIT (`BNGSIM_ENABLE_MIR=ON`) were affected. `MirJit` now releases each code mapping itself on Windows, with a length of 0. Other platforms are unchanged. diff --git a/changelog.d/2114.fixed.md b/changelog.d/2114.fixed.md deleted file mode 100644 index 8248ae8ce..000000000 --- a/changelog.d/2114.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **An SBML `piecewise` with no `otherwise` is undefined where none of its pieces holds, not 0 (issue #2114).** SBML leaves its value undefined there, and bngsim read 0, so a rate law or a rule switched off without a word: `piecewise(2, time < 5)` as a rate gave A(10) = 10, where libRoadRunner stops at t = 5. The value is now NaN, held by an internal parameter, `_piecewise_undefined`, and a load warns naming each element with such a piecewise. A run that reaches such a time or state fails there, and a value that only reports reads NaN. Conditions that are complements as written (`x < a`, `x >= a`) read as before, with no warning, and the analytical Jacobian is kept. `write_sbml` writes the piecewise with no `otherwise` again; `write_net` and `write_bngl` write the value inside a function as `(0/0)`, which BNG2.pl reads. `write_bngl` writes each function as `name() = expr`: without the `=`, BNG2.pl read `time() >= 5` as `time() > 5`. diff --git a/changelog.d/2120.fixed.2.md b/changelog.d/2120.fixed.2.md deleted file mode 100644 index 6244dd529..000000000 --- a/changelog.d/2120.fixed.2.md +++ /dev/null @@ -1 +0,0 @@ -- **Where no seeds are handed to the core (sympy unavailable), a forward-sensitivity run from a baseline `save_concentrations()` saved seeded each species whose declared start names a parameter from that parameter.** With `A() A0` and A set to 4 and saved, dA/dA0 was 1 at the start where a central difference gives 0: no parameter reaches a saved baseline. The steady-state seeding and the Python path already said so; the time course's own loop, and `Model.effective_ic_sensitivity()` on that path, now do too. The same loop seeded 1 for a species declared in amounts, whose stored start is the parameter over its compartment's size (0.5 at size 2); it now divides, as the steady-state loop does. diff --git a/changelog.d/2120.fixed.md b/changelog.d/2120.fixed.md deleted file mode 100644 index 1f449a03a..000000000 --- a/changelog.d/2120.fixed.md +++ /dev/null @@ -1 +0,0 @@ -- **A species set by `set_concentration` (or `set_state`) took back its initial condition once a `set_param` moved that condition onto the value set (issue #2120).** With `B = 2*k0` in the file (3 at k0 = 1.5), `set_concentration("B", 4)` then `set_param("k0", 2)` left B at 4, as it should, but read it as its condition from then on: forward sensitivities gave dB/dk0 = 2 at the start (1.558 at t = 5) where a central difference over the same calls gives 0, a steady state's dA_ss/dA0 was 1/3 where it is 0, and the next `set_param("k0", 2.5)` re-dosed B to 5 over the caller's 4, with no word. The same held for a compartment size that moves an amount-declared species' start onto the value set. Each species now keeps the mark of the assignment that took it off its condition until `reset()`, `save_concentrations()`, or an assignment that changes it again; parameter scans, batches' warnings, snapshots, replicates, reruns, clones and the `.net`, BNGL and SBML writers keep it too. A species set to exactly the value its condition gives still follows the condition, as before, and the record's `concentrations_set` lists it only once saved. diff --git a/pyproject.toml b/pyproject.toml index 2ecc1eac7..964f7fc04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ build-backend = "scikit_build_core.build" [project] name = "bngsim" -version = "0.18.0" +version = "0.19.0" description = "Simulate SBML, Antimony and BioNetGen (BNGL) models in Python: ODE, stochastic (SSA) and network-free simulation, steady states and sensitivities" keywords = [ "SBML", "Antimony", "BioNetGen", "BNGL", "systems biology", "biochemical reaction network", diff --git a/python/tests/test_docs_api_examples.py b/python/tests/test_docs_api_examples.py index a50e7cd92..e8fb25967 100644 --- a/python/tests/test_docs_api_examples.py +++ b/python/tests/test_docs_api_examples.py @@ -65,7 +65,12 @@ import numpy as np import pytest -_ROOT = Path(__file__).resolve().parents[2] +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from _source_root import bngsim_source_root # noqa: E402 + +# The real tree, not run_tests.sh's stand-in: python/bngsim/ is not in the stand-in, +# and a path resolved through its symlinks is not under it. +_ROOT = bngsim_source_root() or Path(__file__).resolve().parents[2] # ```python … ``` and its ```py alias. Indented fences (inside a list item) are # not matched: docs/ has none, and an indented block's dedent is a guess. diff --git a/python/tests/test_messages_carry_no_issue_references.py b/python/tests/test_messages_carry_no_issue_references.py index b578aa2bb..27911434b 100644 --- a/python/tests/test_messages_carry_no_issue_references.py +++ b/python/tests/test_messages_carry_no_issue_references.py @@ -21,9 +21,15 @@ import ast import re +import sys from pathlib import Path -_ROOT = Path(__file__).resolve().parents[2] +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from _source_root import bngsim_source_root # noqa: E402 + +# The real tree, not run_tests.sh's stand-in: python/bngsim/ is not in the stand-in, +# and a path resolved through its symlinks is not under it. +_ROOT = bngsim_source_root() or Path(__file__).resolve().parents[2] # The docs test's pattern: "#1846", "GH-1846", "issue 111", "PR 12", ".../issues/1846", # "-issue-111". A "# " comment marker and an HTML "{" do not match. diff --git a/python/tests/test_rulemonkey_exprtk_sync_closure.py b/python/tests/test_rulemonkey_exprtk_sync_closure.py index d1256f311..45013d76a 100644 --- a/python/tests/test_rulemonkey_exprtk_sync_closure.py +++ b/python/tests/test_rulemonkey_exprtk_sync_closure.py @@ -34,7 +34,12 @@ import pytest -REPO_ROOT = Path(__file__).resolve().parents[2] +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from _source_root import bngsim_source_root # noqa: E402 + +# The real tree, not run_tests.sh's stand-in: python/bngsim/ is not in the stand-in, +# and a path resolved through its symlinks is not under it. +REPO_ROOT = bngsim_source_root() or Path(__file__).resolve().parents[2] VENDOR_RULEMONKEY = REPO_ROOT / "scripts" / "vendor_rulemonkey.py" pytestmark = pytest.mark.skipif( diff --git a/uv.lock b/uv.lock index aa2db969a..cf75525dc 100644 --- a/uv.lock +++ b/uv.lock @@ -268,7 +268,7 @@ css = [ [[package]] name = "bngsim" -version = "0.18.0" +version = "0.19.0" source = { editable = "." } dependencies = [ { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" },