From 5d1766999478dcf615b2c3feb2b75cc88dffbfd3 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Tue, 27 May 2025 15:45:10 -0600 Subject: [PATCH] fix loading data from the sync stream --- src/spikeinterface/extractors/neoextractors/spikeglx.py | 9 +++++++-- .../extractors/tests/test_neoextractors.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/spikeinterface/extractors/neoextractors/spikeglx.py b/src/spikeinterface/extractors/neoextractors/spikeglx.py index 4e900097ea..df3728fe6a 100644 --- a/src/spikeinterface/extractors/neoextractors/spikeglx.py +++ b/src/spikeinterface/extractors/neoextractors/spikeglx.py @@ -75,13 +75,18 @@ def __init__( self._kwargs.update(dict(folder_path=str(Path(folder_path).absolute()), load_sync_channel=load_sync_channel)) + stream_is_nidq_or_sync = "nidq" in self.stream_id or "SYNC" in self.stream_id + if stream_is_nidq_or_sync: + # Do not add probe information for the sync or nidq stream. Early return + return None + # Checks if the probe information is available and adds location, shanks and sample shift if available. signals_info_dict = {e["stream_name"]: e for e in self.neo_reader.signals_info_list} meta_filename = signals_info_dict[self.stream_id]["meta_file"] + ap_meta_filename = meta_filename.replace(".lf", ".ap") if "lf" in self.stream_id else meta_filename ap_meta_file_exists = Path(ap_meta_filename).exists() - stream_is_not_nidq = "nidq" not in self.stream_id - add_probe_properties = ap_meta_file_exists and stream_is_not_nidq and not load_sync_channel + add_probe_properties = ap_meta_file_exists and not load_sync_channel if add_probe_properties: probe = probeinterface.read_spikeglx(ap_meta_filename) diff --git a/src/spikeinterface/extractors/tests/test_neoextractors.py b/src/spikeinterface/extractors/tests/test_neoextractors.py index 395f1e0d9e..e6b19167db 100644 --- a/src/spikeinterface/extractors/tests/test_neoextractors.py +++ b/src/spikeinterface/extractors/tests/test_neoextractors.py @@ -67,9 +67,9 @@ class SpikeGLXRecordingTest(RecordingCommonTestSuite, unittest.TestCase): downloads = ["spikeglx"] entities = [ ("spikeglx/Noise4Sam_g0", {"stream_id": "imec0.ap"}), - ("spikeglx/Noise4Sam_g0", {"stream_id": "imec0.ap", "load_sync_channel": True}), ("spikeglx/Noise4Sam_g0", {"stream_id": "imec0.lf"}), ("spikeglx/Noise4Sam_g0", {"stream_id": "nidq"}), + ("spikeglx/Noise4Sam_g0", {"stream_id": "imec0.ap-SYNC"}), ]