Skip to content

Commit

Permalink
Merge branch 'main' into more_fixes_before_release
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin authored Dec 19, 2024
2 parents 8a3e2e8 + 2084d35 commit 4dd1cd6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* Fix a bug where data in `DeepLabCutInterface` failed to write when `ndx-pose` was not imported. [#1144](https://github.com/catalystneuro/neuroconv/pull/1144)
* `SpikeGLXConverterPipe` converter now accepts multi-probe structures with multi-trigger and does not assume a specific folder structure [#1150](https://github.com/catalystneuro/neuroconv/pull/1150)
* `SpikeGLXNIDQInterface` is no longer written as an ElectricalSeries [#1152](https://github.com/catalystneuro/neuroconv/pull/1152)
* Fix a bug on ecephys interfaces where extra electrode group and devices were written if the property of the "group_name" was set in the recording extractor [#1164](https://github.com/catalystneuro/neuroconv/pull/1164)


## Features
* Propagate the `unit_electrode_indices` argument from the spikeinterface tools to `BaseSortingExtractorInterface`. This allows users to map units to the electrode table when adding sorting data [PR #1124](https://github.com/catalystneuro/neuroconv/pull/1124)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ def get_metadata_schema(self) -> dict:
def get_metadata(self) -> DeepDict:
metadata = super().get_metadata()

channel_groups_array = self.recording_extractor.get_channel_groups()
from ...tools.spikeinterface.spikeinterface import _get_group_name

channel_groups_array = _get_group_name(recording=self.recording_extractor)
unique_channel_groups = set(channel_groups_array) if channel_groups_array is not None else ["ElectrodeGroup"]
electrode_metadata = [
dict(name=str(group_id), description="no description", location="unknown", device="DeviceEcephys")
Expand Down
14 changes: 13 additions & 1 deletion tests/test_ecephys/test_ecephys_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def test_electrode_indices_assertion_error_when_missing_table(self, setup_interf

class TestRecordingInterface(RecordingExtractorInterfaceTestMixin):
data_interface_cls = MockRecordingInterface
interface_kwargs = dict(durations=[0.100])
interface_kwargs = dict(num_channels=4, durations=[0.100])

def test_stub(self, setup_interface):
interface = self.interface
Expand All @@ -146,6 +146,18 @@ def test_always_write_timestamps(self, setup_interface):
expected_timestamps = self.interface.recording_extractor.get_times()
np.testing.assert_array_equal(electrical_series.timestamps[:], expected_timestamps)

def test_group_naming_not_adding_extra_devices(self, setup_interface):

interface = self.interface
recording_extractor = interface.recording_extractor
recording_extractor.set_channel_groups(groups=[0, 1, 2, 3])
recording_extractor.set_property(key="group_name", values=["group1", "group2", "group3", "group4"])

nwbfile = interface.create_nwbfile()

assert len(nwbfile.devices) == 1
assert len(nwbfile.electrode_groups) == 4


class TestAssertions(TestCase):
@pytest.mark.skipif(python_version.minor != 10, reason="Only testing with Python 3.10!")
Expand Down

0 comments on commit 4dd1cd6

Please sign in to comment.