Skip to content

Commit

Permalink
Remove solver
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Jan 4, 2024
1 parent e36c9b4 commit db8bf36
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions python/sdist/amici/petab/petab_problem.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
"""PEtab-problem based simulations."""
import copy
from typing import Optional, Sequence, Union
from typing import Optional, Union

import amici
import pandas as pd
import petab
from petab.C import (
DATASET_ID,
NOISE_PARAMETERS,
OBSERVABLE_ID,
PREEQUILIBRATION_CONDITION_ID,
SIMULATION,
SIMULATION_CONDITION_ID,
TIME,
)
from petab.C import PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID

from .conditions import create_edatas, fill_in_parameters
from .parameter_mapping import create_parameter_mapping
Expand All @@ -27,8 +19,6 @@ class AmiciPetabProblem:
:param petab_problem: PEtab problem definition.
:param amici_model: AMICI model
:param amici_solver: AMICI solver (Solver with default options will be
used if not provided).
:param problem_parameters: Problem parameters to use for simulation
(default: PEtab nominal values and model values).
:param scaled_parameters: Whether the provided parameters are on PEtab
Expand All @@ -48,15 +38,12 @@ def __init__(
petab_problem: petab.Problem,
amici_model: amici.Model,
problem_parameters: Optional[dict[str, float]] = None,
# move to a separate AmiciPetabProblemSimulator class?
amici_solver: Optional[amici.Solver] = None,
scaled_parameters: Optional[bool] = False,
simulation_conditions: Union[pd.DataFrame, list[dict]] = None,
store_edatas: bool = True,
):
self._petab_problem = petab_problem
self._petab_problem = copy.deepcopy(petab_problem)
self._amici_model = amici_model
self._amici_solver = amici_solver
self._scaled_parameters = scaled_parameters

Check warning on line 47 in python/sdist/amici/petab/petab_problem.py

View check run for this annotation

Codecov / codecov/patch

python/sdist/amici/petab/petab_problem.py#L45-L47

Added lines #L45 - L47 were not covered by tests

self._simulation_conditions = simulation_conditions or (

Check warning on line 49 in python/sdist/amici/petab/petab_problem.py

View check run for this annotation

Codecov / codecov/patch

python/sdist/amici/petab/petab_problem.py#L49

Added line #L49 was not covered by tests
Expand Down Expand Up @@ -94,7 +81,6 @@ def __init__(
scaled_parameters=self._scaled_parameters,
amici_model=self._amici_model,
)

self._create_edatas()

Check warning on line 84 in python/sdist/amici/petab/petab_problem.py

View check run for this annotation

Codecov / codecov/patch

python/sdist/amici/petab/petab_problem.py#L84

Added line #L84 was not covered by tests
else:
self._parameter_mapping = None
Expand Down Expand Up @@ -223,11 +209,6 @@ def _create_edata(
raise AssertionError("Expected exactly one ExpData object.")
return edatas[0]

Check warning on line 210 in python/sdist/amici/petab/petab_problem.py

View check run for this annotation

Codecov / codecov/patch

python/sdist/amici/petab/petab_problem.py#L210

Added line #L210 was not covered by tests

@property
def solver(self):
"""Get the solver."""
return self._amici_solver or self._amici_model.getSolver()

def _create_edatas(

Check warning on line 212 in python/sdist/amici/petab/petab_problem.py

View check run for this annotation

Codecov / codecov/patch

python/sdist/amici/petab/petab_problem.py#L212

Added line #L212 was not covered by tests
self,
):
Expand Down

0 comments on commit db8bf36

Please sign in to comment.