Skip to content

SpikeGLX is loading XD channels both as events and signal #1718

Open
@h-mayorquin

Description

@h-mayorquin
from neo.rawio import SpikeGLXRawIO
from pathlib import Path

folder_path = Path("/home/heberto/neuroconv_testing_data/ephy_testing_data/spikeglx/DigitalChannelTest_g0")
rawio = SpikeGLXRawIO(folder_path)
rawio.parse_header()
rawio

This is the digital only example on the gin tests:

Image

So for SpikeGLX the XD digital channels (non-mux digital channel) is used to form a memmap and then extract every bit as a line:

def _get_event_timestamps(self, block_index, seg_index, event_channel_index, t_start=None, t_stop=None):
timestamps, durations, labels = [], None, []
info = self.signals_info_dict[0, "nidq"] # There are no events that are not in the nidq stream
dig_ch = info["digital_channels"]
if len(dig_ch) > 0:
event_data = self._events_memmap
channel = dig_ch[event_channel_index]
ch_idx = 7 - int(channel[2:]) # They are in the reverse order
this_stream = event_data[:, ch_idx]
this_rising = np.where(np.diff(this_stream) == 1)[0] + 1
this_falling = (
np.where(np.diff(this_stream) == 255)[0] + 1
) # because the data is in unsigned 8 bit, -1 = 255!
if len(this_rising) > 0:
timestamps.extend(this_rising)
labels.extend([f"{channel} ON"] * len(this_rising))
if len(this_falling) > 0:
timestamps.extend(this_falling)
labels.extend([f"{channel} OFF"] * len(this_falling))
timestamps = np.asarray(timestamps)
if len(labels) == 0:
labels = np.asarray(labels, dtype="U1")
else:
labels = np.asarray(labels)
return timestamps, durations, labels

But it seems that we are also loading the whole channel in the signal.

I think this is OK and probably desired but I wanted to bring your attention that we are providing two ways of accessing the data here in case the discussion comes for another similar case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions