BREAKING CHANGES
PetabSimulationResult.res(PEtab v2) is a property now, for consistency
withPetabSimulationResult.llh. Replaceresult.res()byresult.res.- Require Python >= 3.12, following NEP 29
(#3180).
Features
- The PEtab v2 simulator now aggregates the residual sensitivities of all
experiments:PetabSimulationResult.srescontains the sensitivities of the
residuals returned byPetabSimulationResult.reswith respect to the
estimated PEtab problem parameters. - Added a
checkpointsparameter to the JAX PEtab simulation interface
(run_simulation/run_simulations), controlling the number of checkpoints
diffrax'sRecursiveCheckpointAdjointuses for reverse-mode gradients.
Defaults toNone(diffrax's automatic choice), preserving previous
behavior (#3217). - PEtab SciML: added support for importing
equinoxmodules (#3179). - PEtab SciML: implemented additional PyTorch-style layer types
(BatchNorm,InstanceNorm,AlphaDropout,Bilinear) (#3176). - PEtab SciML: updated support to PEtab v2 (#3165).
- Sped up parallel model import (
AMICI_IMPORT_NPROCS> 1) considerably.
Previously, a new worker pool was created for every parallelized operation,
and every worker of every pool had to import sympy and amici from scratch.
Now, a single pool is created lazily and reused, and its workers are forked
from aforkserverprocess that performs these imports only once. For small
operations, where the inter-process communication overhead outweighs any
speed-up, processing stays serial. Previously, parallel import could be
slower than serial import for all but the largest models.
Fixes
- Fixed both simulation backends selecting the wrong branch of a piecewise
expression whose condition depends on the value of another piecewise
expression. The Heaviside variables were initialized in a single pass, so
the outer condition was evaluated using the not-yet-updated value of the
inner expression. They are now iterated to a fixed point, which also makes
the result independent of the (previously differing) value the Heaviside
variables happened to be seeded with in either backend (#3233). - Demote the module import mtime check during sundials model import to a
warning, as it can lead to false positives in some environments
(e.g., when using network file systems with not synchronized clocks).
If you encounter this warning, and you are sure that the model was not
modified since the last import, you can safely ignore it. - Fixed SBML import constant-folding a parameter out of the initial conditions
when that parameter both carried aninitialAssignmentwith a numeric
right-hand side and defined a species' initial value. The parameter remained
in the free-parameter list, so its (initial-condition) sensitivity was
silently reported as zero (e.g.init_STATinjakstat_adjoint). This also
covers the transitive case, where such a parameter is reached through a chain
of parameter initial assignments (#3214). - Fixed the JAX model exporter writing floating-point numbers with only 15
significant digits, which is not enough to round-trip a double. Values were
silently perturbed in the last bits, which mattered wherever a model compares
values exactly (e.g. a parameter with valuepino longer tested equal to
pi). amici.sim.sundials.petab.PetabSimulator.simulateno longer fails for
PEtab v2 problems with non-Gaussian noise models or for the
RDataReporting.residualsreporting mode. The respective unavailable
aggregated results (sllh,s2llh,res,sres) areNonenow.
Experiments without measurements no longer suppress the residuals of all
other experiments.- The residuals (
ReturnData.res), their sensitivities (ReturnData.sres)
and the Fisher information matrix (ReturnData.FIM) of failed simulations
are invalidated now. Previously, the residuals of the timepoints that were
not reached stayed at their initial value of 0.0, i.e., they looked like a
perfect fit, and the FIM contained a partial sum. PetabSimulationResult.res(PEtab v2) returnsNoneif any experiment
failed to simulate.- Fixed SBML import turning a parameter into a constant state when its
initialAssignmentreferenced another parameter that becomes an AMICI
expression. Such chains are now resolved to a fixed point, so those
parameters stay expressions instead of inflating the state vector (e.g.
C2ss/C3ssincalvetti). - Fixed an
AttributeErrorwhen importing a model module without having
first imported something else fromamici.sim.sundials(#3200). - Fixed PEtab problem flattening not substituting the old observable ID in
the noise formula; updated the error message shown when importing a
non-flattened PEtab problem that requires flattening (#3177). - Fixed a spurious
AssertionErrorfrom the conservation-law computation for
models with condition-dependent compartment sizes, caused by comparing a
simplified and an unsimplified but mathematically equivalent expression
(#3202). - Fixed a
NameErrorin JAX-exported models when an explicit
(time-triggered) event trigger depends on a model expression (w) rather
than only on parameters (#3195). - JAX PEtab backend: fixed condition-name-based preequilibration detection,
which only worked for AMICI's own synthetic condition names and produced
incorrect or crashing results for PEtab problems using arbitrary condition
names for preequilibration (#3205). - JAX PEtab backend: fixed
JAXProblem.save()/load(), which no longer
matched the currentpetab.v2API (#3204). - JAX PEtab backend: fixed condition-table state-reinitialization lookup,
noise-distribution handling, and differentiability of condition-table
target values (#3207). - JAX PEtab backend: fixed discontinuity stepping, PEtab v1 problems (now
auto-upgraded to v2), noise/observable placeholder substitution, and event
assignments silently dropped for models with an odd number of roots
(#3196). - JAX PEtab backend: fixed measurement/override parsing and parameter-scaling
bugs that caused JAX benchmark simulations to fail or diverge from
SUNDIALS (#3210).
Performance
- Reduced JAX PEtab gradient-compilation time for benchmark models with
large repeated subexpressions (e.g. analytic steady-state initial values)
by adding common-subexpression elimination to the JAX code printer and
switching toImplicitAdjoint(#3212). - Avoided unnecessary JAX recompilation caused by
diffrax.steady_state_event()
returning a new closure (compared by identity) on every call; equivalent
settings now share the compiled executable (#3197). - Sped up importing/building models with CMake, most noticeably when
importing many independent models in one go (e.g. test suites, benchmark
collections, or PEtab batch imports): skip redundant HDF5 (#3220) and
compiler-flag (#3221) detection that was previously repeated on every
single model configure.
Documentation
- Added a PEtab SciML example notebook demonstrating problem loading,
simulation, and a basic training loop, using the Dandekar PEtab SciML
benchmark (#3208).
Full Changelog: v1.0.1...v1.1.0