Skip to content

Reject event assignments to non-states, allow PySB events with conservation laws - #3581

Open
dweindl wants to merge 1 commit into
AMICI-dev:mainfrom
dweindl:pysb_v2_event_groundwork
Open

dweindl wants to merge 1 commit into
AMICI-dev:mainfrom
dweindl:pysb_v2_event_groundwork

Conversation

@dweindl

@dweindl dweindl commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Groundwork for PEtab v2 condition changes in later periods of PySB models (#3068):

  • Event assignments to entities that are not (solver) state variables now raise a ValueError in DEModel.generate_basic_variables, i.e., during model import before code generation. Previously, such assignments were silently dropped. Adds Event.assignment_targets and Event.check_assignment_targets.
  • pysb2amici now disables conservation laws with a warning for models with events, as sbml2amici does, instead of raising NotImplementedError.

First of three stacked PRs: this one → #3582 → #3583.

🤖 Generated with Claude Code

@dweindl dweindl added PySB PySB import related events related to handing discrete events labels Nov 16, 2026
@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.71%. Comparing base (7cb3c09) to head (e8bce99).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3581      +/-   ##
==========================================
- Coverage   80.75%   80.71%   -0.05%     
==========================================
  Files         331      331              
  Lines       23699    23707       +8     
  Branches     1674     1674              
==========================================
- Hits        19139    19134       -5     
- Misses       4554     4567      +13     
  Partials        6        6              
Flag Coverage Δ
cpp 75.27% <100.00%> (-0.07%) ⬇️
cpp_python 34.88% <100.00%> (+0.02%) ⬆️
petab 47.19% <100.00%> (+0.02%) ⬆️
petab_sciml 16.52% <50.00%> (+0.01%) ⬆️
petab_sciml_benchmarks 15.13% <50.00%> (+0.01%) ⬆️
python 72.96% <100.00%> (-0.05%) ⬇️
sbmlsuite 49.72% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
python/sdist/amici/_symbolic/de_model.py 94.03% <100.00%> (+0.01%) ⬆️
...ython/sdist/amici/_symbolic/de_model_components.py 96.77% <100.00%> (+0.10%) ⬆️
python/sdist/amici/importers/pysb/__init__.py 94.72% <ø> (ø)

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dweindl
dweindl force-pushed the pysb_v2_event_groundwork branch from cac9ca9 to 4fbc7ab Compare November 16, 2026 13:11
@dweindl dweindl self-assigned this Nov 16, 2026
* 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>
@dweindl
dweindl force-pushed the pysb_v2_event_groundwork branch from 4fbc7ab to e8bce99 Compare November 17, 2026 06:59
@dweindl
dweindl marked this pull request as ready for review November 17, 2026 08:11
@dweindl
dweindl requested a review from a team as a code owner November 17, 2026 08:11

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

events related to handing discrete events PySB PySB import related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant