Skip to content

Add SpikeGadgets NRIC (Pixie384) support to SpikeGadgetsRawIO - #1981

Open
vonaviv wants to merge 2 commits into
NeuralEnsemble:masterfrom
vonaviv:spikegadgets-nric-support
Open

vonaviv wants to merge 2 commits into
NeuralEnsemble:masterfrom
vonaviv:spikegadgets-nric-support

Conversation

@vonaviv

@vonaviv vonaviv commented Nov 27, 2026

Copy link
Copy Markdown

Summary

SpikeGadgetsRawIO currently rejects recordings from the SpikeGadgets
Pixie384 headstage, whose
amplifier chip (NRIC is same generation as Neuropixels) is declared in the
header as SpikeConfiguration device="neuropixelsNRIC":

NeoReadWriteError: SpikeGadgets: unsupported SpikeConfiguration.device
'neuropixelsNRIC'. Add a dedicated branch for this hardware in
SpikeGadgetsRawIO._parse_header.

This PR adds that branch. The NRIC chip turns out to share the Neuropixels
hwChan-ascending ephys layout, so the device routes through the existing
Neuropixels code path - users no longer need the Trodes export detour
(and its full-size .dat duplicate) to read these recordings.

What changed

  • New module-level _HWCHAN_ASCENDING_DEVICES = ("neuropixels1", "neuropixels2", "neuropixelsNRIC"), replacing the two previously
    duplicated tuples. It gates both the binary-order dispatch and the
    channel naming (id="hwChan{i}", name="probe{spikeSortingGroup}_chan{i}"),
    so there is a single place to extend for future hwChan-ascending devices.
  • Docstrings: module-level NRIC bullet (including why the neuropixels_LFP
    device bytes are packet-size-accounted but not decoded) and a note in
    __init__.
  • Tests: dedicated id/name/gain assertions plus a bit-exact cross-check
    against Trodes' own export; the fixture .rec is added to
    entities_to_test.

Verification

Against a real 384-channel recording (17,356,773 packets, ~579 s, Trodes
2.8.2, deviceSubType="10"):

  • Packet layout: 848 B = 0x55 (1) + Controller_DIO (1) + Multiplexed
    (8) + neuropixels_LFP (66) + timestamp uint32 (4) + 384 × int16 ephys.
  • The ephys region is hwChan-ascending: decoded traces are bit-exact
    against Trodes' export of the same recording on windows spread across
    the file.
  • Gains come from spikeScalingToUv in the XML, so uV scaling works as for
    Neuropixels.

Test data (action needed)

Two small fixtures must be added to ephy_testing_data under
spikegadgets/ (please find them here and upload to gin):

  • SpikeGadgets_test_data_Pixie384_20261104_cropped.rec (1.1 MB:
    XML header + 1000 packets)
  • SpikeGadgets_test_data_Pixie384_20261104_trodes_raw_cropped.dat
    (769 KB: Trodes' export of the same range, ground truth for the
    bit-exact test)

The .rec is listed in entities_to_test, so CI needs the upload before
this can pass; the .dat is deliberately not listed, as it is ground truth
for the dedicated test, not a .rec the RawIO can open.

Notes / limitations

  • Only deviceSubType="10" has been verified against hardware; other NRIC
    subtypes route the same way.
  • The neuropixels_LFP device present in NRIC packets contributes
    numBytes to the packet size only. Its rotating subsampled LFP samples
    (lfpSubsamplingInterval) are not decoded: there is no channel metadata
    for that block, and Trodes exports the LFP band separately.

vivanov added 2 commits November 27, 2026 15:55
SpikeConfiguration device="neuropixelsNRIC" recordings (SpikeGadgets
Pixie384 headstage) share the Neuropixels hwChan-ascending ephys
layout: byte pair i of each packet holds the sample of hwChan i.
Verified bit-exact against the Trodes export of a real 384-channel
recording (deviceSubType "10").

Route the device through the existing hwChan-ascending branch via a
shared `_HWCHAN_ASCENDING_DEVICES` tuple used by both the binary-order
dispatch and the channel naming (id="hwChan{i}",
name="probe{spikeSortingGroup}_chan{i}"). The `neuropixels_LFP` Device
present in NRIC packets contributes `numBytes` to the packet size only
and is not decoded.
Two dedicated tests on a cropped 384-channel recording: one asserts
the Neuropixels id/name/gain semantics (ids "hwChan{i}", names
"probe{spikeSortingGroup}_chan{i}", gain from spikeScalingToUv), the
other cross-checks the decoded ephys region bit-exactly against the
Trodes export of the same recording, pinning the hwChan-ascending
layout of the NRIC device to an independent decoder.

The cropped .rec is also listed in entities_to_test so the generic
compliance suite covers it. The Trodes-exported .dat is ground truth
for the bit-exact comparison and is deliberately not listed there:
SpikeGadgetsRawIO cannot open it. Both fixtures must be added to
ephy_testing_data under spikegadgets/ (the upload has to land before
these tests can run in CI).

This branch has not been deployed

No deployments
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.

1 participant