Skip to content

Blackrock: detect NEV clock resets per packet type - #1924

Open
cboulay wants to merge 1 commit into
NeuralEnsemble:masterfrom
cboulay:nev-reset-per-packet-type
Open

cboulay wants to merge 1 commit into
NeuralEnsemble:masterfrom
cboulay:nev-reset-per-packet-type

Conversation

@cboulay

@cboulay cboulay commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

BlackrockRawIO split a spec 2.3/3.0 .nev into a new segment whenever a packet's timestamp was earlier than the previous handled packet's, whatever the packets' types. The file does not order packets of different types: a comment is stamped when the user starts writing it but written to the file when they finish, so it can be a few ms later than the spikes written after it. Each such comment looked like a clock reset, so a recording with comments was split into many segments (in one real 3.0 file: 43 segments against 1 in the .ns3), and spikes outside the first segment were not returned.

This compares each packet only with the previous packet of its own type. A real reset sends every type's clock back, so each type jumps at its first packet afterwards; a jump counts only if the packet it is compared with is in the current segment, so one reset is still one boundary. Reset comments ("critical load restart") work as before.

Behavior on the existing test files is unchanged (same "3 undocumented segments" for the PTP-with-gaps file). The new test calls _get_event_segment_ids on synthetic packets and fails on the old code.

Idea and the original per-type implementation (for a streaming reader) are from Colin McNabb at Blackrock Neurotech.

A NEV packet started a new segment whenever its timestamp was earlier than
the previous handled packet's, whatever the type. The file does not order
packets of different types: a comment is stamped when the user starts
writing it but written when they finish, so it can be later than the spikes
written after it, and each such comment split the recording.

Compare each packet only with the previous packet of its own type. A real
reset sends every type's clock back, so a jump counts only if the packet it
is compared with is in the current segment: one reset is one boundary.

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