Skip to content

Commit

Permalink
Test petab/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Jul 1, 2024
1 parent 65a1138 commit 5614098
Show file tree
Hide file tree
Showing 21 changed files with 64 additions and 47 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test_benchmark_collection_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ jobs:
AMICI_PARALLEL_COMPILE="" pip3 install -v --user \
$(ls -t python/sdist/dist/amici-*.tar.gz | head -1)[petab,test,vis]
- run: |
python3 -m pip uninstall -y petab && python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@develop \
&& python3 -m pip install -U sympy
# retrieve test models
- name: Download and test benchmark collection
run: |
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/test_petab_test_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
- name: Install petab
run: |
source ./venv/bin/activate \
&& pip3 install wheel pytest shyaml pytest-cov pysb
&& pip3 install wheel pytest shyaml pytest-cov pysb>=1.16
# retrieve test models
- name: Download and install PEtab test suite
Expand All @@ -68,11 +68,18 @@ jobs:
&& source ./venv/bin/activate \
&& cd petab_test_suite && pip3 install -e .
- name: Install petab
run: |
source ./venv/bin/activate \
&& python3 -m pip uninstall -y petab && python3 -m pip install git+https://github.com/petab-dev/libpetab-python.git@develop \
&& python3 -m pip install sympy>=1.12.1
- name: Run PEtab-related unit tests
run: |
source ./venv/bin/activate \
&& pytest --cov-report=xml:coverage.xml \
--cov=./ python/tests/test_*petab*.py python/tests/petab/
--cov=./ python/tests/test_*petab*.py python/tests/petab_/
# run test models
- name: Run PEtab test suite
Expand Down
24 changes: 15 additions & 9 deletions documentation/python_installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,19 @@ environment variables:
| | Default: ``ON`` | |
+----------------------------+----------------------------------+---------------------------------+

Installation under Anaconda
---------------------------
Installation under conda
------------------------

To use an Anaconda installation of Python
`https://www.anaconda.com/distribution/ <https://www.anaconda.com/distribution/>`_,
Python>=3.7), proceed as follows:
There is no amici conda recipe available yet. However, you can install AMICI
using pip in a conda environment.

Since Anaconda provides own versions of some packages which might not
work with AMICI (in particular the ``gcc`` compiler), create a minimal
virtual environment via:
.. note::

It is possible, but we currently don't recommend using conda for installing
AMICI, as it commonly leads to conflicts with system installations of
libraries and compilers.

Create a minimal conda environment via:

.. code-block:: bash
Expand Down Expand Up @@ -415,7 +418,7 @@ Now, you are ready to use AMICI in the virtual environment.

.. note::

**Anaconda on Mac**
**conda on Mac**

If the above installation does not work for you, try installing AMICI via:

Expand All @@ -437,6 +440,9 @@ Now, you are ready to use AMICI in the virtual environment.
(For further discussion see https://github.com/AMICI-dev/AMICI/issues/357)

Known issues:

* ``CMAKE_AR-NOTFOUND: not found``: Try ``conda install binutils``.

Optional Boost support
----------------------
Expand Down
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
addopts = -vv --strict-markers

filterwarnings =
# warnings are errors
error
# amici
ignore:Conservation laws for non-constant species in models with RateRules are currently not supported and will be turned off.:UserWarning
Expand All @@ -13,7 +14,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
Expand Down
2 changes: 1 addition & 1 deletion python/sdist/amici/petab/cli/import_petab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
4 changes: 2 additions & 2 deletions python/sdist/amici/petab/conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions python/sdist/amici/petab/import_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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__)
Expand Down
8 changes: 4 additions & 4 deletions python/sdist/amici/petab/parameter_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions python/sdist/amici/petab/petab_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions python/sdist/amici/petab/petab_problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions python/sdist/amici/petab/pysb_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions python/sdist/amici/petab/sbml_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -90,7 +90,7 @@ def import_model_sbml(
:return:
The created :class:`amici.sbml_import.SbmlImporter` instance.
"""
from petab.models.sbml_model import SbmlModel
from petab.v1.models.sbml_model import SbmlModel

set_log_level(logger, verbose)

Expand Down
4 changes: 2 additions & 2 deletions python/sdist/amici/petab/simulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/sdist/amici/petab/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions python/sdist/amici/petab/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions python/tests/test_petab_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion python/tests/test_petab_objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/tests/test_petab_simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/benchmark-models/test_petab_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion tests/petab_test_suite/test_petab_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import amici
import pandas as pd
import petab
import petab.v1 as petab
import petabtests
import pytest
from _pytest.outcomes import Skipped
Expand Down

0 comments on commit 5614098

Please sign in to comment.