Skip to content

BlackrockRawIO drops all spikes on electrodes above 255 in NEV 2.2 files written by Ripple Trellis #1918

Closed

Description

@cboulay

trellis_nev22_sample.zip

Describe the bug

BlackrockRawIO silently drops every spike in NEV files written by Ripple's Trellis software when the electrode IDs are above 255.

Trellis writes .nev/.nsx in Blackrock's format with a 2.2 file spec. Electrode IDs follow Ripple's front-end ports (port A = 1-128, B = 129-256, C = 257-384, ...), so a recording on port C has spike packets with packet IDs 257 and up. For spec 2.1/2.2, NEV_PACKET_IDENTIFIERS_BY_SPEC only recognises spike packet IDs (1, 255). The packets above 255 match no packet type, so:

  • header["spike_channels"] is empty, although the file has a NEUEVWAV extended header for each of those electrodes;
  • no spikes are returned;
  • no warning is raised.

On one of our full recordings (Trellis 1.14.4.41, 96 electrodes with IDs 257-352), .nev held 711,396 data packets: 9,126 digital and 702,270 spike packets, of which neo returned none.

To Reproduce

sample.nev (zipped, attached in a comment below) is a truncated copy of a real Trellis file: all original headers, the time origin replaced with 2000-01-01, the header comment blanked, and only the first spike packet of each electrode (28 spikes) plus 5 digital packets.

from neo.rawio import BlackrockRawIO

r = BlackrockRawIO(filename="sample", nsx_to_load=None)
r.parse_header()
print(r._nev_spec, len(r.header["spike_channels"]))   # 2.2 0

With the 2.2 spike range widened to neo's own 2.3 range, all 28 spikes are read:

from neo.rawio import blackrockrawio
blackrockrawio.NEV_PACKET_IDENTIFIERS_BY_SPEC["2.2"]["Spikes"] = (1, 2048)
# ... same as above: 28 spike channels, 28 spikes

Expected behaviour

Spikes on electrodes above 255 in a 2.2 file are read, as they are for 2.3. If the 2.2 range is kept strict on purpose, a warning (or error) when data packets match no known packet type, so the loss is visible.

Environment:

  • OS: macOS 27.0.1 (also seen on Linux)
  • Python 3.12.7
  • Neo 0.14.5 (the same table is in 0.14.6 and on master)
  • NumPy 2.5.3

Additional context

The .nev basic header's "application to create file" is Trellis[1.14.4.41]. The accompanying .ns2 (NSx 2.2) reads correctly; its electrode IDs are 257-352 as well, plus analog inputs at 10245 and up.

Activity

  1. h-mayorquin commented on Oct 20, 2026

    @h-mayorquin
    Contributor

    Thanks @cboulay @alejoe91 my plan is to work on blackrock this week, I will take a look at this.

  2. h-mayorquin commented on Nov 6, 2026

    @h-mayorquin
    Contributor

    I am closing this as we have merged the fix.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions