Skip to content

Commit f8f20cf

Browse files
committed
make sure labels are U also when empty
1 parent 36474cb commit f8f20cf

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

neo/rawio/spikeglxrawio.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,11 +308,16 @@ def _get_event_timestamps(self, block_index, seg_index, event_channel_index, t_s
308308
) # because the data is in unsigned 8 bit, -1 = 255!
309309
if len(this_rising) > 0:
310310
timestamps.extend(this_rising)
311-
labels.extend([channel + " ON"] * len(this_rising))
311+
labels.extend([f"{channel} ON"] * len(this_rising))
312312
if len(this_falling) > 0:
313313
timestamps.extend(this_falling)
314-
labels.extend([channel + " OFF"] * len(this_falling))
315-
return np.asarray(timestamps), np.asarray(durations), np.asarray(labels)
314+
labels.extend([f"{channel} OFF"] * len(this_falling))
315+
timestamps = np.asarray(timestamps)
316+
if len(labels) == 0:
317+
labels = np.asarray(labels, dtype="U1")
318+
else:
319+
labels = np.asarray(labels)
320+
return timestamps, durations, labels
316321

317322
def _rescale_event_timestamp(self, event_timestamps, dtype, event_channel_index):
318323
info = self.signals_info_dict[0, "nidq"] # There are no events that are not in the nidq stream
@@ -322,6 +327,9 @@ def _rescale_event_timestamp(self, event_timestamps, dtype, event_channel_index)
322327
event_times = event_timestamps.astype(dtype)
323328
return event_times
324329

330+
def _rescale_epoch_duration(self, raw_duration, dtype, event_channel_index):
331+
return None
332+
325333

326334
def scan_files(dirname):
327335
"""

0 commit comments

Comments
 (0)