Skip to content

Commit

Permalink
Warn if ASA is used in combination with events.
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed May 17, 2023
1 parent 479900a commit 8caedc6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions python/sdist/amici/swig_wrappers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Convenience wrappers for the swig interface"""
import logging
import sys

import warnings
from contextlib import contextmanager, suppress
from typing import Any, Dict, List, Optional, Sequence, Union

Expand Down Expand Up @@ -102,6 +104,17 @@ def runAmiciSimulation(
:returns:
ReturnData object with simulation results
"""
if (
model.ne > 0
and solver.getSensitivityMethod()
== amici_swig.SensitivityMethod.adjoint
and solver.getSensitivityOrder() == amici_swig.SensitivityOrder.first
):
warnings.warn(
"Adjoint sensitivity analysis for model with events has not been thoroughly tested. "
"Sensitivities might be wrong. Tracked at https://github.com/AMICI-dev/AMICI/issues/18."
)

with _capture_cstdout():
rdata = amici_swig.runAmiciSimulation(
_get_ptr(solver), _get_ptr(edata), _get_ptr(model)
Expand Down Expand Up @@ -152,6 +165,17 @@ def runAmiciSimulations(
:returns: list of simulation results
"""
if (
model.ne > 0
and solver.getSensitivityMethod()
== amici_swig.SensitivityMethod.adjoint
and solver.getSensitivityOrder() == amici_swig.SensitivityOrder.first
):
warnings.warn(
"Adjoint sensitivity analysis for model with events has not been thoroughly tested. "
"Sensitivities might be wrong. Tracked at https://github.com/AMICI-dev/AMICI/issues/18."
)

with _capture_cstdout():
edata_ptr_vector = amici_swig.ExpDataPtrVector(edata_list)
rdata_ptr_list = amici_swig.runAmiciSimulations(
Expand Down

0 comments on commit 8caedc6

Please sign in to comment.