Skip to content

Commit 6e02e3c

Browse files
author
Lennart
committed
Fix issue due to disparity between routed and mapped channels
1 parent 6c7af90 commit 6e02e3c

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

neo/rawio/maxwellrawio.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ def __init__(self, filename="", rec_name=None):
6565

6666
def _source_name(self):
6767
return self.filename
68+
69+
def _get_ids_and_electrodes(self, version, stream_id, h5file, mapping):
70+
if int(version) == 20160704:
71+
ids = np.array(mapping["channel"])
72+
els = np.array(mapping["electrode"])
73+
else:
74+
ids = np.array(h5file["wells"][stream_id][self.rec_name]["groups"]["routed"]["channels"])
75+
els = np.array(mapping["electrode"])
76+
ids = ids[ids >= 0]
77+
mask = np.isin(np.array(mapping["channel"]), ids)
78+
return ids, els[mask]
79+
6880

6981
def _parse_header(self):
7082
import h5py
@@ -175,11 +187,7 @@ def _parse_header(self):
175187
}
176188
self._stream_buffer_slice[stream_id] = slice(None)
177189

178-
channel_ids = np.array(mapping["channel"])
179-
electrode_ids = np.array(mapping["electrode"])
180-
mask = channel_ids >= 0
181-
channel_ids = channel_ids[mask]
182-
electrode_ids = electrode_ids[mask]
190+
channel_ids, electrode_ids = self._get_ids_and_electrodes(version, stream_id, h5file, mapping)
183191

184192
for i, chan_id in enumerate(channel_ids):
185193
elec_id = electrode_ids[i]

0 commit comments

Comments
 (0)