Skip to content

Commit 29a9c79

Browse files
authored
CI: Update model_constant_species (#2886)
* Convert to antimony * Parameterize initial concentration (`init_substrate`) to test non-zero initial state sensitivities
1 parent 772d86b commit 29a9c79

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

python/tests/conftest.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
MODEL_PRESIMULATION_XML = (
2121
EXAMPLES_DIR / "example_presimulation" / "model_presimulation.xml"
2222
)
23-
MODEL_CONSTANT_SPECIES_XML = (
24-
EXAMPLES_DIR / "example_steady_states" / "model_constant_species.xml"
25-
)
2623

2724

2825
@pytest.fixture(scope="session")

python/tests/test_compare_conservation_laws_sbml.py

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import pytest
77
from numpy.testing import assert_allclose, assert_array_equal
88
from amici.testing import skip_on_valgrind
9-
from conftest import MODEL_CONSTANT_SPECIES_XML
109

1110

1211
@pytest.fixture
@@ -44,8 +43,40 @@ def edata_fixture():
4443

4544
@pytest.fixture(scope="session")
4645
def models():
47-
# SBML model we want to import
48-
sbml_importer = amici.SbmlImporter(MODEL_CONSTANT_SPECIES_XML)
46+
from amici.antimony_import import antimony2sbml
47+
48+
ant_model = """model *model_constant_species()
49+
const compartment compartment_ = 1;
50+
var species substrate in compartment_ = 0;
51+
const species $enzyme in compartment_;
52+
var species complex in compartment_ = 0;
53+
species product in compartment_ = 0;
54+
55+
var substrate_product := complex + product + substrate;
56+
57+
creation: => substrate; compartment_*(synthesis_substrate + k_create);
58+
binding: substrate + $enzyme -> complex; compartment_*(k_bind*substrate*enzyme - k_unbind*complex);
59+
conversion: complex => $enzyme + product; compartment_*k_convert*complex;
60+
decay: product => ; compartment_*k_decay*product;
61+
62+
enzyme = init_enzyme;
63+
substrate = init_substrate;
64+
65+
const init_enzyme = 2;
66+
const init_substrate = 5;
67+
const synthesis_substrate = 0;
68+
const k_bind = 10;
69+
const k_unbind = 1;
70+
const k_convert = 10;
71+
const k_create = 2;
72+
const k_decay = 1;
73+
74+
unit volume = 1e-3 litre;
75+
unit substance = 1e-3 mole;
76+
end"""
77+
sbml_importer = amici.SbmlImporter(
78+
antimony2sbml(ant_model), from_file=False
79+
)
4980

5081
# Name of the model that will also be the name of the python module
5182
model_name = model_output_dir = "model_constant_species"

0 commit comments

Comments
 (0)