Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support valid AMICI noise distributions that are invalid in PEtab #1157

Merged
merged 7 commits into from
Nov 3, 2023
12 changes: 10 additions & 2 deletions pypesto/petab/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -128,7 +129,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:
Expand Down Expand Up @@ -280,7 +282,13 @@ def create_model(
logger.info(
f"Compiling amici model to folder " f"{self.output_folder}."
)
self.compile_model(**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 "
Expand Down