Skip to content

Commit

Permalink
pre-commit ruff fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wl-stepp committed Nov 1, 2024
1 parent a7abc9e commit 26a77d8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
8 changes: 3 additions & 5 deletions src/useq/_iter_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ def _iter_sequence(
if not item: # the case with no events
continue # pragma: no cover
# get axes objects for this event
index, time, position, grid, channel, z_pos = _parse_axes(
zip(order, item))
index, time, position, grid, channel, z_pos = _parse_axes(zip(order, item))

# skip if necessary
if _should_skip(position, channel, index, sequence.z_plan):
Expand All @@ -165,8 +164,7 @@ def _iter_sequence(
{**event_kwargs.get("index", {}), **index} # type: ignore
)
# determine x, y, z positions
event_kwargs.update(
_xyzpos(position, channel, sequence.z_plan, grid, z_pos))
event_kwargs.update(_xyzpos(position, channel, sequence.z_plan, grid, z_pos))
if position and position.name:
event_kwargs["pos_name"] = position.name
if channel:
Expand Down Expand Up @@ -199,7 +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
pos_overrides["reset_event_timer"] = False
if position.name:
pos_overrides["pos_name"] = position.name

Expand Down
34 changes: 20 additions & 14 deletions tests/test_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@
[{"loops": 5, "interval": 0.25}, {"interval": 1, "duration": 4}],
[0, 0.25, 0.50, 0.75, 1, 2, 3, 4, 5],
),
({"loops": 5, "duration": {"milliseconds": 8}},
[0, 0.002, 0.004, 0.006, 0.008]),
({"loops": 5, "duration": {"milliseconds": 8}}, [0, 0.002, 0.004, 0.006, 0.008]),
({"loops": 5, "duration": {"seconds": 8}}, [0, 2, 4, 6, 8]),
]
t_inputs = t_as_class + t_as_dict
Expand Down Expand Up @@ -290,8 +289,7 @@ def test_combinations(
pexpectation: Sequence[float],
) -> None:
mda = MDASequence(
time_plan=tplan, z_plan=zplan, channels=[
channel], stage_positions=positions
time_plan=tplan, z_plan=zplan, channels=[channel], stage_positions=positions
)

assert list(mda.z_plan) == zexpectation
Expand All @@ -309,8 +307,7 @@ def test_schema(cls: BaseModel) -> None:


def test_z_position() -> None:
mda = MDASequence(axis_order="tpcz", stage_positions=[
(222, 1, 10), (111, 1, 20)])
mda = MDASequence(axis_order="tpcz", stage_positions=[(222, 1, 10), (111, 1, 20)])
assert not mda.z_plan
for event in mda:
assert event.z_pos
Expand Down Expand Up @@ -355,8 +352,7 @@ def test_skip_channel_do_stack_no_zplan() -> None:

def test_event_action_union() -> None:
# test that action unions work
MDAEvent(action={"autofocus_device_name": "Z",
"autofocus_motor_offset": 25})
MDAEvent(action={"autofocus_device_name": "Z", "autofocus_motor_offset": 25})


def test_keep_shutter_open() -> None:
Expand Down Expand Up @@ -443,12 +439,22 @@ def test_reset_event_timer() -> None:

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}))]
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}
),
),
]
)
)

Expand Down

0 comments on commit 26a77d8

Please sign in to comment.