Skip to content

Commit 9c0ceae

Browse files
committed
pep8
1 parent fdec1de commit 9c0ceae

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

neo/rawio/openephysbinaryrawio.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ class OpenEphysBinaryRawIO(BaseRawIO):
3131
dirname : str
3232
Path to Open Ephys directory
3333
experiment_names : str or list or None
34-
If multiple experiments are available, this argument allows users to select one or more experiments.
35-
If None, all experiements are loaded as blocks.
34+
If multiple experiments are available, this argument allows users to select one
35+
or more experiments. If None, all experiements are loaded as blocks.
3636
E.g. `experiment_names="experiment2"`, `experiment_names=["experiment1", "experiment2"]`
3737
3838
Note
3939
----
40-
For multi-experiment datasets, the streams need to be consistent across experiments. If this is not the case,
41-
you can select a subset of experiments with the `experiment_names` argument
40+
For multi-experiment datasets, the streams need to be consistent across experiments.
41+
If this is not the case, you can select a subset of experiments with the `experiment_names`
42+
argument.
4243
4344
# Correspondencies
4445
Neo OpenEphys
@@ -65,9 +66,10 @@ def _source_name(self):
6566
return self.dirname
6667

6768
def _parse_header(self):
68-
all_streams, nb_block, nb_segment_per_block, possible_experiments = explore_folder(self.dirname,
69-
self.experiment_names)
70-
check_stream_consistency(all_streams, nb_block, nb_segment_per_block, possible_experiments)
69+
all_streams, nb_block, nb_segment_per_block, possible_experiments = \
70+
explore_folder(self.dirname, self.experiment_names)
71+
check_stream_consistency(all_streams, nb_block, nb_segment_per_block,
72+
possible_experiments)
7173

7274
# all streams are consistent across blocks and segments
7375
sig_stream_names = sorted(list(all_streams[0][0]['continuous'].keys()))
@@ -409,7 +411,8 @@ def explore_folder(dirname, experiment_names=None):
409411
# In new vesion (>=0.6) timestamps.npy is now called sample_numbers.npy
410412
# see https://open-ephys.github.io/gui-docs/User-Manual/Recording-data/Binary-format.html#continuous
411413
if (root / 'continuous' / d['folder_name'] / 'sample_numbers.npy').is_file():
412-
timestamp_file = root / 'continuous' / d['folder_name'] / 'sample_numbers.npy'
414+
timestamp_file = root / 'continuous' / d['folder_name'] / \
415+
'sample_numbers.npy'
413416
else:
414417
timestamp_file = root / 'continuous' / d['folder_name'] / 'timestamps.npy'
415418
timestamps = np.load(str(timestamp_file), mmap_mode='r')
@@ -442,18 +445,21 @@ def explore_folder(dirname, experiment_names=None):
442445
return all_streams, nb_block, nb_segment_per_block, possible_experiment_names
443446

444447

445-
def check_stream_consistency(all_streams, nb_block, nb_segment_per_block, possible_experiment_names=None):
448+
def check_stream_consistency(all_streams, nb_block, nb_segment_per_block,
449+
possible_experiment_names=None):
446450
# "continuous" streams across segments
447451
for block_index in range(nb_block):
448452
segment_stream_names = None
449453
if nb_segment_per_block[block_index] > 1:
450454
for segment_index in all_streams[block_index]:
451-
stream_names = sorted(list(all_streams[block_index][segment_index]["continuous"].keys()))
455+
stream_names = sorted(list(all_streams[block_index]
456+
[segment_index]["continuous"].keys()))
452457
if segment_stream_names is None:
453458
segment_stream_names = stream_names
454459
assert segment_stream_names == stream_names, \
455-
("Inconsistent continuous streams across segments! Streams for different segments in the "
456-
"same experiment must be the same. Check your open ephys folder.")
460+
("Inconsistent continuous streams across segments! Streams for different "
461+
"segments in the same experiment must be the same. Check your open ephys "
462+
"folder.")
457463

458464
# "continuous" streams across blocks
459465
block_stream_names = None
@@ -463,6 +469,6 @@ def check_stream_consistency(all_streams, nb_block, nb_segment_per_block, possib
463469
if block_stream_names is None:
464470
block_stream_names = stream_names
465471
assert block_stream_names == stream_names, \
466-
(f"Inconsistent continuous streams across blocks (experiments)! Streams for different experiments in the "
467-
f"same folder must be the same. You can load a subset of experiments with the 'experiment_names' "
468-
f"argument: {possible_experiment_names}")
472+
(f"Inconsistent continuous streams across blocks (experiments)! Streams for "
473+
f"different experiments in the same folder must be the same. You can load a subset "
474+
f"of experiments with the 'experiment_names' argument: {possible_experiment_names}")

0 commit comments

Comments
 (0)