From 46115860f4ec4bcf88273f7d64d6950b0b1e2f1a Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 20 Nov 2024 10:50:05 +0100 Subject: [PATCH] Fix handling of PEtab fixed parameters (#1514) Follow-up to #1493 and #1509, which only filled in PEtab-fixed parameters for simulation but not preequilibration in the parameter mapping. Adding Weber_BMC2015 to the PEtab tests, where this issue popped up. --- pypesto/objective/amici/amici.py | 6 ++++++ test/petab/test_petab_import.py | 11 ++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pypesto/objective/amici/amici.py b/pypesto/objective/amici/amici.py index 6edbe1dde..d9fd371a3 100644 --- a/pypesto/objective/amici/amici.py +++ b/pypesto/objective/amici/amici.py @@ -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 diff --git a/test/petab/test_petab_import.py b/test/petab/test_petab_import.py index 1ce935880..d4a39f6d5 100644 --- a/test/petab/test_petab_import.py +++ b/test/petab/test_petab_import.py @@ -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):