Skip to content

Commit 304dfe7

Browse files
FFroehlichclaude
andauthored
assignments_to_experiments: rename the period index to i_period
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 368251b commit 304dfe7

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

‎petab/v2/converters.py‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ def assignments_to_experiments(problem: Problem) -> Problem:
902902
for experiment in experiments:
903903
periods = experiment.sorted_periods
904904
overrides = {}
905-
for i, period in enumerate(periods):
905+
for i_period, period in enumerate(periods):
906906
changes = problem.get_changes_for_period(period)
907907
overrides |= {c.target_id: c.target_value for c in changes}
908908
subs = fixed_values | {
@@ -936,7 +936,11 @@ def assignments_to_experiments(problem: Problem) -> Problem:
936936
)
937937
continue
938938

939-
t_end = periods[i + 1].time if i + 1 < len(periods) else sp.oo
939+
t_end = (
940+
periods[i_period + 1].time
941+
if i_period + 1 < len(periods)
942+
else sp.oo
943+
)
940944
start_value = _value_from(
941945
expr, switches, time, subs, times, period.time
942946
)
@@ -956,7 +960,7 @@ def assignments_to_experiments(problem: Problem) -> Problem:
956960
# always set by the tables.
957961
redundant = (
958962
not ramps
959-
and i == 0
963+
and i_period == 0
960964
and (start_value - default).is_zero
961965
and not {str(s) for s in default.free_symbols}
962966
& parameter_ids
@@ -966,15 +970,15 @@ def assignments_to_experiments(problem: Problem) -> Problem:
966970
)
967971
)
968972
after_preequilibration = (
969-
i > 0 and periods[i - 1].is_preequilibration
973+
i_period > 0 and periods[i_period - 1].is_preequilibration
970974
)
971975
if not redundant and (
972-
i == 0
976+
i_period == 0
973977
or {c.target_id for c in changes} & symbol_ids
974978
# preequilibration held the slope at zero
975979
or (ramps and after_preequilibration)
976980
):
977-
if i == 0:
981+
if i_period == 0:
978982
# at the start of an experiment, a change may only
979983
# refer to parameter table symbols; other symbols
980984
# are constant model parameters, at their values

0 commit comments

Comments
 (0)