diff --git a/CHANGELOG.md b/CHANGELOG.md index ea82d8ae1..79ce3fd4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # Upcoming -### Improvements +### Bug fixes +* Fixed the default naming of multiple electrical series in the `SpikeGLXConverterPipe`. [PR #957](https://github.com/catalystneuro/neuroconv/pull/957) +### Improvements * The `OpenEphysBinaryRecordingInterface` now uses `lxml` for extracting the session start time from the settings.xml file and does not depend on `pyopenephys` anymore. [PR #971](https://github.com/catalystneuro/neuroconv/pull/971) * Swap the majority of package setup and build steps to `pyproject.toml` instead of `setup.py`. [PR #955](https://github.com/catalystneuro/neuroconv/pull/955) * The `DeeplabcutInterface` now skips inferring timestamps from movie when timestamps are specified, running faster. [PR #967](https://github.com/catalystneuro/neuroconv/pull/967) diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglx_utils.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglx_utils.py index cc90d112c..e57f25fa0 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglx_utils.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglx_utils.py @@ -12,12 +12,15 @@ def add_recording_extractor_properties(recording_extractor) -> None: probe = recording_extractor.get_probe() channel_ids = recording_extractor.get_channel_ids() + # Should follow pattern 'Imec0', 'Imec1', etc. + probe_name = recording_extractor.stream_id[:5].capitalize() + if probe.get_shank_count() > 1: - group_name = [contact_id.split("e")[0] for contact_id in probe.contact_ids] shank_electrode_number = [int(contact_id.split("e")[1]) for contact_id in probe.contact_ids] + group_name = [f"{probe_name}{contact_id.split('e')[0]}" for contact_id in probe.contact_ids] else: shank_electrode_number = recording_extractor.ids_to_indices(channel_ids) - group_name = ["s0"] * len(channel_ids) + group_name = [f"{probe_name}Shank0"] * len(channel_ids) recording_extractor.set_property(key="shank_electrode_number", ids=channel_ids, values=shank_electrode_number) recording_extractor.set_property(key="group_name", ids=channel_ids, values=group_name) @@ -113,9 +116,9 @@ def get_device_metadata(meta) -> dict: if "imDatBsc_pn" in meta: metadata_dict.update(connected_base_station_part_number=meta["imDatBsc_pn"]) - description_string = "no description" + description_string = "A Neuropixel probe of unknown subtype." if metadata_dict: description_string = json.dumps(metadata_dict) - device_metadata = dict(name="Neuropixel-Imec", description=description_string, manufacturer="Imec") + device_metadata = dict(name="NeuropixelImec", description=description_string, manufacturer="Imec") return device_metadata diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py index bdfe50dd8..eccd430c4 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxconverter.py @@ -67,14 +67,16 @@ def __init__( file_path = ( folder_path / f"{folder_path.stem}_{probe_name}" / f"{folder_path.stem}_t0.{probe_name}.ap.bin" ) - interface = SpikeGLXRecordingInterface(file_path=file_path) - if "lf" in stream: + es_key = f"ElectricalSeriesAP{probe_name.capitalize()}" + interface = SpikeGLXRecordingInterface(file_path=file_path, es_key=es_key) + elif "lf" in stream: probe_name = stream[:5] file_path = ( folder_path / f"{folder_path.stem}_{probe_name}" / f"{folder_path.stem}_t0.{probe_name}.lf.bin" ) - interface = SpikeGLXRecordingInterface(file_path=file_path) - if "nidq" in stream: + es_key = f"ElectricalSeriesLF{probe_name.capitalize()}" + interface = SpikeGLXRecordingInterface(file_path=file_path, es_key=es_key) + elif "nidq" in stream: file_path = folder_path / f"{folder_path.stem}_t0.nidq.bin" interface = SpikeGLXNIDQInterface(file_path=file_path) data_interfaces.update({str(stream): interface}) # Without str() casting, is a numpy string diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py index 79a831910..54a593714 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxdatainterface.py @@ -76,12 +76,16 @@ def get_metadata(self) -> dict: # Device metadata device = get_device_metadata(self.meta) + # Should follow pattern 'Imec0', 'Imec1', etc. + probe_name = self.stream_id[:5].capitalize() + device["name"] = f"Neuropixel{probe_name}" + # Add groups metadata metadata["Ecephys"]["Device"] = [device] electrode_groups = [ dict( name=group_name, - description=f"a group representing shank {group_name}", + description=f"A group representing probe/shank '{group_name}'.", location="unknown", device=device["name"], ) diff --git a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py index 0f3eee182..61bf6b056 100644 --- a/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py +++ b/src/neuroconv/datainterfaces/ecephys/spikeglx/spikeglxnidqinterface.py @@ -3,7 +3,7 @@ import numpy as np -from .spikeglx_utils import get_device_metadata, get_session_start_time +from .spikeglx_utils import get_session_start_time from ..baserecordingextractorinterface import BaseRecordingExtractorInterface from ....tools.signal_processing import get_rising_frames_from_ttl from ....utils import FilePathType, get_schema_from_method_signature @@ -72,7 +72,11 @@ def get_metadata(self) -> dict: metadata["NWBFile"]["session_start_time"] = session_start_time # Device metadata - device = get_device_metadata(self.meta) + device = dict( + name="NIDQBoard", + description="A NIDQ board used in conjunction with SpikeGLX.", + manufacturer="National Instruments", + ) # Add groups metadata metadata["Ecephys"]["Device"] = [device] diff --git a/tests/test_ecephys/test_mock_nidq_interface.py b/tests/test_ecephys/test_mock_nidq_interface.py index 31dbbcf92..c0fb4eed2 100644 --- a/tests/test_ecephys/test_mock_nidq_interface.py +++ b/tests/test_ecephys/test_mock_nidq_interface.py @@ -49,13 +49,17 @@ def test_mock_metadata(): expected_ecephys_metadata = { "Ecephys": { "Device": [ - {"description": "no description", "manufacturer": "Imec", "name": "Neuropixel-Imec"}, + { + "name": "NIDQBoard", + "description": "A NIDQ board used in conjunction with SpikeGLX.", + "manufacturer": "National Instruments", + }, ], "ElectrodeGroup": [ { "name": "NIDQChannelGroup", "description": "A group representing the NIDQ channels.", - "device": "Neuropixel-Imec", + "device": "NIDQBoard", "location": "unknown", }, ], @@ -68,7 +72,7 @@ def test_mock_metadata(): }, } } - print(metadata["Ecephys"]) + assert metadata["Ecephys"] == expected_ecephys_metadata["Ecephys"] expected_start_time = datetime(2020, 11, 3, 10, 35, 10) @@ -88,7 +92,13 @@ def test_mock_run_conversion(tmpdir: pathlib.Path): with NWBHDF5IO(path=nwbfile_path, mode="r") as io: nwbfile = io.read() - assert "Neuropixel-Imec" in nwbfile.devices + assert "NIDQBoard" in nwbfile.devices + assert len(nwbfile.devices) == 1 + assert "NIDQChannelGroup" in nwbfile.electrode_groups + assert len(nwbfile.electrode_groups) == 1 + assert list(nwbfile.electrodes.id[:]) == [0, 1, 2, 3, 4, 5, 6, 7] + assert "ElectricalSeriesNIDQ" in nwbfile.acquisition + assert len(nwbfile.acquisition) == 1 diff --git a/tests/test_on_data/test_format_converters/single_probe_metadata.json b/tests/test_on_data/test_format_converters/single_probe_metadata.json deleted file mode 100644 index c7a2bc4df..000000000 --- a/tests/test_on_data/test_format_converters/single_probe_metadata.json +++ /dev/null @@ -1 +0,0 @@ -{"NWBFile": {"session_description": ""}, "Ecephys": {"Device": [{"name": "Neuropixel-Imec", "description": "{\"probe_type\": \"0\", \"probe_type_description\": \"NP1.0\", \"flex_part_number\": \"NP2_FLEX_0\", \"connected_base_station_part_number\": \"NP2_QBSC_00\"}", "manufacturer": "Imec"}], "ElectrodeGroup": [{"name": "s0", "description": "a group representing shank s0", "location": "unknown", "device": "Neuropixel-Imec"}, {"name": "NIDQChannelGroup", "description": "A group representing the NIDQ channels.", "location": "unknown", "device": "Neuropixel-Imec"}], "ElectricalSeriesAP": {"name": "ElectricalSeriesAP", "description": "Acquisition traces for the ElectricalSeriesAP."}, "Electrodes": [{"name": "shank_electrode_number", "description": "0-indexed channel within a shank."}, {"name": "group_name", "description": "Name of the ElectrodeGroup this electrode is a part of."}, {"name": "contact_shapes", "description": "The shape of the electrode"}], "ElectricalSeriesNIDQ": {"name": "ElectricalSeriesNIDQ", "description": "Raw acquisition traces from the NIDQ (.nidq.bin) channels."}, "ElectricalSeriesLF": {"name": "ElectricalSeriesLF", "description": "Acquisition traces for the ElectricalSeriesLF."}}} diff --git a/tests/test_on_data/test_format_converters/spikeglx_multi_probe_metadata.json b/tests/test_on_data/test_format_converters/spikeglx_multi_probe_metadata.json new file mode 100644 index 000000000..bbe98c44f --- /dev/null +++ b/tests/test_on_data/test_format_converters/spikeglx_multi_probe_metadata.json @@ -0,0 +1,63 @@ +{ + "NWBFile": { + "session_description": "" + }, + "Ecephys": { + "Device": [ + { + "name": "NeuropixelImec0", + "description": "{\"probe_type\": \"0\", \"probe_type_description\": \"NP1.0\", \"flex_part_number\": \"NP2_FLEX_0\", \"connected_base_station_part_number\": \"NP2_QBSC_00\"}", + "manufacturer": "Imec" + }, + { + "name": "NeuropixelImec1", + "description": "{\"probe_type\": \"0\", \"probe_type_description\": \"NP1.0\", \"flex_part_number\": \"NP2_FLEX_0\", \"connected_base_station_part_number\": \"NP2_QBSC_00\"}", + "manufacturer": "Imec" + } + ], + "ElectrodeGroup": [ + { + "name": "Imec0Shank0", + "description": "A group representing probe/shank 'Imec0Shank0'.", + "location": "unknown", + "device": "NeuropixelImec0" + }, + { + "name": "Imec1Shank0", + "description": "A group representing probe/shank 'Imec1Shank0'.", + "location": "unknown", + "device": "NeuropixelImec1" + } + ], + "ElectricalSeriesAPImec0": { + "name": "ElectricalSeriesAPImec0", + "description": "Acquisition traces for the ElectricalSeriesAPImec0." + }, + "Electrodes": [ + { + "name": "shank_electrode_number", + "description": "0-indexed channel within a shank." + }, + { + "name": "group_name", + "description": "Name of the ElectrodeGroup this electrode is a part of." + }, + { + "name": "contact_shapes", + "description": "The shape of the electrode" + } + ], + "ElectricalSeriesAPImec1": { + "name": "ElectricalSeriesAPImec1", + "description": "Acquisition traces for the ElectricalSeriesAPImec1." + }, + "ElectricalSeriesLFImec0": { + "name": "ElectricalSeriesLFImec0", + "description": "Acquisition traces for the ElectricalSeriesLFImec0." + }, + "ElectricalSeriesLFImec1": { + "name": "ElectricalSeriesLFImec1", + "description": "Acquisition traces for the ElectricalSeriesLFImec1." + } + } +} diff --git a/tests/test_on_data/test_format_converters/spikeglx_single_probe_metadata.json b/tests/test_on_data/test_format_converters/spikeglx_single_probe_metadata.json new file mode 100644 index 000000000..5a5e04bde --- /dev/null +++ b/tests/test_on_data/test_format_converters/spikeglx_single_probe_metadata.json @@ -0,0 +1,59 @@ +{ + "NWBFile": { + "session_description": "" + }, + "Ecephys": { + "Device": [ + { + "name": "NeuropixelImec0", + "description": "{\"probe_type\": \"0\", \"probe_type_description\": \"NP1.0\", \"flex_part_number\": \"NP2_FLEX_0\", \"connected_base_station_part_number\": \"NP2_QBSC_00\"}", + "manufacturer": "Imec" + }, + { + "name": "NIDQBoard", + "description": "A NIDQ board used in conjunction with SpikeGLX.", + "manufacturer": "National Instruments" + } + ], + "ElectrodeGroup": [ + { + "name": "Imec0Shank0", + "description": "A group representing probe/shank 'Imec0Shank0'.", + "location": "unknown", + "device": "NeuropixelImec0" + }, + { + "name": "NIDQChannelGroup", + "description": "A group representing the NIDQ channels.", + "location": "unknown", + "device": "NIDQBoard" + } + ], + "ElectricalSeriesAPImec0": { + "name": "ElectricalSeriesAPImec0", + "description": "Acquisition traces for the ElectricalSeriesAPImec0." + }, + "Electrodes": [ + { + "name": "shank_electrode_number", + "description": "0-indexed channel within a shank." + }, + { + "name": "group_name", + "description": "Name of the ElectrodeGroup this electrode is a part of." + }, + { + "name": "contact_shapes", + "description": "The shape of the electrode" + } + ], + "ElectricalSeriesNIDQ": { + "name": "ElectricalSeriesNIDQ", + "description": "Raw acquisition traces from the NIDQ (.nidq.bin) channels." + }, + "ElectricalSeriesLFImec0": { + "name": "ElectricalSeriesLFImec0", + "description": "Acquisition traces for the ElectricalSeriesLFImec0." + } + } +} diff --git a/tests/test_on_data/test_format_converters/test_spikeglx_converter.py b/tests/test_on_data/test_format_converters/test_spikeglx_converter.py index d723e240e..910e238a0 100644 --- a/tests/test_on_data/test_format_converters/test_spikeglx_converter.py +++ b/tests/test_on_data/test_format_converters/test_spikeglx_converter.py @@ -1,5 +1,4 @@ import datetime -import importlib from copy import deepcopy from datetime import datetime from pathlib import Path @@ -30,43 +29,45 @@ def setUp(self): def tearDown(self): rmtree(self.tmpdir) - def assertNWBFileStructure(self, nwbfile_path: FilePath): + def assertNWBFileStructure(self, nwbfile_path: FilePath, expected_session_start_time: datetime): with NWBHDF5IO(path=nwbfile_path) as io: nwbfile = io.read() - expected_session_start_time = datetime(2020, 11, 3, 10, 35, 10).astimezone() assert nwbfile.session_start_time == expected_session_start_time - assert "ElectricalSeriesAP" in nwbfile.acquisition - assert "ElectricalSeriesLF" in nwbfile.acquisition + assert "ElectricalSeriesAPImec0" in nwbfile.acquisition + assert "ElectricalSeriesLFImec0" in nwbfile.acquisition assert "ElectricalSeriesNIDQ" in nwbfile.acquisition + assert len(nwbfile.acquisition) == 3 - assert "Neuropixel-Imec" in nwbfile.devices + assert "NeuropixelImec0" in nwbfile.devices + assert "NIDQBoard" in nwbfile.devices + assert len(nwbfile.devices) == 2 assert "NIDQChannelGroup" in nwbfile.electrode_groups - assert "s0" in nwbfile.electrode_groups + assert "Imec0Shank0" in nwbfile.electrode_groups + assert len(nwbfile.electrode_groups) == 2 def test_single_probe_spikeglx_converter(self): converter = SpikeGLXConverterPipe(folder_path=SPIKEGLX_PATH / "Noise4Sam_g0") - # import json metadata = converter.get_metadata() test_metadata = deepcopy(metadata) for exclude_field in ["session_start_time", "identifier"]: test_metadata["NWBFile"].pop(exclude_field) - expected_metadata = load_dict_from_file(file_path=Path(__file__).parent / "single_probe_metadata.json") - neuroconv_version = importlib.metadata.version("neuroconv") + expected_metadata = load_dict_from_file(file_path=Path(__file__).parent / "spikeglx_single_probe_metadata.json") # Exclude watermarks from testing assertions del test_metadata["NWBFile"]["source_script"] del test_metadata["NWBFile"]["source_script_file_name"] - self.assertDictEqual(d1=test_metadata, d2=expected_metadata) + assert test_metadata == expected_metadata - nwbfile_path = self.tmpdir / "test_spikeglx_converter.nwb" + nwbfile_path = self.tmpdir / "test_single_probe_spikeglx_converter.nwb" converter.run_conversion(nwbfile_path=nwbfile_path, metadata=metadata) - self.assertNWBFileStructure(nwbfile_path=nwbfile_path) + expected_session_start_time = datetime(2020, 11, 3, 10, 35, 10).astimezone() + self.assertNWBFileStructure(nwbfile_path=nwbfile_path, expected_session_start_time=expected_session_start_time) def test_in_converter_pipe(self): spikeglx_converter = SpikeGLXConverterPipe(folder_path=SPIKEGLX_PATH / "Noise4Sam_g0") @@ -75,7 +76,8 @@ def test_in_converter_pipe(self): nwbfile_path = self.tmpdir / "test_spikeglx_converter_in_converter_pipe.nwb" converter_pipe.run_conversion(nwbfile_path=nwbfile_path) - self.assertNWBFileStructure(nwbfile_path=nwbfile_path) + expected_session_start_time = datetime(2020, 11, 3, 10, 35, 10).astimezone() + self.assertNWBFileStructure(nwbfile_path=nwbfile_path, expected_session_start_time=expected_session_start_time) def test_in_nwbconverter(self): class TestConverter(NWBConverter): @@ -91,10 +93,71 @@ class TestConverter(NWBConverter): nwbfile_path = self.tmpdir / "test_spikeglx_converter_in_nwbconverter.nwb" converter.run_conversion(nwbfile_path=nwbfile_path) - self.assertNWBFileStructure(nwbfile_path=nwbfile_path) + expected_session_start_time = datetime(2020, 11, 3, 10, 35, 10).astimezone() + self.assertNWBFileStructure(nwbfile_path=nwbfile_path, expected_session_start_time=expected_session_start_time) + + +class TestMultiProbeSpikeGLXConverter(TestCase): + maxDiff = None + + def setUp(self): + self.tmpdir = Path(mkdtemp()) + + def tearDown(self): + rmtree(self.tmpdir) + + def assertNWBFileStructure(self, nwbfile_path: FilePath, expected_session_start_time: datetime): + with NWBHDF5IO(path=nwbfile_path) as io: + nwbfile = io.read() + + assert nwbfile.session_start_time == expected_session_start_time + + # TODO: improve name of segments using 'Segment{index}' for clarity + assert "ElectricalSeriesAPImec00" in nwbfile.acquisition + assert "ElectricalSeriesAPImec01" in nwbfile.acquisition + assert "ElectricalSeriesAPImec10" in nwbfile.acquisition + assert "ElectricalSeriesAPImec11" in nwbfile.acquisition + assert "ElectricalSeriesLFImec00" in nwbfile.acquisition + assert "ElectricalSeriesLFImec01" in nwbfile.acquisition + assert "ElectricalSeriesLFImec10" in nwbfile.acquisition + assert "ElectricalSeriesLFImec11" in nwbfile.acquisition + assert len(nwbfile.acquisition) == 8 + + assert "NeuropixelImec0" in nwbfile.devices + assert "NeuropixelImec1" in nwbfile.devices + assert len(nwbfile.devices) == 2 + + assert "Imec0Shank0" in nwbfile.electrode_groups + assert "Imec1Shank0" in nwbfile.electrode_groups + assert len(nwbfile.electrode_groups) == 2 + + def test_multi_probe_spikeglx_converter(self): + converter = SpikeGLXConverterPipe( + folder_path=SPIKEGLX_PATH / "multi_trigger_multi_gate" / "SpikeGLX" / "5-19-2022-CI0" / "5-19-2022-CI0_g0" + ) + metadata = converter.get_metadata() + + test_metadata = deepcopy(metadata) + for exclude_field in ["session_start_time", "identifier"]: + test_metadata["NWBFile"].pop(exclude_field) + expected_metadata = load_dict_from_file(file_path=Path(__file__).parent / "spikeglx_multi_probe_metadata.json") + + # Exclude watermarks from testing assertions + del test_metadata["NWBFile"]["source_script"] + del test_metadata["NWBFile"]["source_script_file_name"] + + assert test_metadata == expected_metadata + + nwbfile_path = self.tmpdir / "test_multi_probe_spikeglx_converter.nwb" + converter.run_conversion(nwbfile_path=nwbfile_path, metadata=metadata) + + expected_session_start_time = datetime(2022, 5, 19, 17, 37, 47).astimezone() + self.assertNWBFileStructure(nwbfile_path=nwbfile_path, expected_session_start_time=expected_session_start_time) def test_electrode_table_writing(tmp_path): + from spikeinterface.extractors.nwbextractors import NwbRecordingExtractor + converter = SpikeGLXConverterPipe(folder_path=SPIKEGLX_PATH / "Noise4Sam_g0") metadata = converter.get_metadata() @@ -114,7 +177,7 @@ def test_electrode_table_writing(tmp_path): np.testing.assert_array_equal(saved_channel_names, expected_channel_names_nidq) # Test AP - electrical_series = nwbfile.acquisition["ElectricalSeriesAP"] + electrical_series = nwbfile.acquisition["ElectricalSeriesAPImec0"] ap_electrodes_table_region = electrical_series.electrodes region_indices = ap_electrodes_table_region.data recording_extractor = converter.data_interface_objects["imec0.ap"].recording_extractor @@ -124,7 +187,7 @@ def test_electrode_table_writing(tmp_path): np.testing.assert_array_equal(saved_channel_names, expected_channel_names_ap) # Test LF - electrical_series = nwbfile.acquisition["ElectricalSeriesLF"] + electrical_series = nwbfile.acquisition["ElectricalSeriesLFImec0"] lf_electrodes_table_region = electrical_series.electrodes region_indices = lf_electrodes_table_region.data recording_extractor = converter.data_interface_objects["imec0.lf"].recording_extractor @@ -141,11 +204,9 @@ def test_electrode_table_writing(tmp_path): io.write(nwbfile) # Test round trip with spikeinterface - from spikeinterface.extractors.nwbextractors import NwbRecordingExtractor - recording_extractor_ap = NwbRecordingExtractor( file_path=nwbfile_path, - electrical_series_name="ElectricalSeriesAP", + electrical_series_name="ElectricalSeriesAPImec0", ) channel_ids = recording_extractor_ap.get_channel_ids() @@ -153,7 +214,7 @@ def test_electrode_table_writing(tmp_path): recording_extractor_lf = NwbRecordingExtractor( file_path=nwbfile_path, - electrical_series_name="ElectricalSeriesLF", + electrical_series_name="ElectricalSeriesLFImec0", ) channel_ids = recording_extractor_lf.get_channel_ids() diff --git a/tests/test_on_data/test_metadata/test_spikeglx_metadata.py b/tests/test_on_data/test_metadata/test_spikeglx_metadata.py index 596543167..89e8398c1 100644 --- a/tests/test_on_data/test_metadata/test_spikeglx_metadata.py +++ b/tests/test_on_data/test_metadata/test_spikeglx_metadata.py @@ -30,9 +30,10 @@ def test_spikelgx_recording_property_addition(): meta_filename = str(ap_file_path).replace(".bin", ".meta") probe = pi.read_spikeglx(meta_filename) n_channels = probe.device_channel_indices.size + probe_name = "Imec0" expected_shank_electrode_number = [int(contact_id.split("e")[1]) for contact_id in probe.contact_ids] - expected_group_name = [contact_id.split("e")[0] for contact_id in probe.contact_ids] + expected_group_name = [f"{probe_name}{contact_id.split('e')[0]}" for contact_id in probe.contact_ids] expected_contact_shapes = ["square"] * n_channels # Initialize the interface and get the added properties diff --git a/tests/test_on_data/test_recording_interfaces.py b/tests/test_on_data/test_recording_interfaces.py index 650bce827..6c3a410e2 100644 --- a/tests/test_on_data/test_recording_interfaces.py +++ b/tests/test_on_data/test_recording_interfaces.py @@ -491,7 +491,7 @@ class TestSpikeGLXRecordingInterface(RecordingExtractorInterfaceTestMixin, TestC def check_extracted_metadata(self, metadata: dict): assert metadata["NWBFile"]["session_start_time"] == datetime(2020, 11, 3, 10, 35, 10) assert metadata["Ecephys"]["Device"][-1] == dict( - name="Neuropixel-Imec", + name="NeuropixelImec0", description="{" '"probe_type": "0", ' '"probe_type_description": "NP1.0", ' @@ -519,7 +519,7 @@ class TestSpikeGLXRecordingInterfaceLongNHP(RecordingExtractorInterfaceTestMixin def check_extracted_metadata(self, metadata: dict): assert metadata["NWBFile"]["session_start_time"] == datetime(2024, 1, 3, 11, 51, 51) assert metadata["Ecephys"]["Device"][-1] == dict( - name="Neuropixel-Imec", + name="NeuropixelImec0", description="{" '"probe_type": "1030", ' '"probe_type_description": "NP1.0 NHP", '