Skip to content

Add equinox module import support for petab sciml problems#3179

Merged
BSnelling merged 17 commits into
mainfrom
bes/equinox_petab_import
Jun 16, 2026
Merged

Add equinox module import support for petab sciml problems#3179
BSnelling merged 17 commits into
mainfrom
bes/equinox_petab_import

Conversation

@BSnelling

Copy link
Copy Markdown
Collaborator

No description provided.

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.42%. Comparing base (6f7dec9) to head (0735d8d).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3179   +/-   ##
=======================================
  Coverage   77.41%   77.42%           
=======================================
  Files         317      317           
  Lines       20897    20903    +6     
  Branches     1483     1483           
=======================================
+ Hits        16178    16184    +6     
  Misses       4711     4711           
  Partials        8        8           
Flag Coverage Δ
cpp 71.56% <100.00%> (+1.69%) ⬆️
cpp_python 36.71% <0.00%> (-0.02%) ⬇️
petab 46.78% <0.00%> (-0.02%) ⬇️
petab_sciml 15.54% <57.14%> (+0.01%) ⬆️
python 68.31% <100.00%> (+1.69%) ⬆️

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

Files with missing lines Coverage Δ
python/sdist/amici/exporters/jax/nn.py 93.92% <100.00%> (+0.14%) ⬆️
...hon/sdist/amici/importers/petab/_petab_importer.py 87.84% <100.00%> (+0.03%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@BSnelling BSnelling force-pushed the bes/equinox_petab_import branch from 88fe5b6 to 924be4c Compare June 9, 2026 11:20
strategy:
matrix:
python-version: [ "3.11" ]
python-version: [ "3.12" ]

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The reasoning for this is that petab-sciml v0.1 will most likely specify python >=3.12 due to numpy requirements: PEtab-dev/petab_sciml#83

Is there a specific requirement to continue 3.11 support in AMICI? From another dependency for example?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a specific requirement to continue 3.11 support in AMICI? From another dependency for example?

No, there isn't. It's time to update amici's python requirement, I'll do that on a separate PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @dweindl!

@BSnelling BSnelling marked this pull request as ready for review June 9, 2026 14:24
@BSnelling BSnelling requested a review from a team as a code owner June 9, 2026 14:24
@BSnelling BSnelling force-pushed the bes/equinox_petab_import branch from 924be4c to 5918a04 Compare June 10, 2026 09:21
if isinstance(nn_model, Path):
copyfile(nn_model, filename)
return

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add Path to type annotation and add processing when nn_model is string? Do we want to refuse overwriting unless something like force=True is specified?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Added string handling and annotation.

On the overwriting, I think it is sufficient that the output directory is specified as a required arg. If we added a force keyword we'd run into a "pass-through keyword" trap. We have the force_import keyword in PetabImporter.import_module, which calls SbmlImporter and ODEExporter and finally this function generate_equinox. The kwarg would just get funnelled through all those classes.

hybridization["net1"]["frozen_layers"],
)

assert os.path.isfile(pi.output_dir / "net1.py")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

would be nice to add some regression tests against model outputs here to also make sure the model can be called

@BSnelling BSnelling force-pushed the bes/equinox_petab_import branch from c27db5e to 020c763 Compare June 16, 2026 08:48
@BSnelling BSnelling added this pull request to the merge queue Jun 16, 2026
Merged via the queue into main with commit 408bcd2 Jun 16, 2026
30 of 31 checks passed
@BSnelling BSnelling deleted the bes/equinox_petab_import branch June 16, 2026 12:10
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.

3 participants