Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Spyglass Compatibility to the conversion #11

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,5 @@ def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict):
led_configuration=led_configuration,
led_list=led_list,
led_positions=led_positions,
tags=[epoch_name],
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pydantic import FilePath
import copy
from collections import Counter
from typing import Optional
from typing import Optional, Literal

from neuroconv.basedatainterface import BaseDataInterface
from neuroconv.datainterfaces import SpikeGadgetsRecordingInterface
Expand Down Expand Up @@ -137,7 +137,18 @@ def reformat_metadata(self, reformatted_metadata: dict) -> dict:
reformatted_metadata["Ecephys"]["ElectrodeGroup"].append(electrode_group)
return reformatted_metadata

def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict, **conversion_options):
def add_to_nwbfile(
self,
nwbfile: NWBFile,
metadata: dict,
stub_test: bool = False,
starting_time: Optional[float] = None,
write_as: Literal["raw", "lfp", "processed"] = "raw",
write_electrical_series: bool = True,
iterator_type: Optional[str] = "v2",
iterator_opts: Optional[dict] = None,
always_write_timestamps: bool = False,
):
metadata = self.reformat_metadata(metadata)
channel_ids = self.recording_extractor.get_channel_ids()
channel_names = self.recording_extractor.get_property(key="channel_name", ids=channel_ids)
Expand All @@ -164,8 +175,28 @@ def add_to_nwbfile(self, nwbfile: NWBFile, metadata: dict, **conversion_options)
key="brain_area", ids=channel_ids, values=locations
) # brain_area in spikeinterface is location in nwb

super().add_to_nwbfile(
nwbfile=nwbfile, metadata=metadata, starting_time=self.starting_time, **conversion_options
# from BaseRecordingExtractorInterface
from .tools.spikeinterface import add_recording_to_nwbfile

if stub_test or self.subset_channels is not None:
recording = self.subset_recording(stub_test=stub_test)
else:
recording = self.recording_extractor

if metadata is None:
metadata = self.get_metadata()

add_recording_to_nwbfile(
recording=recording,
nwbfile=nwbfile,
metadata=metadata,
starting_time=self.starting_time,
write_as=write_as,
write_electrical_series=write_electrical_series,
es_key=self.es_key,
iterator_type=iterator_type,
iterator_opts=iterator_opts,
always_write_timestamps=always_write_timestamps,
)


Expand Down
Loading