Skip to content

Commit e3f9099

Browse files
committed
better docstring
1 parent a568e89 commit e3f9099

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

src/probeinterface/neuropixels_tools.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -486,22 +486,36 @@ def _annotate_contacts_from_mux_table(probe: Probe, adc_groups_array: np.array):
486486
"""
487487
Annotate a Probe object with ADC group and sample order information based on the MUX table.
488488
489-
This function is used when building a complete Neuropixels probe from the ProbeTable specifications
490-
(via build_neuropixels_probe) to assign per-contact annotations for adc_group and adc_sample_order,
491-
which describe how each contact maps to the ADCs during recording.
492-
The function annotates the probe in place.
493-
494-
This function assumes that contact index ``i`` in the probe corresponds to
495-
readout channel ``i``. This holds when the probe has been sliced in readout
496-
channel order, which is the case for both ``read_spikeglx`` (IMRO order) and
497-
``read_openephys`` (sorted by channel number).
489+
Neuropixels probes multiplex their electrodes through a fixed set of ADCs. For
490+
example, an NP2000 probe has 24 ADCs, each sampling 16 readout channels in
491+
sequence. The ``adc_groups_array`` encodes this mapping: each row is one sampling
492+
time slot, and the values are readout channel numbers that are sampled
493+
simultaneously (one per ADC). For example, if row 0 contains
494+
``[0, 1, 32, 33, 64, 65, ...]``, it means readout channels 0, 1, 32, 33, 64, 65
495+
are all sampled at the same time by different ADCs.
496+
497+
This function uses those readout channel numbers directly as indices into the
498+
probe's contact array to assign two per-contact annotations:
499+
500+
- ``adc_group``: which ADC samples this contact (column index in the table)
501+
- ``adc_sample_order``: at which time step within the ADC's cycle this contact
502+
is sampled (row index in the table)
503+
504+
This means contact index ``i`` in the probe must correspond to readout channel
505+
``i``. This holds when the probe has been sliced in readout channel order, which
506+
is the case for both ``read_spikeglx`` (IMRO table lists channels in readout
507+
order 0-383) and ``read_openephys`` (channels sorted by ``CH`` number, which
508+
corresponds to readout channel number). If the probe contacts were reordered
509+
(e.g., sorted by position on the shank), these annotations would be wrong.
498510
499511
Parameters
500512
----------
501513
probe : Probe
502514
The Probe object to annotate. Contacts must be in readout channel order.
503515
adc_groups_array : np.array
504-
The ADC groups array from the probe features, which describes how readout channels map to ADCs.
516+
Array shaped ``(num_time_slots, num_adcs)`` where each value is a readout
517+
channel number. Readout channel at ``adc_groups_array[slot, adc]`` is
518+
sampled by ADC ``adc`` at time slot ``slot``.
505519
"""
506520
# Map readout channels to ADC groups and sample order.
507521
# The indices in adc_groups_array are readout channel numbers, and we

0 commit comments

Comments
 (0)