Skip to content

Commit a400cda

Browse files
committed
fix spikegadgets
1 parent 315f485 commit a400cda

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

neo/rawio/spikegadgetsrawio.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,16 @@ def _parse_header(self):
207207
signal_streams.append((stream_name, stream_id))
208208
self._mask_channels_bytes[stream_id] = []
209209

210-
channel_ids = self._produce_ephys_channel_ids(num_ephy_channels, num_chan_per_chip)
210+
# we can only produce these channels for a subset of spikegadgets setup. If this criteria isn't
211+
# true then we should just use the raw_channel_ids and let the end user sort everything out
212+
if num_ephy_channels%num_chan_per_chip == 0:
213+
channel_ids = self._produce_ephys_channel_ids(num_ephy_channels, num_chan_per_chip)
214+
raw_channel_ids = False
215+
else:
216+
raw_channel_ids = True
217+
211218
chan_ind = 0
212-
self.is_scaleable = "spikeScalingToUv" in sconf[0].attrib
219+
self.is_scaleable = all("spikeScalingToUv" in trode.attrib for trode in sconf)
213220
if not self.is_scaleable:
214221
self.logger.warning(
215222
"Unable to read channel gain scaling (to uV) from .rec header. Data has no physical units!"
@@ -224,8 +231,12 @@ def _parse_header(self):
224231
units = ""
225232

226233
for schan in trode:
227-
chan_id = str(channel_ids[chan_ind])
228-
name = "hwChan" + chan_id
234+
if raw_channel_ids:
235+
name = "trode" + trode.attrib["id"] + "chan" + schan.attrib["hwChan"]
236+
chan_id = schan.attrib["hwChan"]
237+
else:
238+
chan_id = str(channel_ids[chan_ind])
239+
name = "hwChan" + chan_id
229240

230241
offset = 0.0
231242
signal_channels.append(

0 commit comments

Comments
 (0)