Skip to content

Commit

Permalink
ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
cboulay committed Sep 30, 2024
1 parent f6de923 commit 01340d0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
17 changes: 13 additions & 4 deletions src/ezmsg/lsl/inlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,19 @@ def _reset_inlet(self) -> None:
results: list[pylsl.StreamInfo] = self.STATE.resolver.results()
for strm_info in results:
b_match = True
b_match = b_match and ((not self.SETTINGS.info.name) or strm_info.name() == self.SETTINGS.info.name)
b_match = b_match and ((not self.SETTINGS.info.type) or strm_info.type() == self.SETTINGS.info.type)
b_match = b_match and (
(not self.SETTINGS.info.name)
or strm_info.name() == self.SETTINGS.info.name
)
b_match = b_match and (
(not self.SETTINGS.info.type)
or strm_info.type() == self.SETTINGS.info.type
)
if b_match:
self.STATE.inlet = pylsl.StreamInlet(
strm_info, max_chunklen=1, processing_flags=self.SETTINGS.processing_flags
strm_info,
max_chunklen=1,
processing_flags=self.SETTINGS.processing_flags,
)
break

Expand All @@ -195,7 +203,8 @@ def _reset_inlet(self) -> None:
if fmt in fmt2npdtype:
dtype = fmt2npdtype[fmt]
n_buff = (
int(self.SETTINGS.local_buffer_dur * inlet_info.nominal_srate()) or 1000
int(self.SETTINGS.local_buffer_dur * inlet_info.nominal_srate())
or 1000
)
self._fetch_buffer = np.zeros((n_buff, n_ch), dtype=dtype)
ch_labels = []
Expand Down
1 change: 0 additions & 1 deletion src/ezmsg/lsl/outlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,3 @@ async def lsl_outlet(self, arr: AxisArray) -> None:
dat = np.moveaxis(dat, arr.dims.index("time"), 0)

self.STATE.outlet.push_chunk(dat.reshape(dat.shape[0], -1))

6 changes: 5 additions & 1 deletion tests/test_inlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
These unit tests aren't really testable in a runner without a complicated setup with inlets and outlets.
This code exists mostly to use during development and debugging.
"""

import asyncio
import json
import os
Expand Down Expand Up @@ -36,7 +37,10 @@ async def switch_stream(self) -> typing.AsyncGenerator:
if switch_counter % 2 == 0:
yield self.OUTPUT_SETTINGS, LSLInletSettings(info=LSLInfo(type="ECoG"))
else:
yield self.OUTPUT_SETTINGS, LSLInletSettings(info=LSLInfo(type="Markers"))
yield (
self.OUTPUT_SETTINGS,
LSLInletSettings(info=LSLInfo(type="Markers")),
)
switch_counter += 1
await asyncio.sleep(2)

Expand Down

0 comments on commit 01340d0

Please sign in to comment.