@@ -317,13 +317,18 @@ def _make_npx_probe_from_description(probe_description, model_name, elec_ids, sh
317317 # annotate each contact with its mux channel
318318 num_adcs , num_channels_per_adc , mux_table = make_mux_table_array (mux_info )
319319 num_contacts = positions .shape [0 ]
320+ # mux channel: which adc is used for each contact
320321 mux_channels = np .zeros (num_contacts , dtype = "int64" )
322+ # mux index: order of sampling of the contact in the adc group
323+ mux_index = np .zeros (num_contacts , dtype = "int64" )
321324 for adc_idx , mux_channels_per_adc in enumerate (mux_table ):
322325 mux_channels_per_adc = mux_channels_per_adc [mux_channels_per_adc < num_contacts ]
323326 mux_channels [mux_channels_per_adc ] = adc_idx
327+ mux_index [mux_channels_per_adc ] = np .arange (len (mux_channels_per_adc ))
324328 probe .annotate (num_adcs = num_adcs )
325329 probe .annotate (num_channels_per_adc = num_channels_per_adc )
326330 probe .annotate_contacts (mux_channels = mux_channels )
331+ probe .annotate_contacts (mux_index = mux_index )
327332
328333 return probe
329334
@@ -1044,20 +1049,17 @@ def read_openephys(
10441049 pt_metadata = np_probe_info ["pt_metadata" ]
10451050 mux_info = np_probe_info ["mux_info" ]
10461051
1052+ probe = _make_npx_probe_from_description (
1053+ pt_metadata , probe_part_number , elec_ids , shank_ids = shank_ids , mux_info = mux_info
1054+ )
1055+
10471056 # check if subset of channels
10481057 chans_saved = get_saved_channel_indices_from_openephys_settings (settings_file , stream_name = stream_name )
10491058
10501059 # if a recording state is found, slice probe
10511060 if chans_saved is not None :
1052- positions = positions [chans_saved ]
1053- if shank_ids is not None :
1054- shank_ids = np .array (shank_ids )[chans_saved ]
1055- if elec_ids is not None :
1056- elec_ids = np .array (elec_ids )[chans_saved ]
1061+ probe = probe .get_slice (chans_saved )
10571062
1058- probe = _make_npx_probe_from_description (
1059- pt_metadata , probe_part_number , elec_ids , shank_ids = shank_ids , mux_info = mux_info
1060- )
10611063 probe .serial_number = np_probe_info ["serial_number" ]
10621064 probe .name = np_probe_info ["name" ]
10631065
0 commit comments