From 1bfac0ebc7dabb0ca6cb7ab1a60d91577faf89d2 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Tue, 5 Dec 2023 11:40:00 +0100 Subject: [PATCH 1/3] Add missing NP2.4 probe part number --- src/probeinterface/io.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/probeinterface/io.py b/src/probeinterface/io.py index 5b57c1d1..b2a29f16 100644 --- a/src/probeinterface/io.py +++ b/src/probeinterface/io.py @@ -1026,6 +1026,7 @@ def write_csv(file, probe): "NP2003": "2003", "NP2004": "2004", "PRB2_1_2_0640_0": "21", + "PRB2_4_2_0640_0": "24", # Other probes "NP1100": "1100", # Ultra probe - 1 bank "NP1110": "1100", # Ultra probe - 16 banks From 78c90fc92217572a2049f52d72f0b5703a42ff76 Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Wed, 6 Dec 2023 12:36:12 +0100 Subject: [PATCH 2/3] Add missing NP-Ultra model and fix custom_probe naming in OpenEphys --- src/probeinterface/io.py | 29 +- .../OE_Neuropix-PXI-NP-Ultra/settings.xml | 1156 +++++++++++++++++ tests/test_io/test_openephys.py | 40 +- 3 files changed, 1222 insertions(+), 3 deletions(-) create mode 100644 tests/data/openephys/OE_Neuropix-PXI-NP-Ultra/settings.xml diff --git a/src/probeinterface/io.py b/src/probeinterface/io.py index b2a29f16..1ee0c723 100644 --- a/src/probeinterface/io.py +++ b/src/probeinterface/io.py @@ -958,7 +958,7 @@ def write_csv(file, probe): ), "x_shift": -11, }, - # Ultra probe + # Ultra probes "1100": { "model_name": "Neuropixels Ultra", "x_pitch": 6, @@ -979,6 +979,26 @@ def write_csv(file, probe): ), "x_shift": -8, }, + "1121": { + "model_name": "Neuropixels Ultra - Type 2", + "x_pitch": 6, + "y_pitch": 3, + "contact_width": 2, + "stagger": 0.0, + "shank_pitch": 0, + "shank_number": 1, + "ncol": 1, + "polygon": polygon_description["default"], + "fields_in_imro_table": ( + "channel_ids", + "banks", + "references", + "ap_gains", + "lf_gains", + "ap_hp_filters", + ), + "x_shift": 18, + }, # NP-Opto "1300": { "model_name": "Neuropixels Opto", @@ -1030,6 +1050,7 @@ def write_csv(file, probe): # Other probes "NP1100": "1100", # Ultra probe - 1 bank "NP1110": "1100", # Ultra probe - 16 banks + "NP1121": "1121", # Ultra probe - beta configuration "NP1300": "1300", # Opto probe } @@ -1534,7 +1555,11 @@ def read_openephys( "ptype": ptype, } # Sequentially assign probe names - np_probe_dict.update({"name": probe_names_used[probe_idx]}) + if "custom_probe_name" in np_probe.attrib: + name = np_probe.attrib["custom_probe_name"] + else: + name = probe_names_used[probe_idx] + np_probe_dict.update({"name": name}) np_probes_info.append(np_probe_dict) # now select correct probe (if multiple) diff --git a/tests/data/openephys/OE_Neuropix-PXI-NP-Ultra/settings.xml b/tests/data/openephys/OE_Neuropix-PXI-NP-Ultra/settings.xml new file mode 100644 index 00000000..7f98dbab --- /dev/null +++ b/tests/data/openephys/OE_Neuropix-PXI-NP-Ultra/settings.xml @@ -0,0 +1,1156 @@ + + + + + 0.6.6 + 8 + 8 Nov 2023 8:51:06 + Windows 10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + diff --git a/tests/test_io/test_openephys.py b/tests/test_io/test_openephys.py index 761ff21a..20e58e6e 100644 --- a/tests/test_io/test_openephys.py +++ b/tests/test_io/test_openephys.py @@ -24,6 +24,44 @@ def test_NP2_four_shank(): assert "2.0 - Four Shank" in probe.model_name +def test_NP_Ultra(): + # This dataset has 4 NP-Ultra probes (3 type 1, 1 type 2) + probeA = read_openephys( + data_path / "OE_Neuropix-PXI-NP-Ultra" / "settings.xml", + probe_name="ProbeA", + ) + assert "Ultra" in probeA.model_name + assert probeA.get_shank_count() == 1 + assert probeA.get_contact_count() == 384 + + probeB = read_openephys( + data_path / "OE_Neuropix-PXI-NP-Ultra" / "settings.xml", + probe_name="ProbeB", + ) + assert "Ultra" in probeB.model_name + assert probeB.get_shank_count() == 1 + assert probeB.get_contact_count() == 384 + + probeF = read_openephys( + data_path / "OE_Neuropix-PXI-NP-Ultra" / "settings.xml", + probe_name="ProbeF", + ) + assert "Ultra" in probeF.model_name + assert probeF.get_shank_count() == 1 + assert probeF.get_contact_count() == 384 + + probeD = read_openephys( + data_path / "OE_Neuropix-PXI-NP-Ultra" / "settings.xml", + probe_name="ProbeD", + ) + assert "Ultra" in probeD.model_name and "Type 2" in probeD.model_name + assert probeD.get_shank_count() == 1 + assert probeD.get_contact_count() == 384 + # for this probe model, all channels are aligned + assert len(np.unique(probeD.contact_positions[:, 0])) == 1 + + + def test_NP1_subset(): # NP1 - 200 channels selected by recording_state in Record Node probe_ap = read_openephys( @@ -126,4 +164,4 @@ def test_older_than_06_format(): if __name__ == "__main__": # test_multiple_probes() - test_older_than_06_format() + test_NP_Ultra() From 8a30e6d267da72fa38aab62167e189df65fbe4ff Mon Sep 17 00:00:00 2001 From: Alessio Buccino Date: Wed, 6 Dec 2023 14:47:12 +0100 Subject: [PATCH 3/3] Do not use custom probe name if same as serial number --- src/probeinterface/io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/probeinterface/io.py b/src/probeinterface/io.py index 1ee0c723..90867673 100644 --- a/src/probeinterface/io.py +++ b/src/probeinterface/io.py @@ -1555,7 +1555,7 @@ def read_openephys( "ptype": ptype, } # Sequentially assign probe names - if "custom_probe_name" in np_probe.attrib: + if "custom_probe_name" in np_probe.attrib and np_probe.attrib["custom_probe_name"] != probe_serial_number: name = np_probe.attrib["custom_probe_name"] else: name = probe_names_used[probe_idx]