Skip to content

Commit

Permalink
Remove deprecated functionality for PEtab import from individual file…
Browse files Browse the repository at this point in the history
…s instead of petab.Problem (#2459)

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.

Closes #2458
  • Loading branch information
dweindl authored Jun 16, 2024
1 parent 6393c0c commit 3004be6
Showing 1 changed file with 0 additions and 42 deletions.
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

0 comments on commit 3004be6

Please sign in to comment.