-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from catalystneuro/custom_subconverter
Add custom spikeglx subconverter
- Loading branch information
Showing
4 changed files
with
54 additions
and
34 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
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
from ._brainwide_map_converter import BrainwideMapConverter | ||
from ._iblconverter import IblConverter | ||
from ._ibl_spikeglx_converter import IblSpikeGlxConverter | ||
|
||
__all__ = [ | ||
"BrainwideMapConverter", | ||
"IblConverter", | ||
"IblSpikeGlxConverter", | ||
] |
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,44 @@ | ||
from neuroconv.converters import SpikeGLXConverterPipe | ||
from one.api import ONE | ||
from pydantic import DirectoryPath | ||
from pynwb import NWBFile | ||
|
||
|
||
class IblSpikeGlxConverter(SpikeGLXConverterPipe): | ||
|
||
def __init__(self, folder_path: DirectoryPath, one: ONE) -> None: | ||
super().__init__(folder_path=folder_path) | ||
self.one = one | ||
|
||
def temporally_align_data_interfaces(self) -> None: | ||
"""Align the raw data timestamps to the other data streams using the ONE API.""" | ||
# This is the syntax for aligning the raw timestamps; I cannot test this without the actual data as stored | ||
# on your end, so please work with Heberto if there are any problems after uncommenting | ||
# probe_to_imec_map = { | ||
# "probe00": 0, | ||
# "probe01": 1, | ||
# } | ||
# | ||
# ephys_session_loader = EphysSessionLoader(one=self.one, eid=session_id) | ||
# probes = ephys_session_loader.probes | ||
# for probe_name, pid in ephys_session_loader.probes.items(): | ||
# spike_sorting_loader = SpikeSortingLoader(pid=pid, one=ibl_client) | ||
# | ||
# probe_index = probe_to_imec_map[probe_name] | ||
# for band in ["ap", "lf"]: | ||
# recording_interface = next( | ||
# interface | ||
# for interface in self.data_interface_objects | ||
# if f"imec{probe_index}.{band}" in interface.source_data["file_path"] | ||
# ) | ||
# | ||
# band_info = spike_sorting_loader.raw_electrophysiology(band=band, stream=True) | ||
# aligned_timestamps = spike_sorting_loader.samples2times(numpy.arange(0, band_info.ns), direction='forward') | ||
# recording_interface.set_aligned_timestamps(aligned_timestamps=aligned_timestamps) | ||
pass | ||
|
||
def add_to_nwbfile(self, nwbfile: NWBFile, metadata) -> None: | ||
self.temporally_align_data_interfaces() | ||
super().add_to_nwbfile(nwbfile=nwbfile, metadata=metadata) | ||
|
||
# TODO: Add ndx-extracellular-ephys here |