-
Notifications
You must be signed in to change notification settings - Fork 260
Open
Milestone
Description
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:
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:
python-neo/neo/rawio/spikeglxrawio.py
Lines 341 to 365 in ab821e7
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
Labels
No labels