Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated functionality for PEtab import from individual files instead of petab.Problem #2459

Merged
merged 4 commits into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions python/sdist/amici/petab/sbml_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -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.

Expand Down Expand Up @@ -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 "
Expand Down
8 changes: 1 addition & 7 deletions python/sdist/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion python/tests/test_preequilibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ()
Expand Down
Loading