From 3a3a1ab35e60a528f40583ba77762d79543abdc3 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 1 Jul 2024 11:06:04 +0200 Subject: [PATCH] v1 --- .github/workflows/test_benchmark_collection_models.yml | 2 +- .github/workflows/test_petab_test_suite.yml | 2 +- pytest.ini | 2 -- python/sdist/amici/petab/cli/import_petab.py | 2 +- python/sdist/amici/petab/conditions.py | 4 ++-- python/sdist/amici/petab/import_helpers.py | 6 +++--- python/sdist/amici/petab/parameter_mapping.py | 8 ++++---- python/sdist/amici/petab/petab_import.py | 4 ++-- python/sdist/amici/petab/petab_problem.py | 4 ++-- python/sdist/amici/petab/pysb_import.py | 6 +++--- python/sdist/amici/petab/sbml_import.py | 4 ++-- python/sdist/amici/petab/simulations.py | 4 ++-- python/sdist/amici/petab/simulator.py | 2 +- python/sdist/amici/petab/util.py | 8 ++++---- python/tests/test_petab_import.py | 6 +++--- python/tests/test_petab_objective.py | 2 +- python/tests/test_petab_simulate.py | 2 +- tests/benchmark-models/test_petab_model.py | 4 ++-- 18 files changed, 35 insertions(+), 37 deletions(-) diff --git a/.github/workflows/test_benchmark_collection_models.yml b/.github/workflows/test_benchmark_collection_models.yml index f327cb4d4f..9ebcc18022 100644 --- a/.github/workflows/test_benchmark_collection_models.yml +++ b/.github/workflows/test_benchmark_collection_models.yml @@ -53,7 +53,7 @@ jobs: $(ls -t python/sdist/dist/amici-*.tar.gz | head -1)[petab,test,vis] - run: | - python3 -m pip install git+https://github.com/dweindl/libpetab-python.git@v1_subpackage_271 \ + python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@develop \ && python3 -m pip install -U sympy # retrieve test models diff --git a/.github/workflows/test_petab_test_suite.yml b/.github/workflows/test_petab_test_suite.yml index cedb776018..1292c57292 100644 --- a/.github/workflows/test_petab_test_suite.yml +++ b/.github/workflows/test_petab_test_suite.yml @@ -71,7 +71,7 @@ jobs: - name: Install petab run: | source ./venv/bin/activate \ - && python3 -m pip install git+https://github.com/dweindl/libpetab-python.git@v1_subpackage_271 \ + && python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@develop \ && python3 -m pip install sympy>=1.12.1 diff --git a/pytest.ini b/pytest.ini index 9ccc3b143c..7aee1687bc 100644 --- a/pytest.ini +++ b/pytest.ini @@ -3,7 +3,6 @@ addopts = -vv --strict-markers filterwarnings = -# error # amici ignore:Conservation laws for non-constant species in models with RateRules are currently not supported and will be turned off.:UserWarning ignore:Conservation laws for non-constant species in models with Species-AssignmentRules are currently not supported and will be turned off.:UserWarning @@ -13,7 +12,6 @@ filterwarnings = ignore:.*inspect.getargspec\(\) is deprecated.*:DeprecationWarning # pysb warnings ignore:the imp module is deprecated in favour of importlib.*:DeprecationWarning:pysb\.core - ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working.*:DeprecationWarning:pysb\.core ignore:Model.initial_conditions will be removed in a future version. Instead, you can get a list of Initial objects with Model.initials.:DeprecationWarning:pysb\.core # https://github.com/pytest-dev/pytest-xdist/issues/825#issuecomment-1292283870 ignore:The --rsyncdir command line argument and rsyncdirs config variable are deprecated.:DeprecationWarning diff --git a/python/sdist/amici/petab/cli/import_petab.py b/python/sdist/amici/petab/cli/import_petab.py index 39fa9b9bfe..b124b4d98b 100644 --- a/python/sdist/amici/petab/cli/import_petab.py +++ b/python/sdist/amici/petab/cli/import_petab.py @@ -3,7 +3,7 @@ import petab from ..petab_import import import_model_sbml -from petab.models.sbml_model import SbmlModel +from petab.v1.models.sbml_model import SbmlModel def _parse_cli_args(): diff --git a/python/sdist/amici/petab/conditions.py b/python/sdist/amici/petab/conditions.py index c0b702b69d..08c2f90302 100644 --- a/python/sdist/amici/petab/conditions.py +++ b/python/sdist/amici/petab/conditions.py @@ -9,9 +9,9 @@ import amici import numpy as np import pandas as pd -import petab +import petab.v1 as petab from amici import AmiciModel -from petab.C import ( +from petab.v1.C import ( MEASUREMENT, NOISE_PARAMETERS, OBSERVABLE_ID, diff --git a/python/sdist/amici/petab/import_helpers.py b/python/sdist/amici/petab/import_helpers.py index 94d8e8e0ce..b52d74004d 100644 --- a/python/sdist/amici/petab/import_helpers.py +++ b/python/sdist/amici/petab/import_helpers.py @@ -11,9 +11,9 @@ import amici import pandas as pd -import petab +import petab.v1 as petab import sympy as sp -from petab.C import ( +from petab.v1.C import ( CONDITION_NAME, ESTIMATE, NOISE_DISTRIBUTION, @@ -22,7 +22,7 @@ OBSERVABLE_NAME, OBSERVABLE_TRANSFORMATION, ) -from petab.parameters import get_valid_parameters_for_parameter_table +from petab.v1.parameters import get_valid_parameters_for_parameter_table from sympy.abc import _clash logger = logging.getLogger(__name__) diff --git a/python/sdist/amici/petab/parameter_mapping.py b/python/sdist/amici/petab/parameter_mapping.py index 54930073da..dc88c1064d 100644 --- a/python/sdist/amici/petab/parameter_mapping.py +++ b/python/sdist/amici/petab/parameter_mapping.py @@ -27,17 +27,17 @@ import amici import numpy as np import pandas as pd -import petab +import petab.v1 as petab import sympy as sp from amici.sbml_import import get_species_initial -from petab.C import * # noqa: F403 -from petab.C import ( +from petab.v1.C import * # noqa: F403 +from petab.v1.C import ( LIN, PARAMETER_SCALE, PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID, ) -from petab.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML +from petab.v1.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML from sympy.abc import _clash from .. import AmiciModel diff --git a/python/sdist/amici/petab/petab_import.py b/python/sdist/amici/petab/petab_import.py index 0e63496d75..52b08cfd47 100644 --- a/python/sdist/amici/petab/petab_import.py +++ b/python/sdist/amici/petab/petab_import.py @@ -12,8 +12,8 @@ from warnings import warn import amici -import petab -from petab.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML +import petab.v1 as petab +from petab.v1.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML from ..logging import get_logger from .import_helpers import _can_import_model, _create_model_name, check_model diff --git a/python/sdist/amici/petab/petab_problem.py b/python/sdist/amici/petab/petab_problem.py index 618b8b5247..b93eb06a87 100644 --- a/python/sdist/amici/petab/petab_problem.py +++ b/python/sdist/amici/petab/petab_problem.py @@ -4,8 +4,8 @@ import amici import pandas as pd -import petab -from petab.C import PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID +import petab.v1 as petab +from petab.v1.C import PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID from .conditions import create_edatas, fill_in_parameters from .parameter_mapping import create_parameter_mapping diff --git a/python/sdist/amici/petab/pysb_import.py b/python/sdist/amici/petab/pysb_import.py index f5b1c84dbf..aac3a8f330 100644 --- a/python/sdist/amici/petab/pysb_import.py +++ b/python/sdist/amici/petab/pysb_import.py @@ -9,12 +9,12 @@ import re from pathlib import Path -import petab +import petab.v1 as petab import pysb import pysb.bng import sympy as sp -from petab.C import CONDITION_NAME, NOISE_FORMULA, OBSERVABLE_FORMULA -from petab.models.pysb_model import PySBModel +from petab.v1.C import CONDITION_NAME, NOISE_FORMULA, OBSERVABLE_FORMULA +from petab.v1.models.pysb_model import PySBModel from ..logging import get_logger, log_execution_time, set_log_level from . import PREEQ_INDICATOR_ID diff --git a/python/sdist/amici/petab/sbml_import.py b/python/sdist/amici/petab/sbml_import.py index 6acf4587f7..3a9ca7eaf9 100644 --- a/python/sdist/amici/petab/sbml_import.py +++ b/python/sdist/amici/petab/sbml_import.py @@ -8,11 +8,11 @@ import amici import libsbml -import petab +import petab.v1 as petab import sympy as sp from _collections import OrderedDict from amici.logging import log_execution_time, set_log_level -from petab.models import MODEL_TYPE_SBML +from petab.v1.models import MODEL_TYPE_SBML from sympy.abc import _clash from . import PREEQ_INDICATOR_ID diff --git a/python/sdist/amici/petab/simulations.py b/python/sdist/amici/petab/simulations.py index 2cbed98dce..0f09c83b7a 100644 --- a/python/sdist/amici/petab/simulations.py +++ b/python/sdist/amici/petab/simulations.py @@ -12,8 +12,8 @@ import amici import numpy as np import pandas as pd -import petab -from petab.C import * # noqa: F403 +import petab.v1 as petab +from petab.v1.C import * # noqa: F403 from .. import AmiciExpData, AmiciModel from ..logging import get_logger, log_execution_time diff --git a/python/sdist/amici/petab/simulator.py b/python/sdist/amici/petab/simulator.py index 9c655b1483..407bf9f7f2 100644 --- a/python/sdist/amici/petab/simulator.py +++ b/python/sdist/amici/petab/simulator.py @@ -14,7 +14,7 @@ from collections.abc import Callable import pandas as pd -import petab +import petab.v1 as petab from amici import AmiciModel, SensitivityMethod_none from .petab_import import import_petab_problem diff --git a/python/sdist/amici/petab/util.py b/python/sdist/amici/petab/util.py index e30b829a04..5392dcdb86 100644 --- a/python/sdist/amici/petab/util.py +++ b/python/sdist/amici/petab/util.py @@ -5,10 +5,10 @@ import libsbml import pandas as pd -import petab -from petab.C import PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID -from petab.mapping import resolve_mapping -from petab.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML +import petab.v1 as petab +from petab.v1.C import PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID +from petab.v1.mapping import resolve_mapping +from petab.v1.models import MODEL_TYPE_PYSB, MODEL_TYPE_SBML if TYPE_CHECKING: pysb = None diff --git a/python/tests/test_petab_import.py b/python/tests/test_petab_import.py index fca319e11f..7979e6fbf1 100644 --- a/python/tests/test_petab_import.py +++ b/python/tests/test_petab_import.py @@ -5,7 +5,7 @@ import pytest from amici.testing import TemporaryDirectoryWinSafe, skip_on_valgrind -petab = pytest.importorskip("petab", reason="Missing petab") +petab = pytest.importorskip("petab.v1", reason="Missing petab") @pytest.fixture @@ -76,7 +76,7 @@ def test_get_fixed_parameters(get_fixed_parameters_model): from amici.petab.sbml_import import ( _get_fixed_parameters_sbml as get_fixed_parameters, ) - from petab.models.sbml_model import SbmlModel + from petab.v1.models.sbml_model import SbmlModel sbml_doc, sbml_model = get_fixed_parameters_model condition_df = petab.get_condition_df( @@ -117,7 +117,7 @@ def test_get_fixed_parameters(get_fixed_parameters_model): @skip_on_valgrind def test_default_output_parameters(simple_sbml_model): from amici.petab.petab_import import import_model - from petab.models.sbml_model import SbmlModel + from petab.v1.models.sbml_model import SbmlModel sbml_doc, sbml_model = simple_sbml_model condition_df = petab.get_condition_df( diff --git a/python/tests/test_petab_objective.py b/python/tests/test_petab_objective.py index 07770ac413..260036a267 100755 --- a/python/tests/test_petab_objective.py +++ b/python/tests/test_petab_objective.py @@ -6,7 +6,7 @@ import amici import numpy as np import pandas as pd -import petab +import petab.v1 as petab import pytest from amici.petab.petab_import import import_petab_problem from amici.petab.simulations import SLLH, simulate_petab diff --git a/python/tests/test_petab_simulate.py b/python/tests/test_petab_simulate.py index e1da7768e3..f0310eaca5 100644 --- a/python/tests/test_petab_simulate.py +++ b/python/tests/test_petab_simulate.py @@ -3,7 +3,7 @@ import tempfile from pathlib import Path -import petab +import petab.v1 as petab import petabtests import pytest from amici.petab.simulator import PetabSimulator diff --git a/tests/benchmark-models/test_petab_model.py b/tests/benchmark-models/test_petab_model.py index da3d37b5fb..c4ec2f5dd2 100755 --- a/tests/benchmark-models/test_petab_model.py +++ b/tests/benchmark-models/test_petab_model.py @@ -15,7 +15,7 @@ import amici import numpy as np import pandas as pd -import petab +import petab.v1 as petab import yaml from amici.logging import get_logger from amici.petab.simulations import ( @@ -24,7 +24,7 @@ rdatas_to_measurement_df, simulate_petab, ) -from petab.visualize import plot_problem +from petab.v1.visualize import plot_problem logger = get_logger(f"amici.{__name__}", logging.WARNING)