neurocarto.probe_npx.utils

neurocarto.probe_npx.utils.set_electrodes(chmap, shank=None, column=None, row=None, *, overwrite=False)

add electrodes.

Parameters:
  • chmap (ChannelMap) – a channelmap instance

  • shank (int | slice | range | list[int] | ndarray[tuple[int, ...], dtype[int64]] | None) – shank

  • column (int | slice | range | list[int] | ndarray[tuple[int, ...], dtype[int64]] | None) – column

  • row (int | slice | range | list[int] | ndarray[tuple[int, ...], dtype[int64]] | None) – row. It ranges from 0 to total number of rows on one shank. If block present, it ranges from 0 to total number of rows in a block. If only bank present, it ranges from 0 to total number of rows in a bank.

  • block – block. If ranges from 0 to total number of blocks on one shank. If bank present. If ranges from 0 to total number of blocks in one bank.

  • bank – bank. If ranges from 0 to total number of banks on one shank.

  • overwrite – overwrite the used channel with new electrode.

Returns:

added electrodes.

Return type:

list[Electrode]

neurocarto.probe_npx.utils.npx24_single_shank(shank, row=0, *, um=False)

Make a block channelmap for 4-shank Neuropixels probe.

>>> print_probe(npx24_single_shank(0))
624▕ ▏▕ ▏▕ ▏▕ ▏
576▕ ▏▕ ▏▕ ▏▕ ▏
528▕ ▏▕ ▏▕ ▏▕ ▏
480▕ ▏▕ ▏▕ ▏▕ ▏
432▕ ▏▕ ▏▕ ▏▕ ▏
384▕ ▏▕ ▏▕ ▏▕ ▏
336▕ ▏▕ ▏▕ ▏▕ ▏
288▕ ▏▕ ▏▕ ▏▕ ▏
240▕ ▏▕ ▏▕ ▏▕ ▏
192▕ ▏▕ ▏▕ ▏▕ ▏
144▕█▏▕ ▏▕ ▏▕ ▏
 96▕█▏▕ ▏▕ ▏▕ ▏
 48▕█▏▕ ▏▕ ▏▕ ▏
  0▕█▏▕ ▏▕ ▏▕ ▏
    ╹  ╹  ╹  ╹
Parameters:
  • shank (int)

  • row (int) – beginning row from tip.

  • um (bool) – use um in row.

Returns:

npx 24 channelmap instance

Return type:

ChannelMap

neurocarto.probe_npx.utils.npx24_stripe(row=0, *, um=False)

Make a block channelmap for 4-shank Neuropixels probe.

>>> print_probe(npx24_stripe())
624▕ ▏▕ ▏▕ ▏▕ ▏
576▕ ▏▕ ▏▕ ▏▕ ▏
528▕ ▏▕ ▏▕ ▏▕ ▏
480▕ ▏▕ ▏▕ ▏▕ ▏
432▕ ▏▕ ▏▕ ▏▕ ▏
384▕ ▏▕ ▏▕ ▏▕ ▏
336▕ ▏▕ ▏▕ ▏▕ ▏
288▕ ▏▕ ▏▕ ▏▕ ▏
240▕ ▏▕ ▏▕ ▏▕ ▏
192▕ ▏▕ ▏▕ ▏▕ ▏
144▕ ▏▕ ▏▕ ▏▕ ▏
 96▕ ▏▕ ▏▕ ▏▕ ▏
 48▕ ▏▕ ▏▕ ▏▕ ▏
  0▕█▏▕█▏▕█▏▕█▏
    ╹  ╹  ╹  ╹
Parameters:
  • row (int) – beginning row from tip.

  • um (bool) – use um in row.

Returns:

npx 24 channelmap instance

Return type:

ChannelMap

neurocarto.probe_npx.utils.npx24_half_density(shank, row=0, *, um=False)

Make a channelmap for 4-shank Neuropixels probe that uniformly distributes channels in half density.

>>> print_probe([npx24_half_density(shank=0), npx24_half_density(shank=(0, 1))])
        :              :
        :              :
386▕ ▏▕ ▏▕ ▏▕ ▏386▕ ▏▕ ▏▕ ▏▕ ▏
384▕ ▏▕ ▏▕ ▏▕ ▏384▕ ▏▕ ▏▕ ▏▕ ▏
382▕▚▏▕ ▏▕ ▏▕ ▏382▕ ▏▕ ▏▕ ▏▕ ▏
380▕▚▏▕ ▏▕ ▏▕ ▏380▕ ▏▕ ▏▕ ▏▕ ▏
        :              :
194▕▚▏▕ ▏▕ ▏▕ ▏194▕ ▏▕ ▏▕ ▏▕ ▏
192▕▚▏▕ ▏▕ ▏▕ ▏192▕ ▏▕ ▏▕ ▏▕ ▏
190▕▞▏▕ ▏▕ ▏▕ ▏190▕▞▏▕▚▏▕ ▏▕ ▏
188▕▞▏▕ ▏▕ ▏▕ ▏188▕▞▏▕▚▏▕ ▏▕ ▏
        :              :
  6▕▞▏▕ ▏▕ ▏▕ ▏  6▕▞▏▕▚▏▕ ▏▕ ▏
  4▕▞▏▕ ▏▕ ▏▕ ▏  4▕▞▏▕▚▏▕ ▏▕ ▏
  2▕▞▏▕ ▏▕ ▏▕ ▏  2▕▞▏▕▚▏▕ ▏▕ ▏
  0▕▞▏▕ ▏▕ ▏▕ ▏  0▕▞▏▕▚▏▕ ▏▕ ▏
    ╹  ╹  ╹  ╹     ╹  ╹  ╹  ╹
Parameters:
  • shank (int | tuple[int, int])

  • row (int) – beginning row from tip.

  • um (bool) – use um in row.

Returns:

npx 24 channelmap instance

Return type:

ChannelMap

neurocarto.probe_npx.utils.npx24_quarter_density(shank=None, row=0, *, um=False)

Make a channelmap for 4-shank Neuropixels probe that uniformly distributes channels in quarter density.

>>> print_probe([npx24_quarter_density(shank=0), npx24_quarter_density(shank=(0, 2)), npx24_quarter_density(None)])
638▕▘▏▕ ▏▕ ▏▕ ▏638▕ ▏▕ ▏▕ ▏▕ ▏638▕ ▏▕ ▏▕ ▏▕ ▏
636▕▝▏▕ ▏▕ ▏▕ ▏636▕ ▏▕ ▏▕ ▏▕ ▏636▕ ▏▕ ▏▕ ▏▕ ▏
        :              :
        :              :
386▕▝▏▕ ▏▕ ▏▕ ▏386▕ ▏▕ ▏▕ ▏▕ ▏386▕ ▏▕ ▏▕ ▏▕ ▏
384▕▘▏▕ ▏▕ ▏▕ ▏384▕ ▏▕ ▏▕ ▏▕ ▏384▕ ▏▕ ▏▕ ▏▕ ▏
382▕▖▏▕ ▏▕ ▏▕ ▏382▕▖▏▕ ▏▕▝▏▕ ▏382▕ ▏▕ ▏▕ ▏▕ ▏
380▕▗▏▕ ▏▕ ▏▕ ▏380▕▗▏▕ ▏▕▘▏▕ ▏380▕ ▏▕ ▏▕ ▏▕ ▏
        :              :              :
194▕▖▏▕ ▏▕ ▏▕ ▏194▕▖▏▕ ▏▕▝▏▕ ▏194▕ ▏▕ ▏▕ ▏▕ ▏
192▕▗▏▕ ▏▕ ▏▕ ▏192▕▗▏▕ ▏▕▘▏▕ ▏192▕ ▏▕ ▏▕ ▏▕ ▏
190▕▗▏▕ ▏▕ ▏▕ ▏190▕▗▏▕ ▏▕▘▏▕ ▏190▕▗▏▕▖▏▕▝▏▕▘▏
188▕▖▏▕ ▏▕ ▏▕ ▏188▕▖▏▕ ▏▕▝▏▕ ▏188▕▖▏▕▗▏▕▘▏▕▝▏
        :              :              :
  6▕▗▏▕ ▏▕ ▏▕ ▏  6▕▗▏▕ ▏▕▘▏▕ ▏  6▕▗▏▕▖▏▕▝▏▕▘▏
  4▕▖▏▕ ▏▕ ▏▕ ▏  4▕▖▏▕ ▏▕▝▏▕ ▏  4▕▖▏▕▗▏▕▘▏▕▝▏
  2▕▗▏▕ ▏▕ ▏▕ ▏  2▕▗▏▕ ▏▕▘▏▕ ▏  2▕▗▏▕▖▏▕▝▏▕▘▏
  0▕▖▏▕ ▏▕ ▏▕ ▏  0▕▖▏▕ ▏▕▝▏▕ ▏  0▕▖▏▕▗▏▕▘▏▕▝▏
    ╹  ╹  ╹  ╹     ╹  ╹  ╹  ╹     ╹  ╹  ╹  ╹

Note that npx24_quarter_density(shank=0) remain 64 electrodes unset.

Parameters:
  • shank (int | tuple[int, int] | None)

  • row (int) – beginning row from tip.

  • um (bool) – use um in row.

Returns:

npx 24 channelmap instance

Return type:

ChannelMap

neurocarto.probe_npx.utils.npx24_one_eighth_density(row=0, *, um=False)

Make a channelmap for 4-shank Neuropixels probe that uniformly distributes channels in one-eighth density.

>>> print_probe(npx24_one_eighth_density())
        :
        :
386▕ ▏▕ ▏▕ ▏▕ ▏
384▕ ▏▕ ▏▕ ▏▕ ▏
382▕ ▏▕ ▏▕▖▏▕▘▏
380▕▖▏▕▘▏▕ ▏▕ ▏
        :
  6▕ ▏▕ ▏▕▗▏▕▝▏
  4▕▗▏▕▝▏▕ ▏▕ ▏
  2▕ ▏▕ ▏▕▖▏▕▘▏
  0▕▖▏▕▘▏▕ ▏▕ ▏
    ╹  ╹  ╹  ╹
Parameters:
  • row (int) – beginning row from tip.

  • um (bool) – use um in row.

Returns:

npx 24 channelmap instance

Return type:

ChannelMap

neurocarto.probe_npx.utils.print_probe(chmap, *, file=None, truncate='none', um=False)

print probe in string.

Parameters:
  • chmap (ChannelMap | list[ChannelMap]) – a ChannelMap instance, or a list of ChannelMap

  • file – io, or print

  • truncate (Literal['none', 'top', 'both']) – truncate rows without electrodes

  • um (bool) – print depth from tip in um, instead of row.

Returns:

a string when file is None. Otherwise, return None

Return type:

str | None