From ccd1cbc154e98bbd847e309a08c1eb6a015a32fb Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Sun, 16 Jun 2024 16:37:01 +0200 Subject: [PATCH 1/3] Fix numpy2.0 np.infty -> np.inf Fixes `AttributeError: `np.infty` was removed in the NumPy 2.0 release. Use `np.inf` instead.` --- python/tests/test_preequilibration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tests/test_preequilibration.py b/python/tests/test_preequilibration.py index d9a2335459..bb657b4153 100644 --- a/python/tests/test_preequilibration.py +++ b/python/tests/test_preequilibration.py @@ -32,7 +32,7 @@ def preeq_fixture(pysb_example_presimulation_module): edata_preeq = amici.ExpData(edata) edata_preeq.t_presim = 0 - edata_preeq.setTimepoints([np.infty]) + edata_preeq.setTimepoints([np.inf]) edata_preeq.fixedParameters = edata.fixedParametersPreequilibration edata_preeq.fixedParametersPresimulation = () edata_preeq.fixedParametersPreequilibration = () From 6eac1d50133bdad267323d8e62b8802da8759dcb Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Sun, 16 Jun 2024 16:45:38 +0200 Subject: [PATCH 2/3] Require numpy>=2.0 at build time --- python/sdist/pyproject.toml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/python/sdist/pyproject.toml b/python/sdist/pyproject.toml index 905e564cf4..f93d0c7e1b 100644 --- a/python/sdist/pyproject.toml +++ b/python/sdist/pyproject.toml @@ -4,13 +4,7 @@ requires = [ "setuptools>=61", "wheel", - # oldest-supported-numpy helps us to pin numpy here to the lowest supported - # version to have ABI-compatibility with the numpy version in the runtime - # environment. The undesirable alternative would be pinning the setup.py - # numpy requirement to the same version as here, which we want to avoid. - # cf. discussion at https://github.com/numpy/numpy/issues/5888 - # (https://github.com/scipy/oldest-supported-numpy/) - "oldest-supported-numpy", + "numpy>=2.0", "cmake-build-extension==0.6.0", ] build-backend = "setuptools.build_meta" From 36378541d1872de67d1fff7be9cf154cb7ac4d70 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Sun, 16 Jun 2024 16:52:14 +0200 Subject: [PATCH 3/3] Remove deprecated functionality for PEtab import from individual files instead of petab.Problem Since almost two years, it's possible to pass a `petab.Problem`, which is safer and more convenient. Omitting the parameter table for model import (since there is no option to supply this) is likely to produce unwanted results (see #2458 and #2455 for more details), and therefore, this functionality is best removed. --- python/sdist/amici/petab/sbml_import.py | 42 ------------------------- 1 file changed, 42 deletions(-) diff --git a/python/sdist/amici/petab/sbml_import.py b/python/sdist/amici/petab/sbml_import.py index e22a214e18..6acf4587f7 100644 --- a/python/sdist/amici/petab/sbml_import.py +++ b/python/sdist/amici/petab/sbml_import.py @@ -5,11 +5,9 @@ from itertools import chain from pathlib import Path from typing import Union -from warnings import warn import amici import libsbml -import pandas as pd import petab import sympy as sp from _collections import OrderedDict @@ -31,9 +29,6 @@ @log_execution_time("Importing PEtab model", logger) def import_model_sbml( sbml_model: Union[str, Path, "libsbml.Model"] = None, - condition_table: str | Path | pd.DataFrame | None = None, - observable_table: str | Path | pd.DataFrame | None = None, - measurement_table: str | Path | pd.DataFrame | None = None, petab_problem: petab.Problem = None, model_name: str | None = None, model_output_dir: str | Path | None = None, @@ -52,18 +47,6 @@ def import_model_sbml( PEtab SBML model or SBML file name. Deprecated, pass ``petab_problem`` instead. - :param condition_table: - PEtab condition table. If provided, parameters from there will be - turned into AMICI constant parameters (i.e. parameters w.r.t. which - no sensitivities will be computed). - Deprecated, pass ``petab_problem`` instead. - - :param observable_table: - PEtab observable table. Deprecated, pass ``petab_problem`` instead. - - :param measurement_table: - PEtab measurement table. Deprecated, pass ``petab_problem`` instead. - :param petab_problem: PEtab problem. @@ -113,31 +96,6 @@ def import_model_sbml( logger.info("Importing model ...") - if any([sbml_model, condition_table, observable_table, measurement_table]): - warn( - "The `sbml_model`, `condition_table`, `observable_table`, and " - "`measurement_table` arguments are deprecated and will be " - "removed in a future version. Use `petab_problem` instead.", - DeprecationWarning, - stacklevel=2, - ) - if petab_problem: - raise ValueError( - "Must not pass a `petab_problem` argument in " - "combination with any of `sbml_model`, " - "`condition_table`, `observable_table`, or " - "`measurement_table`." - ) - - petab_problem = petab.Problem( - model=SbmlModel(sbml_model) - if isinstance(sbml_model, libsbml.Model) - else SbmlModel.from_file(sbml_model), - condition_df=petab.get_condition_df(condition_table), - observable_df=petab.get_observable_df(observable_table), - measurement_df=petab.get_measurement_df(measurement_table), - ) - if petab_problem.observable_df is None: raise NotImplementedError( "PEtab import without observables table "