Repository navigation
Conversation
This was referenced Nov 16, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3583 +/- ##
==========================================
+ Coverage 80.52% 80.87% +0.34%
==========================================
Files 332 331 -1
Lines 23698 23932 +234
Branches 1690 1674 -16
==========================================
+ Hits 19082 19354 +272
+ Misses 4610 4567 -43
- Partials 6 11 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
* Event assignments to entities that are not (solver) state variables now raise a `ValueError` in `DEModel.generate_basic_variables`, i.e., before code generation, and in `Event.get_state_update`. Such assignments were silently dropped. * Add `Event.assignment_targets` and `Event.check_assignment_targets`. * `ode_model_from_pysb_importer` disables conservation laws with a warning for models with events, as the SBML importer does, instead of raising. Preparation for PEtab v2 condition changes in later periods for PySB models (AMICI-dev#3068). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Condition changes in any period but the first one, including the main period after pre-equilibration, failed with a `TypeError`. They are now implemented as events: * Species targets are resolved via pattern matching against the generated reaction network. This also removes the requirement of a `pysb.Initial` with an identical pattern for first-period changes, and fixes changes of the same species in multiple experiments. * Target values of later-period changes may depend on the current model state, model parameters, `time`, and parameter-table parameters. * No events are created for periods without changes. * `time` is allowed in first-period target values. Invalid targets now raise: * `pysb.Expression`s and observables are algebraic entities and not valid condition targets. Their changes were silently ignored. * Compartments and parameters that compartment sizes depend on (also via `pysb.Expression`s) are not supported, as BioNetGen evaluates compartment sizes during network generation. * Changes of `pysb.Parameter`s remain unsupported for now. * Entities named `t` (reserved by AMICI) in changes after the first period, as event assignments don't use the renames of the PySB import. The JAX backend raises `NotImplementedError` for changes after the first period, as `pysb2jax` doesn't support events. Relates to AMICI-dev#3068. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PEtab v2 allows `pysb.Parameter`s as condition targets. Since they can't be changed to arbitrary expressions in the PySB model, targeted parameters are handled during the PySB-to-`DEModel` conversion (`_parameter_targets` of `pysb2amici`/`pysb2jax`), similar to the SBML importer: * Parameters that are only changed in the first period become `DEModel` expressions (piecewise in the experiment indicators). Conservation laws remain available. * Parameters that are changed in later periods become constant state variables that are assigned by the period-start events. Changing a parameter used in a `pysb.Initial` after the first period does not affect the species. First-period target values must not refer to other condition targets, as required by the PEtab v2 specification. Such references resulted in invalid or order-dependent model code. Closes AMICI-dev#3068. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dweindl
force-pushed
the
pysb_v2_parameter_targets
branch
from
November 16, 2026 13:11
653831b to
3ef2b7d
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for
pysb.Parameters as PEtab v2 condition targets for PySB models, in the first period and in later periods, including parameters used inpysb.Initials. Based on #3582 (only the last commit is new).Parameter targets are handled during the PySB →
DEModelconversion, similar to how the SBML importer handles parameter targets of events:DEModelexpressions (piecewise over the experiment indicators), so conservation laws keep working;First-period target values must not refer to other condition targets, as required by the PEtab v2 specification. Previously, such references could produce invalid or order-dependent model code.
PEtab test suite: PySB cases 0002, 0005, 0009, 0010 and 0017 were previously skipped and now pass locally (simulations, and gradients compared against finite differences). 0012 (compartment) is still skipped. The test suite has no PySB cases with changes at
t > 0; those are covered bytest_pysb_condition_changes.Closes #3068.
🤖 Generated with Claude Code