Skip to content

Commit

Permalink
fix: reset_event_timer defaults to True in sub-sequences (#194)
Browse files Browse the repository at this point in the history
* sub-sequence reset_event_timer default to False

* pre-commit ruff fix
  • Loading branch information
wl-stepp authored Nov 1, 2024
1 parent 772f59a commit 9162967
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/useq/_iter_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def _iter_sequence(
_pos, _offsets = _position_offsets(position, event_kwargs)
# build overrides for this position
pos_overrides = MDAEventDict(sequence=sequence, **_pos)
pos_overrides["reset_event_timer"] = False
if position.name:
pos_overrides["pos_name"] = position.name

Expand Down
26 changes: 26 additions & 0 deletions tests/test_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,29 @@ def test_reset_event_timer() -> None:
assert not events[1].reset_event_timer
assert events[2].reset_event_timer
assert not events[3].reset_event_timer

events = list(
MDASequence(
stage_positions=[
Position(
x=0,
y=0,
sequence=MDASequence(
channels=["Cy5"], time_plan={"interval": 1, "loops": 2}
),
),
Position(
x=1,
y=1,
sequence=MDASequence(
channels=["DAPI"], time_plan={"interval": 1, "loops": 2}
),
),
]
)
)

assert events[0].reset_event_timer
assert not events[1].reset_event_timer
assert events[2].reset_event_timer
assert not events[3].reset_event_timer

0 comments on commit 9162967

Please sign in to comment.