Skip to content

Commit

Permalink
Merge branch 'main' into fix_electrode_group_in_spikeglx
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin authored Jan 15, 2025
2 parents fd69f1b + 935bf6a commit 72b2cd3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Small fixes should be here.

## Improvements
* Improve the naming of ElectrodeGroups in `SpikeGLX` when multi probes are present [PR #1177](https://github.com/catalystneuro/neuroconv/pull/1177)
* Fix metadata bug in `IntanRecordingInterface` where extra devices were added incorrectly if the recording contained multiple electrode groups or names [#1166](https://github.com/catalystneuro/neuroconv/pull/1166)


# v0.6.6 (December 20, 2024)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def get_metadata(self) -> dict:
ecephys_metadata.update(Device=device_list)

electrode_group_metadata = ecephys_metadata["ElectrodeGroup"]
electrode_group_metadata[0]["device"] = intan_device["name"]

for electrode_group in electrode_group_metadata:
electrode_group["device"] = intan_device["name"]
# Add electrodes and electrode groups
ecephys_metadata.update(
ElectricalSeriesRaw=dict(name="ElectricalSeriesRaw", description="Raw acquisition traces."),
Expand Down
26 changes: 24 additions & 2 deletions tests/test_on_data/ecephys/test_recording_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from numpy.testing import assert_array_equal
from packaging import version
from pynwb import NWBHDF5IO
from pynwb.testing.mock.file import mock_NWBFile

from neuroconv.datainterfaces import (
AlphaOmegaRecordingInterface,
Expand Down Expand Up @@ -258,8 +259,6 @@ def setup_interface(self, request):

def test_devices_written_correctly(self, setup_interface):

from pynwb.testing.mock.file import mock_NWBFile

nwbfile = mock_NWBFile()
self.interface.add_to_nwbfile(nwbfile=nwbfile)

Expand All @@ -268,6 +267,29 @@ def test_devices_written_correctly(self, setup_interface):

nwbfile.devices["Intan"].description == "RHD Recording System"

def test_not_adding_extra_devices_when_recording_has_groups(self, setup_interface):
# Test that no extra-devices are added when the recording has groups

nwbfile = mock_NWBFile()
recording = self.interface.recording_extractor
num_channels = recording.get_num_channels()
channel_groups = np.full(shape=num_channels, fill_value=0, dtype=int)
channel_groups[::2] = 1 # Every other channel is in group 1, the rest are in group 0
recording.set_channel_groups(groups=channel_groups)

self.interface.add_to_nwbfile(nwbfile=nwbfile)
assert len(nwbfile.devices) == 1

nwbfile = mock_NWBFile()
recording = self.interface.recording_extractor
num_channels = recording.get_num_channels()
group_names = np.full(shape=num_channels, fill_value="A", dtype="str")
group_names[::2] = "B" # Every other channel group is named B, the rest are named A
recording.set_property("group_name", group_names)

self.interface.add_to_nwbfile(nwbfile=nwbfile)
assert len(nwbfile.devices) == 1


@pytest.mark.skip(reason="This interface fails to load the necessary plugin sometimes.")
class TestMaxOneRecordingInterface(RecordingExtractorInterfaceTestMixin):
Expand Down

0 comments on commit 72b2cd3

Please sign in to comment.