Skip to content

Commit

Permalink
Merge branch 'develop' into update_refs
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl authored Nov 26, 2024
2 parents d80148c + 6c049f5 commit f9ed4aa
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 10 deletions.
6 changes: 6 additions & 0 deletions pypesto/objective/amici/amici.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,3 +713,9 @@ def update_from_problem(
) in condition_mapping.map_sim_fix.items():
if (val := id_to_val.get(mapped_to_par)) is not None:
condition_mapping.map_sim_fix[model_par] = val
for (
model_par,
mapped_to_par,
) in condition_mapping.map_preeq_fix.items():
if (val := id_to_val.get(mapped_to_par)) is not None:
condition_mapping.map_preeq_fix[model_par] = val
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ ipopt =
dlib =
dlib >= 19.19.0
nlopt =
nlopt >= 2.6.2
# != 2.9.0: https://github.com/stevengj/nlopt/issues/575
nlopt >= 2.6.2, != 2.9.0
pyswarm =
pyswarm >= 0.6
cma =
Expand Down
9 changes: 8 additions & 1 deletion test/base/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@ def test_deepcopy_objective():
)
)
factory = petab_importer.create_objective_creator()
objective = factory.create_objective()
amici_model = factory.create_model()
amici_model.setSteadyStateSensitivityMode(
amici.SteadyStateSensitivityMode.integrateIfNewtonFails
)
amici_model.setSteadyStateComputationMode(
amici.SteadyStateComputationMode.integrateIfNewtonFails
)
objective = factory.create_objective(model=amici_model)

objective.amici_solver.setSensitivityMethod(
amici.SensitivityMethod_adjoint
Expand Down
15 changes: 12 additions & 3 deletions test/petab/test_amici_objective.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,21 @@ def test_preeq_guesses():
importer = pypesto.petab.PetabImporter.from_yaml(
os.path.join(models.MODELS_DIR, model_name, model_name + ".yaml")
)
problem = importer.create_problem()
obj = problem.objective
obj.amici_solver.setNewtonMaxSteps(0)
obj_creator = importer.create_objective_creator()
amici_model = obj_creator.create_model()
amici_model.setSteadyStateComputationMode(
amici.SteadyStateComputationMode.integrateIfNewtonFails
)
amici_model.setSteadyStateSensitivityMode(
amici.SteadyStateSensitivityMode.integrateIfNewtonFails
)
obj = obj_creator.create_objective(model=amici_model)
problem = importer.create_problem(objective=obj)
obj.amici_model.setSteadyStateSensitivityMode(
amici.SteadyStateSensitivityMode.integrationOnly
)
obj = problem.objective
obj.amici_solver.setNewtonMaxSteps(0)
obj.amici_solver.setAbsoluteTolerance(1e-12)
obj.amici_solver.setRelativeTolerance(1e-12)

Expand Down
11 changes: 6 additions & 5 deletions test/petab/test_petab_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ def setUpClass(cls):
cls.obj_edatas = []

def test_0_import(self):
for model_name in ["Zheng_PNAS2012", "Boehm_JProteomeRes2014"]:
for model_name in [
"Zheng_PNAS2012",
"Boehm_JProteomeRes2014",
"Weber_BMC2015",
]:
# test yaml import for one model:
yaml_config = os.path.join(
models.MODELS_DIR, model_name, model_name + ".yaml"
)
petab_problem = petab.Problem.from_yaml(yaml_config)
petab_problem = models.get_problem(model_name)
self.petab_problems.append(petab_problem)

def test_1_compile(self):
Expand Down

0 comments on commit f9ed4aa

Please sign in to comment.