From 9cf5823b6814951fb6b118e56be2ea16e85d8a7a Mon Sep 17 00:00:00 2001 From: dilpath Date: Tue, 16 May 2023 15:44:02 +0200 Subject: [PATCH 01/18] add pytest-xdist to setup.cfg --- python/sdist/setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/python/sdist/setup.cfg b/python/sdist/setup.cfg index 26255e77be..f3fcda4ed8 100644 --- a/python/sdist/setup.cfg +++ b/python/sdist/setup.cfg @@ -50,6 +50,7 @@ test = pytest pytest-cov pytest-rerunfailures + pytest-xdist coverage shyaml vis = From 069dbc701d408369082bbe93b73f3940dd44ae62 Mon Sep 17 00:00:00 2001 From: dilpath Date: Tue, 16 May 2023 15:52:28 +0200 Subject: [PATCH 02/18] fail on missing sbml files --- tests/conftest.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 4d2f5521ff..e8fed4ba04 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,6 +14,12 @@ Path(__file__).parent / "sbml-test-suite" / "cases" / "semantic" ) +if not SBML_SEMANTIC_CASES_DIR.exists(): + raise ValueError( + "The SBML semantic cases are missing. You can install them with " + "'AMICI/scripts/run-SBMLTestsuite.sh'." + ) + @pytest.fixture def sbml_semantic_cases_dir() -> Path: From ef1347cb735a76dcc403c5b8daac664aec6f75c4 Mon Sep 17 00:00:00 2001 From: dilpath Date: Tue, 16 May 2023 18:20:41 +0200 Subject: [PATCH 03/18] add fiddy to sbml test suite --- .github/workflows/test_sbml_semantic_test_suite.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test_sbml_semantic_test_suite.yml b/.github/workflows/test_sbml_semantic_test_suite.yml index 68bfaed8e3..c53b2fd597 100644 --- a/.github/workflows/test_sbml_semantic_test_suite.yml +++ b/.github/workflows/test_sbml_semantic_test_suite.yml @@ -36,6 +36,8 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + run: | + pip install git+https://github.com/ICB-DCM/fiddy.git - uses: actions/checkout@v3 with: From fa7ede0a5f1fbd40e64695ac3cfb0d4343b59ba9 Mon Sep 17 00:00:00 2001 From: dilpath Date: Tue, 16 May 2023 19:18:43 +0200 Subject: [PATCH 04/18] add fsa gradient checks --- tests/testSBMLSuite.py | 55 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/tests/testSBMLSuite.py b/tests/testSBMLSuite.py index f11870b60d..3c710497a8 100755 --- a/tests/testSBMLSuite.py +++ b/tests/testSBMLSuite.py @@ -22,7 +22,9 @@ import pandas as pd import pytest from amici.constants import SymbolId -from amici.gradient_check import check_derivatives +from fiddy import MethodId, get_derivative +from fiddy.extensions.amici import reshape, run_amici_simulation_to_cached_functions +from fiddy.success import Consistency from numpy.testing import assert_allclose @@ -76,7 +78,7 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): current_test_path, test_id, model_dir, - generate_sensitivity_code=test_id in sensitivity_check_cases, + generate_sensitivity_code=True, ) settings = read_settings_file(current_test_path, test_id) @@ -96,11 +98,50 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): # record results write_result_file(simulated, test_id, result_path) - # check sensitivities for selected models - if epsilon := sensitivity_check_cases.get(test_id): - solver.setSensitivityOrder(amici.SensitivityOrder.first) - solver.setSensitivityMethod(amici.SensitivityMethod.forward) - check_derivatives(model, solver, epsilon=epsilon) + solver.setSensitivityOrder(amici.SensitivityOrder.first) + + solver.setSensitivityMethod(amici.SensitivityMethod.forward) + ( + amici_function_f, + amici_derivative_f, + structures_f, + ) = run_amici_simulation_to_cached_functions( + amici_model=model, + amici_solver=solver, + ) + rdata_f = amici.runAmiciSimulation(model, solver) + + solver.setSensitivityMethod(amici.SensitivityMethod.adjoint) + ( + amici_function_a, + amici_derivative_a, + structures_a, + ) = run_amici_simulation_to_cached_functions( + amici_model=model, + amici_solver=solver, + ) + rdata_a = amici.runAmiciSimulation(model, solver) + + point = np.asarray(model.getParameters()) + + derivative = get_derivative( + # can use `_f` or `_a` here, should be no difference + function=amici_function_f, + point=point, + sizes=[1e-5, 1e-3, 1e-1], + direction_ids=model.getParameterIds(), + method_ids=[MethodId.FORWARD, MethodId.BACKWARD, MethodId.CENTRAL], + relative_sizes=True, + success_checker=Consistency(), + ) + + derivative_fd = reshape(derivative.value, structures_f["derivative"])["x"] + derivative_fsa = rdata_f.sx + derivative_asa = rdata_a.sllh # currently None, define some objective? + + # could alternatively use a `fiddy.DerivativeCheck` class + if not np.isclose(derivative_fd, derivative_fsa, rtol=1e-2).all(): + raise ValueError("Gradients were not validated.") except amici.sbml_import.SBMLException as err: pytest.skip(str(err)) From 1afa02d89abfb937e9372cb50dc3dd9745ab82ea Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 16 May 2023 21:55:10 +0200 Subject: [PATCH 05/18] run on gha --- .github/workflows/test_sbml_semantic_test_suite.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_sbml_semantic_test_suite.yml b/.github/workflows/test_sbml_semantic_test_suite.yml index c53b2fd597..256781ce9f 100644 --- a/.github/workflows/test_sbml_semantic_test_suite.yml +++ b/.github/workflows/test_sbml_semantic_test_suite.yml @@ -5,6 +5,7 @@ on: - develop - master - release** + - check_grad_sbml_test_suite pull_request: paths: - .github/workflows/test_sbml_semantic_test_suite.yml From 153de46d22b817ee040dbccf5fe48e0376705381 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 16 May 2023 22:00:32 +0200 Subject: [PATCH 06/18] fix yaml --- .github/workflows/test_sbml_semantic_test_suite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sbml_semantic_test_suite.yml b/.github/workflows/test_sbml_semantic_test_suite.yml index 256781ce9f..3683163758 100644 --- a/.github/workflows/test_sbml_semantic_test_suite.yml +++ b/.github/workflows/test_sbml_semantic_test_suite.yml @@ -37,7 +37,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - run: | + - run: | pip install git+https://github.com/ICB-DCM/fiddy.git - uses: actions/checkout@v3 From 175c7167205850a4e6d52b2c522ef1e07e6e7af0 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 16 May 2023 22:10:19 +0200 Subject: [PATCH 07/18] venv --- .github/workflows/test_sbml_semantic_test_suite.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_sbml_semantic_test_suite.yml b/.github/workflows/test_sbml_semantic_test_suite.yml index 3683163758..e874cbc7f9 100644 --- a/.github/workflows/test_sbml_semantic_test_suite.yml +++ b/.github/workflows/test_sbml_semantic_test_suite.yml @@ -37,17 +37,21 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - run: | - pip install git+https://github.com/ICB-DCM/fiddy.git - uses: actions/checkout@v3 with: fetch-depth: 1 + - name: apt run: | sudo apt-get update \ && sudo apt-get install -y swig4.0 libatlas-base-dev + - run: AMICI_PARALLEL_COMPILE=2 ./scripts/installAmiciSource.sh + + - run: | + source build/venv/bin/activate && pip install git+https://github.com/ICB-DCM/fiddy.git + - run: AMICI_PARALLEL_COMPILE=2 ./scripts/run-SBMLTestsuite.sh ${{ matrix.cases }} - name: "Upload artifact: SBML semantic test suite results" From 7dff2b4be939918eaf387daf6c27e9c4350615e0 Mon Sep 17 00:00:00 2001 From: dilpath Date: Thu, 18 May 2023 23:23:38 +0200 Subject: [PATCH 08/18] add fiddy to installAmiciSource; disabling caching for now; fix reshaping; relaxing tolerances --- scripts/installAmiciSource.sh | 3 ++- tests/testSBMLSuite.py | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/installAmiciSource.sh b/scripts/installAmiciSource.sh index 0e4954acfa..b0bffc5896 100755 --- a/scripts/installAmiciSource.sh +++ b/scripts/installAmiciSource.sh @@ -30,6 +30,7 @@ fi pip install -U "setuptools<64" pip install --upgrade pip wheel pip install --upgrade pip scipy matplotlib coverage pytest \ - pytest-cov cmake_build_extension numpy + pytest-cov cmake_build_extension numpy \ + git+https://github.com/ICB-DCM/fiddy.git pip install --verbose -e ${AMICI_PATH}/python/sdist[petab,test,pysb,vis] --no-build-isolation deactivate diff --git a/tests/testSBMLSuite.py b/tests/testSBMLSuite.py index 3c710497a8..15fa99dd1e 100755 --- a/tests/testSBMLSuite.py +++ b/tests/testSBMLSuite.py @@ -108,6 +108,7 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): ) = run_amici_simulation_to_cached_functions( amici_model=model, amici_solver=solver, + cache=False, ) rdata_f = amici.runAmiciSimulation(model, solver) @@ -119,6 +120,7 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): ) = run_amici_simulation_to_cached_functions( amici_model=model, amici_solver=solver, + cache=False, ) rdata_a = amici.runAmiciSimulation(model, solver) @@ -128,19 +130,21 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): # can use `_f` or `_a` here, should be no difference function=amici_function_f, point=point, - sizes=[1e-5, 1e-3, 1e-1], + sizes=[1e-9, 1e-7, 1e-5, 1e-3, 1e-1], direction_ids=model.getParameterIds(), method_ids=[MethodId.FORWARD, MethodId.BACKWARD, MethodId.CENTRAL], relative_sizes=True, success_checker=Consistency(), ) - derivative_fd = reshape(derivative.value, structures_f["derivative"])["x"] + derivative_fd = reshape( + derivative.value.flat, structures_f["derivative"], sensitivities=True + )["x"] derivative_fsa = rdata_f.sx derivative_asa = rdata_a.sllh # currently None, define some objective? # could alternatively use a `fiddy.DerivativeCheck` class - if not np.isclose(derivative_fd, derivative_fsa, rtol=1e-2).all(): + if not np.isclose(derivative_fd, derivative_fsa, rtol=5e-2, atol=5e-2).all(): raise ValueError("Gradients were not validated.") except amici.sbml_import.SBMLException as err: From 4351ca19b426df98396dadf31e3accf6e22c6623 Mon Sep 17 00:00:00 2001 From: dilpath Date: Tue, 23 May 2023 13:35:29 +0200 Subject: [PATCH 09/18] temp skip DAEs (#2102); skip models with no parameters --- tests/testSBMLSuite.py | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/tests/testSBMLSuite.py b/tests/testSBMLSuite.py index 15fa99dd1e..9d9862ed81 100755 --- a/tests/testSBMLSuite.py +++ b/tests/testSBMLSuite.py @@ -98,9 +98,17 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): # record results write_result_file(simulated, test_id, result_path) + # test sensitivities + if not model.getParameters(): + pytest.skip("No parameters -> no sensitivities to check") + + if len(model.idlist): + pytest.skip("DAE -> simulation errors -> no sensis to check") + solver.setSensitivityOrder(amici.SensitivityOrder.first) solver.setSensitivityMethod(amici.SensitivityMethod.forward) + # currently only checking "x"/"sx" for FSA ( amici_function_f, amici_derivative_f, @@ -108,21 +116,23 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): ) = run_amici_simulation_to_cached_functions( amici_model=model, amici_solver=solver, + derivative_variables=["x"], cache=False, ) rdata_f = amici.runAmiciSimulation(model, solver) - solver.setSensitivityMethod(amici.SensitivityMethod.adjoint) - ( - amici_function_a, - amici_derivative_a, - structures_a, - ) = run_amici_simulation_to_cached_functions( - amici_model=model, - amici_solver=solver, - cache=False, - ) - rdata_a = amici.runAmiciSimulation(model, solver) + # solver.setSensitivityMethod(amici.SensitivityMethod.adjoint) + # ( + # amici_function_a, + # amici_derivative_a, + # structures_a, + # ) = run_amici_simulation_to_cached_functions( + # amici_model=model, + # amici_solver=solver, + # derivative_variables=["x"], + # cache=False, + # ) + # rdata_a = amici.runAmiciSimulation(model, solver) point = np.asarray(model.getParameters()) @@ -134,14 +144,14 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): direction_ids=model.getParameterIds(), method_ids=[MethodId.FORWARD, MethodId.BACKWARD, MethodId.CENTRAL], relative_sizes=True, - success_checker=Consistency(), + success_checker=Consistency(rtol=1e-2, atol=1e-4), ) derivative_fd = reshape( derivative.value.flat, structures_f["derivative"], sensitivities=True )["x"] derivative_fsa = rdata_f.sx - derivative_asa = rdata_a.sllh # currently None, define some objective? + # derivative_asa = rdata_a.sllh # currently None, define some objective? # could alternatively use a `fiddy.DerivativeCheck` class if not np.isclose(derivative_fd, derivative_fsa, rtol=5e-2, atol=5e-2).all(): From 2a699e21ef4d849a59a96bcfd02f61909afd0d8b Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 23 May 2023 16:36:37 +0200 Subject: [PATCH 10/18] skip sens.eq. for dae+event --- tests/testSBMLSuite.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/testSBMLSuite.py b/tests/testSBMLSuite.py index 9d9862ed81..d05e34f834 100755 --- a/tests/testSBMLSuite.py +++ b/tests/testSBMLSuite.py @@ -72,13 +72,27 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): columns={c: c.replace(" ", "") for c in results.columns}, inplace=True ) + # TODO remove after https://github.com/AMICI-dev/AMICI/pull/2101 + # and https://github.com/AMICI-dev/AMICI/issues/2106 + # Don't attempt to generate sensitivity code for models with events+algebraic rules, which will fail + sbml_file = find_model_file(current_test_path, test_id) + sbml_document = sbml.SBMLReader().readSBMLFromFile(str(sbml_file)) + sbml_model = sbml_document.getModel() + has_events = sbml_model.getNumEvents() > 0 + has_algebraic_rules = any( + rule.getTypeCode() == sbml.SBML_ALGEBRAIC_RULE + for rule in sbml_model.getListOfRules() + ) + generate_sensitivity_code = not (has_events and has_algebraic_rules) + # ^^^^^^^^ + # setup model model_dir = Path(__file__).parent / "SBMLTestModels" / test_id model, solver, wrapper = compile_model( current_test_path, test_id, model_dir, - generate_sensitivity_code=True, + generate_sensitivity_code=generate_sensitivity_code, ) settings = read_settings_file(current_test_path, test_id) @@ -92,7 +106,7 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): else: raise RuntimeError("Simulation failed unexpectedly") - # verify + # verify simulation results simulated = verify_results(settings, rdata, results, wrapper, model, atol, rtol) # record results @@ -102,11 +116,11 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): if not model.getParameters(): pytest.skip("No parameters -> no sensitivities to check") - if len(model.idlist): + # TODO see https://github.com/AMICI-dev/AMICI/pull/2101 + if not generate_sensitivity_code or sum(model.idlist): pytest.skip("DAE -> simulation errors -> no sensis to check") solver.setSensitivityOrder(amici.SensitivityOrder.first) - solver.setSensitivityMethod(amici.SensitivityMethod.forward) # currently only checking "x"/"sx" for FSA ( From 459c1ad46627031f8801b1e786578f3b46f0dae3 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 23 May 2023 16:46:44 +0200 Subject: [PATCH 11/18] fix semantic suite check --- tests/conftest.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index e8fed4ba04..0d17884527 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -14,12 +14,6 @@ Path(__file__).parent / "sbml-test-suite" / "cases" / "semantic" ) -if not SBML_SEMANTIC_CASES_DIR.exists(): - raise ValueError( - "The SBML semantic cases are missing. You can install them with " - "'AMICI/scripts/run-SBMLTestsuite.sh'." - ) - @pytest.fixture def sbml_semantic_cases_dir() -> Path: @@ -71,6 +65,13 @@ def pytest_generate_tests(metafunc): # Get CLI option cases = metafunc.config.getoption("cases") if cases: + # iff specific case IDs are given and the SBML semantic test suite is not there, we should fail. + if not SBML_SEMANTIC_CASES_DIR.exists(): + raise ValueError( + "The SBML semantic cases are missing. You can install them with " + "'AMICI/scripts/run-SBMLTestsuite.sh'." + ) + # Run selected tests last_id = int(list(get_all_semantic_case_ids())[-1]) test_numbers = sorted(set(parse_selection(cases, last_id))) From 147039b75f5f6d0e0717f3e7a10f9f5ca8f0fa8c Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 23 May 2023 19:01:16 +0200 Subject: [PATCH 12/18] Fix cblas error for models without solver states in combination with forward sensitivities --- src/model.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/model.cpp b/src/model.cpp index d09f383b2a..2aa8ee72ee 100644 --- a/src/model.cpp +++ b/src/model.cpp @@ -1069,15 +1069,17 @@ void Model::getObservableSensitivity( // dydx A[ny,nx_solver] * sx B[nx_solver,nplist] = sy C[ny,nplist] // M K K N M N // lda ldb ldc - setNaNtoZero(derived_state_.dydx_); - setNaNtoZero(derived_state_.sx_); - amici_dgemm( - BLASLayout::colMajor, BLASTranspose::noTrans, BLASTranspose::noTrans, - ny, nplist(), nx_solver, 1.0, derived_state_.dydx_.data(), ny, - derived_state_.sx_.data(), nx_solver, 1.0, derived_state_.dydp_.data(), - ny - ); + if (nx_solver) { + setNaNtoZero(derived_state_.dydx_); + setNaNtoZero(derived_state_.sx_); + amici_dgemm( + BLASLayout::colMajor, BLASTranspose::noTrans, + BLASTranspose::noTrans, ny, nplist(), nx_solver, 1.0, + derived_state_.dydx_.data(), ny, derived_state_.sx_.data(), + nx_solver, 1.0, derived_state_.dydp_.data(), ny + ); + } writeSlice(derived_state_.dydp_, sy); if (always_check_finite_) From 98c19f1cb311b3e87242cc2569de60bc35147912 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 23 May 2023 21:40:48 +0200 Subject: [PATCH 13/18] Expected failures --- tests/testSBMLSuite.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/testSBMLSuite.py b/tests/testSBMLSuite.py index d05e34f834..2b66a25844 100755 --- a/tests/testSBMLSuite.py +++ b/tests/testSBMLSuite.py @@ -84,6 +84,9 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): for rule in sbml_model.getListOfRules() ) generate_sensitivity_code = not (has_events and has_algebraic_rules) + # TODO https://github.com/AMICI-dev/AMICI/issues/2109 + # TODO https://github.com/AMICI-dev/AMICI/issues/2110 + generate_sensitivity_code &= test_id not in {"01240", "01355"} # ^^^^^^^^ # setup model @@ -118,7 +121,7 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): # TODO see https://github.com/AMICI-dev/AMICI/pull/2101 if not generate_sensitivity_code or sum(model.idlist): - pytest.skip("DAE -> simulation errors -> no sensis to check") + pytest.skip("Sensitivity analysis is known to fail.") solver.setSensitivityOrder(amici.SensitivityOrder.first) solver.setSensitivityMethod(amici.SensitivityMethod.forward) From fcd467d143f1c4ec3d2c0a0196d52257aeab534a Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 23 May 2023 22:30:51 +0200 Subject: [PATCH 14/18] Fix DAE check --- tests/testSBMLSuite.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/testSBMLSuite.py b/tests/testSBMLSuite.py index 2b66a25844..1d4030cb48 100755 --- a/tests/testSBMLSuite.py +++ b/tests/testSBMLSuite.py @@ -120,8 +120,10 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): pytest.skip("No parameters -> no sensitivities to check") # TODO see https://github.com/AMICI-dev/AMICI/pull/2101 - if not generate_sensitivity_code or sum(model.idlist): + if not generate_sensitivity_code: pytest.skip("Sensitivity analysis is known to fail.") + if any(id_ == 0 for id_ in model.idlist): + pytest.skip("Sensitivity analysis for DAE is known to fail.") solver.setSensitivityOrder(amici.SensitivityOrder.first) solver.setSensitivityMethod(amici.SensitivityMethod.forward) From f278b8e71e5f55aba918216780168434055cf03e Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 23 May 2023 22:34:03 +0200 Subject: [PATCH 15/18] Fix compilation error for models with events and xdot=0 Fixes #2110 --- python/sdist/amici/de_export.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/sdist/amici/de_export.py b/python/sdist/amici/de_export.py index 46d226b8be..a86ee395b3 100644 --- a/python/sdist/amici/de_export.py +++ b/python/sdist/amici/de_export.py @@ -2001,7 +2001,9 @@ def _compute_equation(self, name: str) -> None: # symbols if not smart_is_zero_matrix(self.eq("stau")[ie]): tmp_eq += smart_multiply( - (self.sym("xdot_old") - self.sym("xdot")), + (self.sym("xdot_old") - self.sym("xdot")) + if not smart_is_zero_matrix(self.eq("xdot")) + else self.sym("xdot_old"), self.sym("stau").T, ) From c9f37da0cd44bcfc843c5c6d175762e33c37a5ef Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 23 May 2023 22:36:14 +0200 Subject: [PATCH 16/18] Unskip 01355 --- tests/testSBMLSuite.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/testSBMLSuite.py b/tests/testSBMLSuite.py index 1d4030cb48..8759cdb4b6 100755 --- a/tests/testSBMLSuite.py +++ b/tests/testSBMLSuite.py @@ -85,8 +85,7 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): ) generate_sensitivity_code = not (has_events and has_algebraic_rules) # TODO https://github.com/AMICI-dev/AMICI/issues/2109 - # TODO https://github.com/AMICI-dev/AMICI/issues/2110 - generate_sensitivity_code &= test_id not in {"01240", "01355"} + generate_sensitivity_code &= test_id not in {"01240"} # ^^^^^^^^ # setup model From af7fd07f9be675b6bd1393f9d0362f436ff15362 Mon Sep 17 00:00:00 2001 From: dilpath Date: Wed, 24 May 2023 01:12:21 +0200 Subject: [PATCH 17/18] additional eps --- tests/testSBMLSuite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testSBMLSuite.py b/tests/testSBMLSuite.py index 8759cdb4b6..c2ea864d35 100755 --- a/tests/testSBMLSuite.py +++ b/tests/testSBMLSuite.py @@ -158,7 +158,7 @@ def test_sbml_testsuite_case(test_number, result_path, sbml_semantic_cases_dir): # can use `_f` or `_a` here, should be no difference function=amici_function_f, point=point, - sizes=[1e-9, 1e-7, 1e-5, 1e-3, 1e-1], + sizes=[1e-9, 1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1], direction_ids=model.getParameterIds(), method_ids=[MethodId.FORWARD, MethodId.BACKWARD, MethodId.CENTRAL], relative_sizes=True, From 179be29787cf8345b0413b9413c0f83e23571eae Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 27 Feb 2024 21:11:03 +0100 Subject: [PATCH 18/18] Update test_sbml_semantic_test_suite.yml --- .github/workflows/test_sbml_semantic_test_suite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_sbml_semantic_test_suite.yml b/.github/workflows/test_sbml_semantic_test_suite.yml index f3e0432dfc..500ce07b7e 100644 --- a/.github/workflows/test_sbml_semantic_test_suite.yml +++ b/.github/workflows/test_sbml_semantic_test_suite.yml @@ -45,9 +45,9 @@ jobs: - name: Install apt dependencies uses: ./.github/actions/install-apt-dependencies + - run: AMICI_PARALLEL_COMPILE="" ./scripts/installAmiciSource.sh - run: | source build/venv/bin/activate && pip install git+https://github.com/ICB-DCM/fiddy.git - - run: AMICI_PARALLEL_COMPILE="" ./scripts/installAmiciSource.sh - run: AMICI_PARALLEL_COMPILE="" ./scripts/run-SBMLTestsuite.sh ${{ matrix.cases }} - name: "Upload artifact: SBML semantic test suite results"