Skip to content

Commit 1552a50

Browse files
committed
Merge branch 'master' of github.com:NeuralEnsemble/python-neo into add_signal_buffer_id
2 parents d11be08 + 1c743a4 commit 1552a50

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

neo/rawio/maxwellrawio.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import os
2222
from pathlib import Path
2323
import platform
24+
import warnings
2425
from urllib.request import urlopen
2526

2627
import numpy as np
@@ -121,7 +122,8 @@ def _parse_header(self):
121122
max_sig_length = 0
122123
self._signals = {}
123124
sig_channels = []
124-
for stream_id in signal_streams["id"]:
125+
well_indices_to_remove = []
126+
for stream_index, stream_id in enumerate(signal_streams["id"]):
125127
if int(version) == 20160704:
126128
sr = 20000.0
127129
settings = h5file["settings"]
@@ -152,7 +154,13 @@ def _parse_header(self):
152154
gain = settings["gain"][0]
153155
gain_uV = 3.3 / (1024 * gain) * 1e6
154156
mapping = settings["mapping"]
155-
sigs = h5file["wells"][stream_id][self.rec_name]["groups"]["routed"]["raw"]
157+
if "routed" in h5file["wells"][stream_id][self.rec_name]["groups"]:
158+
sigs = h5file["wells"][stream_id][self.rec_name]["groups"]["routed"]["raw"]
159+
else:
160+
warnings.warn(f"No 'routed' group found for well {stream_id}")
161+
well_indices_to_remove.append(stream_index)
162+
continue
163+
156164

157165
channel_ids = np.array(mapping["channel"])
158166
electrode_ids = np.array(mapping["electrode"])
@@ -172,6 +180,9 @@ def _parse_header(self):
172180

173181
self._t_stop = max_sig_length / sr
174182

183+
if len(well_indices_to_remove) > 0:
184+
signal_streams = np.delete(signal_streams, np.array(well_indices_to_remove))
185+
175186
sig_channels = np.array(sig_channels, dtype=_signal_channel_dtype)
176187

177188
spike_channels = []

0 commit comments

Comments
 (0)