Skip to content

Fix event output derivatives in the fiddy adapter - #3589

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

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

Conversation

@dweindl

@dweindl dweindl commented Nov 18, 2026

Copy link
Copy Markdown
Member

Fix the derivatives of event outputs in amici.adapters.fiddy.run_simulation_to_function_and_derivative.

sz, srz and ssigmaz have the shape nmaxevent x nplist x nz, but derivative_parameter_dimension listed the parameter axis of srz as 2 and had no entries for sz and ssigmaz. The derivatives of z and sigmaz therefore failed with a KeyError, and the derivative of rz was taken along the event output axis (wrong values or an IndexError).

The new test checks z, rz and sigmaz against finite differences. It uses a time-triggered event, as sz does not account for the parameter dependence of state-dependent event times (#3361); once that is fixed, the test can also cover a state-dependent event. The event output for the event that does not trigger is constant, as AMICI sets z to the output at the last time point but sz to 0 for events that did not occur.

Fixes #3571.

🤖 Generated with Claude Code

`sz`, `srz` and `ssigmaz` have the shape `nmaxevent x nplist x nz`, but
`derivative_parameter_dimension` listed the parameter axis of `srz` as 2
and had no entries for `sz` and `ssigmaz`. The derivatives of `z` and
`sigmaz` therefore failed with a `KeyError`, and the derivative of `rz`
was taken along the event output axis.

The test uses a time-triggered event, as `sz` does not account for the
parameter dependence of state-dependent event times (AMICI-dev#3361).

Fixes AMICI-dev#3571.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

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

❗ There is a different number of reports uploaded between BASE (7cb3c09) and HEAD (6f44a62). Click for more details.

HEAD has 19 uploads less than BASE
Flag BASE (7cb3c09) HEAD (6f44a62)
petab_sciml_benchmarks 2 1
petab_sciml 2 1
petab 4 2
python 16 4
cpp_python 2 1
cpp 2 0
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #3589       +/-   ##
===========================================
- Coverage   80.75%   49.99%   -30.77%     
===========================================
  Files         331      331               
  Lines       23699    23696        -3     
  Branches     1674     1674               
===========================================
- Hits        19139    11847     -7292     
- Misses       4554    11751     +7197     
- Partials        6       98       +92     
Flag Coverage Δ
cpp ?
cpp_python 34.86% <ø> (ø)
petab 47.17% <ø> (ø)
petab_sciml 16.50% <ø> (ø)
petab_sciml_benchmarks 15.11% <ø> (ø)
python 38.87% <ø> (-34.14%) ⬇️
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/adapters/fiddy.py 47.32% <ø> (-42.75%) ⬇️

... and 216 files with indirect coverage changes

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

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fiddy adapter: wrong parameter axis for srz; sz/ssigmaz unsupported

1 participant