Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Dec 4, 2023
1 parent b192707 commit 8ae73aa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions include/amici/serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ void serialize(Archive& ar, amici::Model& m, unsigned int const /*version*/) {
ar& m.sigma_res_;
ar& m.steadystate_computation_mode_;
ar& m.steadystate_sensitivity_mode_;
ar& m.state_independent_events_;
}

/**
Expand Down
1 change: 1 addition & 0 deletions matlab/@amimodel/generateC.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ function generateC(this)
fprintf(fid,[' ' num2str(this.nz) ',\n']);
fprintf(fid,[' ' num2str(this.nztrue) ',\n']);
fprintf(fid,[' ' num2str(this.nevent) ',\n']);
fprintf(fid,[' ' num2str(this.nevent) ',\n']);
fprintf(fid,[' 0,\n']);
fprintf(fid,[' ' num2str(this.ng) ',\n']);
fprintf(fid,[' ' num2str(this.nw) ',\n']);
Expand Down
19 changes: 7 additions & 12 deletions python/tests/test_events.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
"""Tests for SBML events, including piecewise expressions."""
from copy import deepcopy

import amici
import numpy as np
import pytest
from amici.antimony_import import antimony2amici
from amici.gradient_check import check_derivatives
from amici.testing import TemporaryDirectoryWinSafe as TemporaryDirectory
from amici.testing import skip_on_valgrind
from util import (
check_trajectories_with_forward_sensitivities,
Expand Down Expand Up @@ -706,25 +710,15 @@ def expm(x):
return np.array(expm(x).tolist()).astype(float)


import amici
from amici.antimony_import import antimony2amici
from amici.gradient_check import check_derivatives
from amici.testing import TemporaryDirectoryWinSafe as TemporaryDirectory


def test_handling_of_fixed_time_point_event_triggers():
"""If this example requires changes, please also update documentation/python_interface.rst."""
import os

os.environ["ENABLE_AMICI_DEBUGGING"] = "TRUE"
"""Test handling of events without solver-tracked root functions."""
ant_model = """
model test_events_time_based
event_target = 0
bolus = 1
at (time > 1): event_target = 1
at (time > 2): event_target = event_target + bolus
at (time > 3): event_target = 3
end
"""
module_name = "test_events_time_based"
Expand All @@ -739,6 +733,8 @@ def test_handling_of_fixed_time_point_event_triggers():
module_name=module_name, module_path=outdir
)
amici_model = model_module.getModel()
assert amici_model.ne == 3
assert amici_model.ne_solver == 0
amici_model.setTimepoints(np.linspace(0, 4, 200))
amici_solver = amici_model.getSolver()
rdata = amici.runAmiciSimulation(amici_model, amici_solver)
Expand All @@ -748,5 +744,4 @@ def test_handling_of_fixed_time_point_event_triggers():
assert (rdata.x[(rdata.ts >= 2) & (rdata.ts < 3)] == 2).all()
assert (rdata.x[(rdata.ts >= 3)] == 3).all()

# TODO sensitivities
check_derivatives(amici_model, amici_solver, edata=None)
1 change: 1 addition & 0 deletions python/tests/test_swig_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def test_unhandled_settings(pysb_example_presimulation_module):
"setParametersByIdRegex",
"setParametersByNameRegex",
"setInitialStateSensitivities",
"get_trigger_timepoints",
]
from amici.swig_wrappers import model_instance_settings

Expand Down

0 comments on commit 8ae73aa

Please sign in to comment.