Skip to content

Add Neuropixels 2.0 support to read_spikegadgets_neuropixels#441

Open
h-mayorquin wants to merge 12 commits into
SpikeInterface:mainfrom
h-mayorquin:support_spikegadgets_20
Open

Add Neuropixels 2.0 support to read_spikegadgets_neuropixels#441
h-mayorquin wants to merge 12 commits into
SpikeInterface:mainfrom
h-mayorquin:support_spikegadgets_20

Conversation

@h-mayorquin
Copy link
Copy Markdown
Collaborator

This PR adds Neuropixels 2.0 single-shank and 4-shank support to read_spikegadgets_neuropixels, completing the follow-up flagged in #418 for the SpikeGadgets Bennu datalogger. The reader now dispatches on the (device, deviceSubType) pair from <SpikeConfiguration> and supports three entries: NP1.0 standard (unchanged behavior, plus a fallback for older recordings that predate the deviceSubType attribute), NP2.0 single-shank, and NP2.0 4-shank. As with NP1.0 in #418, the geometry-equivalence argument lets us hardcode a single catalogue part number per family (NP2014 for 4-shank, NP2000 for single-shank) while clearing model_name and description on the sliced probe. For the 4-shank path, the contact-ordering remap is verified against a header-only fixture provided by Alessio from (the full recording is on gin under spikegadgets/neuropixels2_4shank/).

We don't have test data for the single-shank path. The catalogue pick (NP2000) is on as solid ground as the other two formats since all NP2.0 single-shank SKUs (NP2000, NP2003, NP2004) share identical 2D geometry by the same equivalence argument used for NP1.0 in #418 and NP2.0 4-shank here. The only unverified piece is the channel-index remap: I am relying on an agent reading the Trodes source code, with an agent cross-checking the relevant sections of configuration.cpp for provenance, to infer that Trodes' channelsOn bitmask for the single-shank case is the same row-major pattern as 4-shank collapsed to two columns. When test data for a single-shank .rec becomes available the only thing the test needs to confirm is the within-row column direction; the cautionary docstring can then be removed. The same approach (catalogue geometry plus Trodes source) could extend to the remaining variants Trodes can emit (NP1.0 HD, NP1.0 NHP short/medium/long, NRIC) but I can add that in another PR as there is already a PR open for spikegadgets 2.0 and this indicates is a user request at the moment.

@RobertoDF
Copy link
Copy Markdown

RobertoDF commented May 22, 2026

Regarding channel ordering NPX 2 Mattias Karlsson (SpikeGadget):"
So the Trodes streaming interface shows you how the electrodes are numbered based on where they are on the probe. For example, the 2.0 four-shank probe has two columns per shank. So the interface is showing 8 columns total. The first electrode on the probe (starts with 1) is in the lower right, and number 10008 is on the lower left. Then, 10009 is the second row on the right, and so on."
image

I have a file (not so small unfortunately, 1GB) here https://www.dropbox.com/t/nnkTRfC0JB7hdVj2 NPX 2 4 shanks with Bennu.

Mattias Karlsson, the Trodes author, confirmed the channelsOn layout
empirically derived in SpikeInterface#441 on the PR thread. Quote the relevant
description directly in the docstring so the formula has a primary-source
citation next to it, not just the fixture-based verification.

Co-Authored-By: Roberto <37729096+RobertoDF@users.noreply.github.com>
@h-mayorquin
Copy link
Copy Markdown
Collaborator Author

Thanks @RobertoDF, that confirmation from Mattias is exactly what we needed for the 4-shank case. I added the quote to the docstring of the channel remap function in #441 so it's on record next to the formula itself. You are also credit here and will be marked as contributor of this PR as you started the work on #439

I also tried your .rec file on both this branch and python-neo: everything loads Ok (1 probe, 4 shanks × 96 contacts each, 61.5 s of binary at 30 kHz, all stereotactic annotations populated).

@alejoe91 I think this is ready to unless I am getting something wrong.

@RobertoDF
Copy link
Copy Markdown

thanks, amazing job!

@h-mayorquin
Copy link
Copy Markdown
Collaborator Author

@RobertoDF did I get it right that you can talk directly Mattias? would you be open to relaying two short links his way? Both are related to what we discussed above:

The Bitbucket one in particular is something Mattias would be the right person to look at. No urgency, just whenever you happen to be in touch with him. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants