From 3eb846ff5293bcb8fce91b48837487b61906721e Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Sat, 30 Mar 2024 11:24:44 -0600 Subject: [PATCH 1/2] remove stream_id from intan add changelog Update src/neuroconv/datainterfaces/ecephys/intan/intandatainterface.py Co-authored-by: Cody Baker <51133164+CodyCBakerPhD@users.noreply.github.com> --- CHANGELOG.md | 2 + .../ecephys/intan/intandatainterface.py | 43 +++++-------------- .../ecephys/intan/requirements.txt | 1 - 3 files changed, 13 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1720eb930..0b8f0791b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Upcoming +### Bug fixes +* Removed `stream_id` as an argument from `IntanRecordingInterface` [PR #794](https://github.com/catalystneuro/neuroconv/pull/794) # v0.4.8 (March 20, 2024) ### Bug fixes diff --git a/src/neuroconv/datainterfaces/ecephys/intan/intandatainterface.py b/src/neuroconv/datainterfaces/ecephys/intan/intandatainterface.py index 88df3ce34..2f0e2df3e 100644 --- a/src/neuroconv/datainterfaces/ecephys/intan/intandatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/intan/intandatainterface.py @@ -1,4 +1,5 @@ -from pathlib import Path +import warnings +from typing import Optional from packaging.version import Version from pynwb.ecephys import ElectricalSeries @@ -8,35 +9,6 @@ from ....utils import FilePathType, get_schema_from_hdmf_class -def extract_electrode_metadata_with_pyintan(file_path) -> dict: - pyintan = get_package(package_name="pyintan") - - if ".rhd" in Path(file_path).suffixes: - intan_file_metadata = pyintan.intan.read_rhd(file_path)[1] - else: - intan_file_metadata = pyintan.intan.read_rhs(file_path)[1] - - exclude_chan_types = ["AUX", "ADC", "VDD", "_STIM", "ANALOG"] - - valid_channels = [ - x for x in intan_file_metadata if not any([y in x["native_channel_name"] for y in exclude_chan_types]) - ] - - group_names = [channel["native_channel_name"].split("-")[0] for channel in valid_channels] - unique_group_names = set(group_names) - group_electrode_numbers = [channel["native_order"] for channel in valid_channels] - custom_names = [channel["custom_channel_name"] for channel in valid_channels] - - electrodes_metadata = dict( - group_names=group_names, - unique_group_names=unique_group_names, - group_electrode_numbers=group_electrode_numbers, - custom_names=custom_names, - ) - - return electrodes_metadata - - def extract_electrode_metadata(recording_extractor) -> dict: neo_version = get_package_version(name="neo") @@ -73,11 +45,12 @@ class IntanRecordingInterface(BaseRecordingExtractorInterface): display_name = "Intan Recording" associated_suffixes = (".rhd", ".rhs") info = "Interface for Intan recording data." + stream_id = "0" # This is the only stream_id of Intan that might have neural data def __init__( self, file_path: FilePathType, - stream_id: str = "0", + stream_id: Optional[str] = None, verbose: bool = True, es_key: str = "ElectricalSeries", ): @@ -95,7 +68,13 @@ def __init__( es_key : str, default: "ElectricalSeries" """ - self.stream_id = stream_id + if stream_id is not None: + warnings.warn( + "Use of the 'stream_id' parameter is deprecated and it will be removed after September 2024.", + DeprecationWarning, + ) + self.stream_id = stream_id + super().__init__(file_path=file_path, stream_id=self.stream_id, verbose=verbose, es_key=es_key) electrodes_metadata = extract_electrode_metadata(recording_extractor=self.recording_extractor) diff --git a/src/neuroconv/datainterfaces/ecephys/intan/requirements.txt b/src/neuroconv/datainterfaces/ecephys/intan/requirements.txt index afe607e67..e69de29bb 100644 --- a/src/neuroconv/datainterfaces/ecephys/intan/requirements.txt +++ b/src/neuroconv/datainterfaces/ecephys/intan/requirements.txt @@ -1 +0,0 @@ -pyintan>=0.3.0 From 8a1903d196ebc29acd120b0486cc9ed1e02a55ce Mon Sep 17 00:00:00 2001 From: Heberto Mayorquin Date: Sat, 30 Mar 2024 13:32:32 -0600 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b8f0791b..58c8c66d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Upcoming -### Bug fixes +### Deprecations * Removed `stream_id` as an argument from `IntanRecordingInterface` [PR #794](https://github.com/catalystneuro/neuroconv/pull/794) # v0.4.8 (March 20, 2024)