Skip to content

Declare placeholder parameters per measurement channel - #3553

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

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

Conversation

@dweindl

@dweindl dweindl commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

SbmlImporter no longer treats symbols named noiseParameter{n} / observableParameter{n} in observation model formulas as placeholder parameters. Instead, placeholders are declared on the respective MeasurementChannel via the new noise_placeholders and observable_placeholders arguments. The PEtab v1 importer declares the noiseParameter{n}_{observableId} placeholders it already rewrites for JAX, the PEtab v2 importer the explicitly declared noisePlaceholders / observablePlaceholders. This way, the core importer doesn't depend on PEtab naming conventions.

Declaring placeholders per measurement channel, rather than per import call, keeps the information which placeholder belongs to which observable. This is needed for supporting measurement-specific placeholders in the SUNDIALS backend later on.

Placeholder parameters are currently only used by the JAX backend, which binds their values by position. Therefore:

  • sbml2jax requires placeholder identifiers of the form noiseParameter{n} / observableParameter{n}, with contiguous indices starting at 1
  • sbml2amici, the PySB importer, and event-resolved measurement channels raise NotImplementedError if placeholders are declared
  • declaring a placeholder with the ID of a model entity is an error

PEtab-based imports are not affected, except for one corner case: if a PEtab v2 observable declares a placeholder that doesn't occur in its formula, simulating the JAX model previously failed with ValueError: too many values to unpack. The importer now declares all placeholders of an observable, so that the values are bound by position.

Only direct sbml2jax calls that relied on the name-based detection need to declare the placeholders now (see changelog); this is not known to be used outside the PEtab importers.

Relates to #3294.

🤖 Generated with Claude Code

@dweindl dweindl added JAX Related to the JAX-backend. PEtab PEtab-import related SBML SBML import related breaking change Issue changes API in backwards-incompatible way refactoring labels Nov 14, 2026
@codecov

codecov Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.75%. Comparing base (7fb8c57) to head (ad29a5e).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3553      +/-   ##
==========================================
+ Coverage   80.71%   80.75%   +0.03%     
==========================================
  Files         331      331              
  Lines       23688    23737      +49     
  Branches     1674     1674              
==========================================
+ Hits        19120    19169      +49     
  Misses       4562     4562              
  Partials        6        6              
Flag Coverage Δ
cpp 75.33% <85.71%> (+0.01%) ⬆️
cpp_python 34.88% <42.85%> (+0.01%) ⬆️
petab 47.28% <100.00%> (+0.13%) ⬆️
petab_sciml 16.56% <50.00%> (+0.05%) ⬆️
petab_sciml_benchmarks 15.17% <50.00%> (+0.05%) ⬆️
python 73.00% <97.61%> (+0.03%) ⬆️
sbmlsuite 49.81% <50.00%> (+0.09%) ⬆️

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

Files with missing lines Coverage Δ
python/sdist/amici/importers/_observation_model.py 98.61% <100.00%> (+0.19%) ⬆️
...hon/sdist/amici/importers/petab/_petab_importer.py 88.80% <100.00%> (+0.08%) ⬆️
...hon/sdist/amici/importers/petab/v1/_sbml_import.py 97.97% <100.00%> (+0.30%) ⬆️
python/sdist/amici/importers/pysb/__init__.py 94.72% <ø> (ø)
python/sdist/amici/importers/sbml/__init__.py 94.67% <100.00%> (+0.02%) ⬆️
python/sdist/amici/importers/utils.py 90.75% <100.00%> (+0.09%) ⬆️
python/tests/petab_/test_petab_v2.py 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dweindl
dweindl force-pushed the petab_v1_placeholders branch from 3807cea to 1f9a4a4 Compare November 15, 2026 11:40
@dweindl
dweindl marked this pull request as ready for review November 15, 2026 13:51
@dweindl
dweindl requested a review from a team as a code owner November 15, 2026 13:51
@dweindl
dweindl marked this pull request as draft November 15, 2026 18:15
@dweindl
dweindl force-pushed the petab_v1_placeholders branch from 1f9a4a4 to bdf55f9 Compare November 15, 2026 21:52
@dweindl dweindl changed the title Pass placeholder parameters explicitly instead of detecting them by name Declare placeholder parameters per measurement channel Nov 15, 2026
`SbmlImporter` no longer treats symbols named `noiseParameter{n}` /
`observableParameter{n}` in observation model formulas as placeholder
parameters. Instead, placeholders are declared on the respective
`MeasurementChannel` via the new `noise_placeholders` and
`observable_placeholders` arguments. The PEtab v1 and v2 importers
declare them for JAX imports. This way, the core importer doesn't
depend on PEtab naming conventions, and the information which
placeholder belongs to which observable is kept.

Placeholders are currently only used by the JAX backend, which binds
their values by position:

* `sbml2jax` requires identifiers `noiseParameter{n}` /
  `observableParameter{n}` with contiguous indices starting at 1
* `sbml2amici`, the PySB importer, and event-resolved measurement
  channels raise `NotImplementedError` if placeholders are declared
* declaring a placeholder with the ID of a model entity is an error

Relates to AMICI-dev#3294.

Co-Authored-By: Claude <noreply@anthropic.com>
@dweindl
dweindl force-pushed the petab_v1_placeholders branch from bdf55f9 to ad29a5e Compare November 16, 2026 12:05
@dweindl
dweindl marked this pull request as ready for review November 16, 2026 12:06
@dweindl
dweindl marked this pull request as draft November 16, 2026 12:06
@dweindl
dweindl marked this pull request as ready for review November 16, 2026 13:04
@dweindl dweindl self-assigned this Nov 16, 2026

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

breaking change Issue changes API in backwards-incompatible way JAX Related to the JAX-backend. PEtab PEtab-import related refactoring SBML SBML import related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant