@@ -381,7 +381,6 @@ def build_neuropixels_probe(probe_part_number: str) -> Probe:
381381 # ===== 1. Load configuration =====
382382 probe_features = _load_np_probe_features ()
383383 probe_spec_dict = probe_features ["neuropixels_probes" ][probe_part_number ]
384- mux_table_string = probe_features ["z_mux_tables" ][probe_spec_dict ["mux_table_format_type" ]]
385384
386385 # ===== 2. Calculate electrode IDs and shank IDs =====
387386 num_shanks = int (probe_spec_dict ["num_shanks" ])
@@ -447,6 +446,9 @@ def build_neuropixels_probe(probe_part_number: str) -> Probe:
447446 contour += list (polygon + shank_shift )
448447
449448 # Apply contour shift to align with contact positions
449+ # This constant (11 μm) represents the vertical distance from the center of the bottommost
450+ # electrode to the top of the shank tip. This is a geometric constant for Neuropixels probes
451+ # that is not currently available in the ProbeTable specifications.
450452 middle_of_bottommost_electrode_to_top_of_shank_tip = 11
451453 contour_shift = np .array ([- odd_offset , - middle_of_bottommost_electrode_to_top_of_shank_tip ])
452454 contour = np .array (contour ) + contour_shift
@@ -470,15 +472,26 @@ def build_neuropixels_probe(probe_part_number: str) -> Probe:
470472 )
471473
472474 # ===== 8. Add MUX table annotations =====
475+ mux_table_string = probe_features ["z_mux_tables" ][probe_spec_dict ["mux_table_format_type" ]]
473476 if mux_table_string is not None :
474- num_adcs , num_channels_per_adc , mux_table = make_mux_table_array (mux_table_string )
477+ # Parse MUX table string: (num_adcs,num_channels_per_adc)(int int ...)(int int ...)...
478+ adc_info = mux_table_string .split (")(" )[0 ]
479+ split_mux = mux_table_string .split (")(" )[1 :]
480+ num_adcs , num_channels_per_adc = map (int , adc_info [1 :].split ("," ))
481+ adc_groups_list = [
482+ np .array (each_mux .replace ("(" , "" ).replace (")" , "" ).split (" " )).astype ("int" ) for each_mux in split_mux
483+ ]
484+ mux_table = np .transpose (np .array (adc_groups_list ))
485+
486+ # Map contacts to ADC groups and sample order
475487 num_contacts = positions .shape [0 ]
476488 adc_groups = np .zeros (num_contacts , dtype = "int64" )
477489 adc_sample_order = np .zeros (num_contacts , dtype = "int64" )
478490 for adc_index , adc_groups_per_adc in enumerate (mux_table ):
479491 adc_groups_per_adc = adc_groups_per_adc [adc_groups_per_adc < num_contacts ]
480492 adc_groups [adc_groups_per_adc ] = adc_index
481493 adc_sample_order [adc_groups_per_adc ] = np .arange (len (adc_groups_per_adc ))
494+
482495 probe .annotate (num_adcs = num_adcs )
483496 probe .annotate (num_channels_per_adc = num_channels_per_adc )
484497 probe .annotate_contacts (adc_group = adc_groups )
0 commit comments