Skip to content

Commit c9dec65

Browse files
committed
..
1 parent e7c34f9 commit c9dec65

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

petab/v2/converters.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ class ExperimentsToEventsConverter:
4141
#: ID of the parameter that indicates whether the model is in
4242
# the pre-equilibration phase (1) or not (0).
4343
PREEQ_INDICATOR = "_petab_preequilibration_indicator"
44+
#: The condition ID of the condition that sets the
45+
#: pre-equilibration indicator to 1.
46+
CONDITION_ID_PREEQ_ON = "_petab_preequilibration_on"
47+
#: The condition ID of the condition that sets the
48+
#: pre-equilibration indicator to 0.
49+
CONDITION_ID_PREEQ_OFF = "_petab_preequilibration_off"
4450

4551
def __init__(self, problem: Problem):
4652
"""Initialize the converter.
@@ -220,17 +226,17 @@ def _convert_experiment(self, experiment: Experiment):
220226
for period in kept_periods:
221227
period.condition_ids = [
222228
self._get_experiment_indicator_condition_id(experiment.id),
223-
"_petab_preequilibration"
229+
self.CONDITION_ID_PREEQ_ON
224230
if period.time == TIME_PREEQUILIBRATION
225-
else "_petab_no_preequilibration",
231+
else self.CONDITION_ID_PREEQ_OFF,
226232
]
227233

228234
experiment.periods = kept_periods
229235

230236
def _create_period_start_event(
231237
self, experiment: Experiment, i_period: int, period: ExperimentPeriod
232238
) -> libsbml.Event:
233-
"""Create an event that triggers at the beginning of a period."""
239+
"""Create an event that triggers at the start of a period."""
234240

235241
# TODO: for now, add separate events for each experiment x period,
236242
# this could be optimized to reuse events
@@ -340,15 +346,15 @@ def _add_indicators_to_conditions(self) -> None:
340346
# create conditions for indicator parameters
341347
problem.condition_table.conditions.append(
342348
Condition(
343-
id="_petab_preequilibration",
349+
id=self.CONDITION_ID_PREEQ_ON,
344350
changes=[
345351
Change(target_id=self._preeq_indicator, target_value=1)
346352
],
347353
)
348354
)
349355
problem.condition_table.conditions.append(
350356
Condition(
351-
id="_petab_no_preequilibration",
357+
id=self.CONDITION_ID_PREEQ_OFF,
352358
changes=[
353359
Change(target_id=self._preeq_indicator, target_value=0)
354360
],

0 commit comments

Comments
 (0)