Skip to content

Commit

Permalink
Update to changed amici interface (#37)
Browse files Browse the repository at this point in the history

Update to changed amici interface to prevent DeprecationWarnings.

Fix some RTD/sphinx issues.
  • Loading branch information
dweindl authored Sep 30, 2024
1 parent 02aa833 commit 34f8f73
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
5 changes: 4 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]


autodoc_mock_imports = ["amici", "amici.amici", "amici.petab_objective"]
autodoc_mock_imports = [
"amici", "amici.amici", "amici.petab", "amici.petab.simulations",
"amici.petab.parameter_mapping", "amici.petab.conditions"
]
for mod_name in autodoc_mock_imports:
sys.modules[mod_name] = mock.MagicMock()

Expand Down
16 changes: 8 additions & 8 deletions fiddy/extensions/amici/amici.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
from typing import Any, Callable, Dict, List, Tuple

import amici
import amici.petab_objective
import amici.petab.simulations
import numpy as np
import petab.v1 as petab
from amici.petab_objective import ( # RDATAS,
LLH,
SLLH,
create_edatas,
create_parameter_mapping,
)
from amici.petab.parameter_mapping import create_parameter_mapping
from amici.petab.simulations import LLH, SLLH
from amici.petab.conditions import create_edatas
from petab.v1.C import LIN, LOG, LOG10

from ...constants import Type
Expand Down Expand Up @@ -331,7 +328,7 @@ def simulate_petab_to_cached_functions(
parameter_ids = list(petab_problem.parameter_df.index)

if simulate_petab is None:
simulate_petab = amici.petab_objective.simulate_petab
simulate_petab = amici.petab.simulations.simulate_petab

edatas = None
if precreate_edatas:
Expand Down Expand Up @@ -391,6 +388,9 @@ def function(point: Type.POINT):

def derivative(point: Type.POINT) -> Type.POINT:
result = simulate_petab_full(point, order=amici.SensitivityOrder.first)
if result[SLLH] is None:
raise RuntimeError("Simulation failed.")

sllh = np.array(
[result[SLLH][parameter_id] for parameter_id in parameter_ids]
)
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ all =
%(examples)s
%(tests)s
doc =
sphinx
sphinx<8
docutils<0.19
sphinx_rtd_theme
sphinx-autodoc-typehints
mock
Expand Down

0 comments on commit 34f8f73

Please sign in to comment.