diff --git a/src/probeinterface/io.py b/src/probeinterface/io.py index f5cbe8f..cc01e04 100644 --- a/src/probeinterface/io.py +++ b/src/probeinterface/io.py @@ -965,6 +965,26 @@ def write_csv(file, probe): "ap_hp_filters", ), }, + # NP-Opto + "opto": { + "probe_name": "Neuropixels Opto", + "x_pitch": 48, + "y_pitch": 20, + "contact_width": 12, + "stagger": 0.0, + "shank_pitch": 0, + "shank_number": 1, + "ncol": 2, + "polygon": polygon_description["default"], + "fields_in_imro_table": ( + "channel_ids", + "banks", + "references", + "ap_gains", + "lf_gains", + "ap_hp_filters", + ), + }, } @@ -1437,6 +1457,7 @@ def read_openephys( contact_ids = [] pname = np_probe.attrib["probe_name"] + headstage_part_number = np_probe.attrib.get("headstage_part_number", "") if "2.0" in pname: x_shift = -8 if "Multishank" in pname: @@ -1446,12 +1467,16 @@ def read_openephys( elif "NHP" in pname: ptype = 0 x_shift = -11 - elif "1.0" in pname: - ptype = 0 - x_shift = -11 elif "Ultra" in pname: ptype = 1100 x_shift = -8 + elif "1.0" in pname and "OPTO" in headstage_part_number: + # take care of OE NPIX v<0.4.1, where Opto probes were named 1.0 + ptype = "opto" + x_shift = -11 + elif "1.0" in pname: + ptype = 0 + x_shift = -11 else: # Probe type unknown ptype = None x_shift = 0 @@ -1479,8 +1504,9 @@ def read_openephys( else: contact_ids.append(f"e{contact_id}") + model_name = npx_probe[ptype]["probe_name"] if ptype is not None else pname np_probe_dict = { - "model_name": pname, + "model_name": model_name, "shank_ids": shank_ids, "contact_ids": contact_ids, "positions": positions, diff --git a/tests/data/openephys/OE_Neuropix-PXI-NP2-4shank/settings.xml b/tests/data/openephys/OE_Neuropix-PXI-NP2-4shank/settings.xml new file mode 100644 index 0000000..4d39cc1 --- /dev/null +++ b/tests/data/openephys/OE_Neuropix-PXI-NP2-4shank/settings.xml @@ -0,0 +1,324 @@ + + + + + 0.6.5 + 8 + 3 Oct 2023 18:57:09 + Windows 10 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/test_io/test_openephys.py b/tests/test_io/test_openephys.py index a9efb15..761ff21 100644 --- a/tests/test_io/test_openephys.py +++ b/tests/test_io/test_openephys.py @@ -16,6 +16,14 @@ def test_NP2(): assert "2.0 - Single Shank" in probe.model_name +def test_NP2_four_shank(): + # NP2 + probe = read_openephys(data_path / "OE_Neuropix-PXI-NP2-4shank" / "settings.xml") + # on this case, only shanks 2-3 are used + assert probe.get_shank_count() == 2 + assert "2.0 - Four Shank" in probe.model_name + + def test_NP1_subset(): # NP1 - 200 channels selected by recording_state in Record Node probe_ap = read_openephys( @@ -89,13 +97,13 @@ def test_multiple_probes(): ) assert probeB2.get_shank_count() == 1 - assert "2.0 - Multishank" in probeB2.model_name + assert "2.0 - Four Shank" in probeB2.model_name ypos = probeB2.contact_positions[:, 1] assert np.min(ypos) >= 0 -def test_np_otpo_with_sync(): +def test_np_opto_with_sync(): probe = read_openephys(data_path / "OE_Neuropix-PXI-opto-with-sync" / "settings.xml") assert probe.model_name == "Neuropixels Opto" assert probe.get_shank_count() == 1 @@ -111,7 +119,7 @@ def test_older_than_06_format(): ) assert probe.get_shank_count() == 4 - assert "2.0 - Multishank" in probe.model_name + assert "2.0 - Four Shank" in probe.model_name ypos = probe.contact_positions[:, 1] assert np.min(ypos) >= 0