From b4ad91dfaa1fca6aca913bd2174144ee4f94fbb9 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Tue, 27 May 2025 16:21:36 -0600 Subject: [PATCH 1/3] fix converter pipe --- CHANGELOG.md | 1 + .../datainterfaces/ecephys/spikeglx/spikeglxconverter.py | 7 +++++-- .../ecephys/spikeglx/spikeglxdatainterface.py | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2ca865941..3978b5256d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Removals, Deprecations and Changes ## Bug Fixes +* Fix a bug for avoiding loading the sync stream in `SpikeGLXConverterPipe` [PR #TBD](https://github.com/catalystneuro/neuroconv/pull/TBD) ## Features * Extra optional kwargs to `BlackrockRecordingInterface` and `BlackrockSortingInterface` for finer control of the neo reader [PR #12](https://github.com/catalystneuro/neuroconv/pull/1290) diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py index 14ce99c0d5..9b7caa81ce 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py @@ -88,8 +88,11 @@ def __init__( data_interfaces = dict() nidq_streams = [stream_id for stream_id in streams_ids if stream_id == "nidq"] - electrical_streams = [stream_id for stream_id in streams_ids if stream_id not in nidq_streams] - for stream_id in electrical_streams: + sync_streams = [stream_id for stream_id in streams_ids if "SYNC" in stream_id] + neural_streams = [ + stream_id for stream_id in streams_ids if stream_id not in nidq_streams and stream_id not in sync_streams + ] + for stream_id in neural_streams: data_interfaces[stream_id] = SpikeGLXRecordingInterface(folder_path=folder_path, stream_id=stream_id) for stream_id in nidq_streams: diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py index b09d00fab2..28c2a7440e 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py @@ -71,6 +71,11 @@ def __init__( "SpikeGLXRecordingInterface is not designed to handle nidq files. Use SpikeGLXNIDQInterface instead" ) + if "SYNC" in stream_id: + raise ValueError( + "SpikeGLXRecordingInterface is not designed to handle the SYNC stream. Open an issue if you need this functionality." + ) + if file_path is not None: warnings.warn( "file_path is deprecated and will be removed by the end of 2025. " From 5d16fa03e3e0a52d180f37c15862a13bf9bf6368 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Tue, 27 May 2025 16:22:55 -0600 Subject: [PATCH 2/3] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3978b5256d..f3623dc66e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ ## Removals, Deprecations and Changes ## Bug Fixes -* Fix a bug for avoiding loading the sync stream in `SpikeGLXConverterPipe` [PR #TBD](https://github.com/catalystneuro/neuroconv/pull/TBD) +* Fix a bug for avoiding loading the sync stream in `SpikeGLXConverterPipe` [PR #1373](https://github.com/catalystneuro/neuroconv/pull/1373) ## Features * Extra optional kwargs to `BlackrockRecordingInterface` and `BlackrockSortingInterface` for finer control of the neo reader [PR #12](https://github.com/catalystneuro/neuroconv/pull/1290) From 747b68ddfbd263d286ddb20819e9d2eac4897595 Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Wed, 28 May 2025 09:30:45 -0600 Subject: [PATCH 3/3] fix tests --- .../datainterfaces/ecephys/spikeglx/spikeglxconverter.py | 5 ++--- .../datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py index 9b7caa81ce..d086d78aa7 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py @@ -89,9 +89,8 @@ def __init__( nidq_streams = [stream_id for stream_id in streams_ids if stream_id == "nidq"] sync_streams = [stream_id for stream_id in streams_ids if "SYNC" in stream_id] - neural_streams = [ - stream_id for stream_id in streams_ids if stream_id not in nidq_streams and stream_id not in sync_streams - ] + stream_is_neural = lambda stream_id: stream_id not in nidq_streams and "SYNC" not in sync_streams + neural_streams = [stream_id for stream_id in streams_ids if stream_is_neural(stream_id)] for stream_id in neural_streams: data_interfaces[stream_id] = SpikeGLXRecordingInterface(folder_path=folder_path, stream_id=stream_id) diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py index 28c2a7440e..ff31ed718d 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py @@ -71,7 +71,7 @@ def __init__( "SpikeGLXRecordingInterface is not designed to handle nidq files. Use SpikeGLXNIDQInterface instead" ) - if "SYNC" in stream_id: + if stream_id is not None and "SYNC" in stream_id: raise ValueError( "SpikeGLXRecordingInterface is not designed to handle the SYNC stream. Open an issue if you need this functionality." )