Skip to content

Commit

Permalink
Fix stream in Plexon 1 interface (#1013)
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin authored Sep 17, 2024
1 parent f950792 commit 36464df
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
id: cache-ephys-datasets
with:
path: ./ephy_testing_data
key: ephys-datasets-2024-06-21-ubuntu-latest-${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
key: ephys-datasets-2024-08-30-ubuntu-latest-${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
- name: Get ophys_testing_data current head hash
id: ophys
run: echo "::set-output name=HASH_OPHYS_DATASET::$(git ls-remote https://gin.g-node.org/CatalystNeuro/ophys_testing_data.git HEAD | cut -f1)"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doctests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
id: cache-ephys-datasets
with:
path: ./ephy_testing_data
key: ephys-datasets-2024-08-07-${{ matrix.os }}-${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
key: ephys-datasets-2024-08-30-${{ matrix.os }}-${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
- name: Get ophys_testing_data current head hash
id: ophys
run: echo "::set-output name=HASH_OPHYS_DATASET::$(git ls-remote https://gin.g-node.org/CatalystNeuro/ophys_testing_data.git HEAD | cut -f1)"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/formatwise-installation-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
id: cache-ephys-datasets
with:
path: ./ephy_testing_data
key: ephys-datasets-2024-08-27-${{ matrix.os }}-${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
key: ephys-datasets-2024-08-30-${{ matrix.os }}-${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
- name: Get ophys_testing_data current head hash
id: ophys
run: echo "::set-output name=HASH_OPHYS_DATASET::$(git ls-remote https://gin.g-node.org/CatalystNeuro/ophys_testing_data.git HEAD | cut -f1)"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/neuroconv_docker_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
id: cache-ephys-datasets
with:
path: ./ephy_testing_data
key: ephys-datasets-2023-06-26-${{ matrix.os }}-${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
key: ephys-datasets-2024-08-30-${{ matrix.os }}-${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
- name: Get ophys_testing_data current head hash
id: ophys
run: echo "::set-output name=HASH_OPHYS_DATASET::$(git ls-remote https://gin.g-node.org/CatalystNeuro/ophys_testing_data.git HEAD | cut -f1)"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
id: cache-ephys-datasets
with:
path: ./ephy_testing_data
key: ephys-datasets-2024-08-07-${{ matrix.os }}-${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
key: ephys-datasets-2024-08-30-${{ matrix.os }}-${{ steps.ephys.outputs.HASH_EPHY_DATASET }}
- name: Get ophys_testing_data current head hash
id: ophys
run: echo "::set-output name=HASH_OPHYS_DATASET::$(git ls-remote https://gin.g-node.org/CatalystNeuro/ophys_testing_data.git HEAD | cut -f1)"
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## Bug Fixes
* Fixed a setup bug introduced in `v0.6.2` where installation process created a directory instead of a file for test configuration file [PR #1070](https://github.com/catalystneuro/neuroconv/pull/1070)
* The method `get_extractor` now works for `MockImagingInterface` [PR #1076](https://github.com/catalystneuro/neuroconv/pull/1076)
* Solved a bug of `PlexonRecordingInterface` where data with multiple streams could not be opened [PR #989](https://github.com/catalystneuro/neuroconv/pull/989)

## Deprecations

Expand Down
2 changes: 1 addition & 1 deletion docs/conversion_examples_gallery/recording/plexon.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Convert Plexon recording data to NWB using :py:class:`~neuroconv.datainterfaces.
>>> from pathlib import Path
>>> from neuroconv.datainterfaces import PlexonRecordingInterface
>>>
>>> file_path = f"{ECEPHY_DATA_PATH}/plexon/File_plexon_3.plx"
>>> file_path = f"{ECEPHY_DATA_PATH}/plexon/4chDemoPLX.plx"
>>> # Change the file_path to the location in your system
>>> interface = PlexonRecordingInterface(file_path=file_path, verbose=False)
>>>
Expand Down
17 changes: 15 additions & 2 deletions src/neuroconv/datainterfaces/ecephys/plexon/plexondatainterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ def get_source_schema(cls) -> dict:
return source_schema

@validate_call
def __init__(self, file_path: FilePath, verbose: bool = True, es_key: str = "ElectricalSeries"):
def __init__(
self,
file_path: FilePath,
verbose: bool = True,
es_key: str = "ElectricalSeries",
stream_name: str = "WB-Wideband",
):
"""
Load and prepare data for Plexon.
Expand All @@ -36,8 +42,15 @@ def __init__(self, file_path: FilePath, verbose: bool = True, es_key: str = "Ele
verbose : bool, default: True
Allows verbosity.
es_key : str, default: "ElectricalSeries"
stream_name: str, optional
Only pass a stream if you modified the channel prefixes in the Plexon file and you know the prefix of
the wideband data.
"""
super().__init__(file_path=file_path, verbose=verbose, es_key=es_key)

invalid_stream_names = ["FPl-Low Pass Filtered", "SPKC-High Pass Filtered", "AI-Auxiliary Input"]
assert stream_name not in invalid_stream_names, f"Invalid stream name: {stream_name}"

super().__init__(file_path=file_path, verbose=verbose, es_key=es_key, stream_name=stream_name)

def get_metadata(self) -> DeepDict:
metadata = super().get_metadata()
Expand Down
2 changes: 1 addition & 1 deletion src/neuroconv/datainterfaces/ecephys/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
spikeinterface>=0.101.0
neo>=0.13.2
neo>=0.13.3
5 changes: 2 additions & 3 deletions tests/test_on_data/ecephys/test_recording_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,10 +693,9 @@ def check_read_nwb(self, nwbfile_path: str):
class TestPlexonRecordingInterface(RecordingExtractorInterfaceTestMixin):
data_interface_cls = PlexonRecordingInterface
interface_kwargs = dict(
# Only File_plexon_3.plx has an ecephys recording stream
file_path=str(ECEPHY_DATA_PATH / "plexon" / "File_plexon_3.plx"),
file_path=str(ECEPHY_DATA_PATH / "plexon" / "4chDemoPLX.plx"),
)
save_directory = OUTPUT_PATH

def check_extracted_metadata(self, metadata: dict):
assert metadata["NWBFile"]["session_start_time"] == datetime(2010, 2, 22, 20, 0, 57)
assert metadata["NWBFile"]["session_start_time"] == datetime(2013, 11, 19, 13, 48, 13)

0 comments on commit 36464df

Please sign in to comment.