-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into expose_attempts_in_plexon2
- Loading branch information
Showing
18 changed files
with
1,083 additions
and
486 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
rev: v5.0.0 | ||
hooks: | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
- repo: https://github.com/psf/black | ||
rev: 24.8.0 | ||
rev: 24.10.0 | ||
hooks: | ||
- id: black | ||
files: ^src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from __future__ import annotations | ||
|
||
from pathlib import Path | ||
|
||
from spikeinterface.core.core_tools import define_function_from_class | ||
|
||
from .neobaseextractor import NeoBaseRecordingExtractor, NeoBaseSortingExtractor | ||
|
||
|
||
class NeuroNexusRecordingExtractor(NeoBaseRecordingExtractor): | ||
""" | ||
Class for reading data from NeuroNexus Allego. | ||
Based on :py:class:`neo.rawio.NeuronexusRawIO` | ||
Parameters | ||
---------- | ||
file_path : str | Path | ||
The file path to the metadata .xdat.json file of an Allego session | ||
stream_id : str | None, default: None | ||
If there are several streams, specify the stream id you want to load. | ||
stream_name : str | None, default: None | ||
If there are several streams, specify the stream name you want to load. | ||
all_annotations : bool, default: False | ||
Load exhaustively all annotations from neo. | ||
use_names_as_ids : bool, default: False | ||
Determines the format of the channel IDs used by the extractor. If set to True, the channel IDs will be the | ||
names from NeoRawIO. If set to False, the channel IDs will be the ids provided by NeoRawIO. | ||
In Neuronexus the ids provided by NeoRawIO are the hardware channel ids stored as `ntv_chan_name` within | ||
the metada and the names are the `chan_names` | ||
""" | ||
|
||
NeoRawIOClass = "NeuroNexusRawIO" | ||
|
||
def __init__( | ||
self, | ||
file_path: str | Path, | ||
stream_id: str | None = None, | ||
stream_name: str | None = None, | ||
all_annotations: bool = False, | ||
use_names_as_ids: bool = False, | ||
): | ||
neo_kwargs = self.map_to_neo_kwargs(file_path) | ||
NeoBaseRecordingExtractor.__init__( | ||
self, | ||
stream_id=stream_id, | ||
stream_name=stream_name, | ||
all_annotations=all_annotations, | ||
use_names_as_ids=use_names_as_ids, | ||
**neo_kwargs, | ||
) | ||
|
||
self._kwargs.update(dict(file_path=str(Path(file_path).resolve()))) | ||
|
||
@classmethod | ||
def map_to_neo_kwargs(cls, file_path): | ||
|
||
neo_kwargs = {"filename": str(file_path)} | ||
|
||
return neo_kwargs | ||
|
||
|
||
read_neuronexus = define_function_from_class(source_class=NeuroNexusRecordingExtractor, name="read_neuronexus") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.