Skip to content

Commit 3709112

Browse files
authored
Merge branch 'main' into sorted_periods
2 parents 90a249d + 3156df2 commit 3709112

File tree

8 files changed

+305
-341
lines changed

8 files changed

+305
-341
lines changed

doc/modules.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,4 @@ API Reference
3737
petab.v2.experiments
3838
petab.v2.lint
3939
petab.v2.models
40-
petab.v2.problem
4140
petab.v2.petab1to2

petab/v1/math/printer.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ def _print_BooleanFalse(self, expr):
3737
def _print_Pow(self, expr: sp.Pow):
3838
"""Custom printing for the power operator"""
3939
base, exp = expr.as_base_exp()
40-
return f"{self._print(base)} ^ {self._print(exp)}"
40+
str_base = self._print(base)
41+
str_exp = self._print(exp)
42+
if not base.is_Atom:
43+
str_base = f"({str_base})"
44+
if not exp.is_Atom:
45+
str_exp = f"({str_exp})"
46+
return f"{str_base} ^ {str_exp}"
4147

4248
def _print_Infinity(self, expr):
4349
"""Custom printing for infinity"""

petab/v2/C.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
#: Replicate ID column in the measurement table
3939
REPLICATE_ID = "replicateId"
4040

41+
#: The model ID column in the measurement table
42+
MODEL_ID = "modelId"
43+
4144
#: Mandatory columns of measurement table
4245
MEASUREMENT_DF_REQUIRED_COLS = [
4346
OBSERVABLE_ID,
@@ -52,6 +55,7 @@
5255
NOISE_PARAMETERS,
5356
DATASET_ID,
5457
REPLICATE_ID,
58+
MODEL_ID,
5559
]
5660

5761
#: Measurement table columns

petab/v2/converters.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ def __init__(self, problem: Problem, default_priority: float = None):
7171
To ensure that the PEtab condition-start-events are executed before
7272
any other events, all events should have a priority set.
7373
"""
74+
if len(problem.models) > 1:
75+
# https://github.com/PEtab-dev/libpetab-python/issues/392
76+
raise NotImplementedError(
77+
"Only single-model PEtab problems are supported."
78+
)
7479
if not isinstance(problem.model, SbmlModel):
7580
raise ValueError("Only SBML models are supported.")
7681

@@ -401,7 +406,7 @@ def _add_indicators_to_conditions(self) -> None:
401406
# removed. Only keep the conditions setting our indicators.
402407
problem.condition_tables = [
403408
ConditionTable(
404-
conditions=[
409+
[
405410
condition
406411
for condition in problem.conditions
407412
if condition.id.startswith("_petab")

0 commit comments

Comments
 (0)