From a6889d7d85966aa8631727c7585cc2c41fee5e15 Mon Sep 17 00:00:00 2001 From: dilpath Date: Wed, 25 Oct 2023 17:25:14 +0200 Subject: [PATCH 1/2] pass petab validation flag to amici --- pypesto/petab/importer.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pypesto/petab/importer.py b/pypesto/petab/importer.py index d726c7afa..0d468246a 100644 --- a/pypesto/petab/importer.py +++ b/pypesto/petab/importer.py @@ -128,7 +128,8 @@ def __init__( self.validate_inner_options() - if validate_petab: + self.validate_petab = validate_petab + if self.validate_petab: if petab.lint_problem(petab_problem): raise ValueError("Invalid PEtab problem.") if self._hierarchical and validate_petab_hierarchical: @@ -280,7 +281,7 @@ def create_model( logger.info( f"Compiling amici model to folder " f"{self.output_folder}." ) - self.compile_model(**kwargs) + self.compile_model(validate=self.validate_petab, **kwargs) else: logger.debug( f"Using existing amici model in folder " From 91187bd8e063bb895767d62156099c42f4e9361e Mon Sep 17 00:00:00 2001 From: dilpath Date: Wed, 25 Oct 2023 22:34:36 +0200 Subject: [PATCH 2/2] only if sbml --- pypesto/petab/importer.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pypesto/petab/importer.py b/pypesto/petab/importer.py index 0d468246a..6740ee4ea 100644 --- a/pypesto/petab/importer.py +++ b/pypesto/petab/importer.py @@ -53,6 +53,7 @@ import amici.petab_objective import petab from petab.C import PREEQUILIBRATION_CONDITION_ID, SIMULATION_CONDITION_ID + from petab.models import MODEL_TYPE_SBML except ImportError: pass @@ -281,7 +282,13 @@ def create_model( logger.info( f"Compiling amici model to folder " f"{self.output_folder}." ) - self.compile_model(validate=self.validate_petab, **kwargs) + if self.petab_problem.model.type_id == MODEL_TYPE_SBML: + self.compile_model( + validate=self.validate_petab, + **kwargs, + ) + else: + self.compile_model(**kwargs) else: logger.debug( f"Using existing amici model in folder "