Skip to content

No event trigger reinitialization after pre-equilibration and pre-simulation#2921

Merged
dweindl merged 1 commit intoAMICI-dev:mainfrom
dweindl:preserve_heaviside
Jul 25, 2025
Merged

No event trigger reinitialization after pre-equilibration and pre-simulation#2921
dweindl merged 1 commit intoAMICI-dev:mainfrom
dweindl:preserve_heaviside

Conversation

@dweindl
Copy link
Member

@dweindl dweindl commented Jul 22, 2025

Meanwhile, events are handled during pre-equilibration and pre-simulation. So far, SBML's event.trigger.initialValue was applied at the beginning of each period. However, this should only be applied at the beginning of the very first simulation period. This is fixed and tested here.

Closes #2918.

@dweindl dweindl self-assigned this Jul 22, 2025
@codecov
Copy link

codecov bot commented Jul 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.99%. Comparing base (ddf9b72) to head (de72ad9).
⚠️ Report is 50 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2921      +/-   ##
==========================================
- Coverage   79.58%   78.99%   -0.59%     
==========================================
  Files         362      362              
  Lines       23128    23142      +14     
  Branches     1587     1590       +3     
==========================================
- Hits        18406    18282     -124     
- Misses       4711     4849     +138     
  Partials       11       11              
Flag Coverage Δ
cpp 74.93% <100.00%> (-0.02%) ⬇️
cpp_python 33.18% <78.57%> (+0.01%) ⬆️
petab 38.82% <7.69%> (-0.03%) ⬇️
python 73.78% <76.92%> (-0.02%) ⬇️
sbmlsuite-jax ?

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

Files with missing lines Coverage Δ
include/amici/model.h 71.42% <ø> (ø)
src/forwardproblem.cpp 90.62% <100.00%> (+0.26%) ⬆️
src/model.cpp 87.11% <100.00%> (+0.05%) ⬆️

... and 10 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 preserve_heaviside branch from c83019c to cab7c63 Compare July 22, 2025 06:37
@dweindl dweindl marked this pull request as ready for review July 22, 2025 07:35
@dweindl dweindl requested a review from a team as a code owner July 22, 2025 07:35
@dweindl dweindl force-pushed the preserve_heaviside branch from cab7c63 to 0a75a44 Compare July 22, 2025 11:17
Copy link
Member

@FFroehlich FFroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens with events that would be triggered by resetting t_f to t_0?

# E1 & E2 will both trigger during pre-equilibration and main
# simulation (Heaviside is reset after pre-equilibration)
# E1 & E2 will only trigger during pre-equilibration
# (Heaviside is not reset after pre-equilibration)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is the Heaviside function here? I do think we should reset Heaviside functions, i.e. not reapply trigger initialisation but do reinitialise trigger function states.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yeah, no Heaviside function there. I meant h.
I don't think I understand your suggestion. You suggest replacing reinitializing h by what?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be good to test that we are properly reinitialising Heaviside variables, if we aren't already doing so.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that is covered in the tests here.

@dweindl
Copy link
Member Author

dweindl commented Jul 25, 2025

What happens with events that would be triggered by resetting t_f to t_0?

I am not sure I understand which situation you mean. Wouldn't that be kind of what is tested with E2: at some_time >= 10 and time < 1, t0 = true:? The second condition relies on time being reset. I am not sure how to test that more directly.

@dweindl dweindl force-pushed the preserve_heaviside branch from 0a75a44 to 8af3236 Compare July 25, 2025 11:52
…ulation

Meanwhile, events are handled during pre-equilibration and pre-simulation.
So far, SBML's `event.trigger.initialValue` was applied at the beginning of each period.
However, this should only be applied at the beginning of the very first simulation period.
This is fixed and tested here.

Closes AMICI-dev#2918.
@dweindl dweindl force-pushed the preserve_heaviside branch from 8af3236 to de72ad9 Compare July 25, 2025 14:30
@dweindl dweindl merged commit e430afc into AMICI-dev:main Jul 25, 2025
22 of 24 checks passed
@dweindl dweindl deleted the preserve_heaviside branch July 25, 2025 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document/fix reinitialization of Heavisides after pre-equilibration and pre-simulation

2 participants