Skip to content

Commit feaa386

Browse files
committed
Add NP2 onix data and support SELECTED_ELECTRODES
1 parent ececc17 commit feaa386

3 files changed

Lines changed: 406 additions & 8 deletions

File tree

src/probeinterface/neuropixels_tools.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -860,23 +860,22 @@ def read_openephys(
860860
# now load probe info from NP_PROBE fields
861861
np_probes_info = []
862862
for probe_idx, np_probe in enumerate(np_probes):
863-
# selected_channels is the preferred way to instantiate the probe
863+
# selected_electrodes is the preferred way to instantiate the probe
864864
# if this field is available, a full probe is created from the probe_part_number
865-
# and then sliced using the selected channels
865+
# and then sliced using the selected electrodes.
866866
# if not available, the xpos and ypos fields are used to create the probe
867-
# if onix_processor is None:
868867
slot = np_probe.attrib.get("slot")
869868
port = np_probe.attrib.get("port")
870869
dock = np_probe.attrib.get("dock")
871870
probe_part_number = np_probe.attrib.get("probe_part_number") or np_probe.attrib.get("probePartNumber")
872871
probe_serial_number = np_probe.attrib.get("probe_serial_number") or np_probe.attrib.get("probeSerialNumber")
873-
selected_channels = np_probe.find("SELECTED_CHANNELS")
872+
selected_electrodes = np_probe.find("SELECTED_ELECTRODES") or np_probe.find("SELECTED_CHANNELS")
874873
channels = np_probe.find("CHANNELS")
875874

876875
pt_metadata, _, mux_info = get_probe_metadata_from_probe_features(probe_features, probe_part_number)
877876

878-
if selected_channels is not None:
879-
selected_channels_values = selected_channels.attrib.values()
877+
if selected_electrodes is not None:
878+
selected_electrodes_values = selected_electrodes.attrib.values()
880879

881880
num_shank = pt_metadata["num_shanks"]
882881
contact_per_shank = pt_metadata["cols_per_shank"] * pt_metadata["rows_per_shank"]
@@ -892,9 +891,9 @@ def read_openephys(
892891
pt_metadata, probe_part_number, elec_ids, shank_ids, mux_info=mux_info
893892
)
894893

895-
selected_channel_indices = [int(channel_index) for channel_index in selected_channels_values]
894+
selected_electrode_indices = [int(electrode_index) for electrode_index in selected_electrodes_values]
896895

897-
sliced_probe = full_probe.get_slice(selection=selected_channel_indices)
896+
sliced_probe = full_probe.get_slice(selection=selected_electrode_indices)
898897

899898
np_probe_dict = {
900899
"pt_metadata": pt_metadata,

0 commit comments

Comments
 (0)