Skip to content

Blackrock: NEV comments out of order among themselves are not clock resets - #1959

Open
cboulay wants to merge 1 commit into
NeuralEnsemble:masterfrom
cboulay:nev-comments-no-reset
Open

cboulay wants to merge 1 commit into
NeuralEnsemble:masterfrom
cboulay:nev-comments-no-reset

Conversation

@cboulay

@cboulay cboulay commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Since #1924, each .nev packet is compared only with the previous packet of its own type. Comments are not in time order among themselves either: each is stamped when its event starts and written when its text is built, so a comment can be written after one stamped later than it. That step back still starts a segment. Out-of-order packets of types neo doesn't read caused the same kind of false segment in #1181. The "Data Loss" comment in #1449 may be another case; its files are private, so I couldn't check.

This leaves comments out of the jump detection. A comment gets the segment of the packets around it in the file, and reset comments ("critical load restart", the rule from #523) still start one.

No new test: test_nev_segments_ignore_order_between_packet_types (from #1924) also calls _get_event_segment_ids on synthetic packets (a comment earlier than the comment before it, then a real reset). It fails on master. Segments are unchanged on every Blackrock recording in ephy_testing_data.

This touches the same loop as #1958, so whichever merges second needs a small rebase.

…esets

Comparing packets per type stopped a comment stamped ahead of the spikes
written after it from starting a segment. Comments are not in time order
among themselves either: each is stamped when its event starts and written
when its text is built, so one can be written after a later-stamped one,
and that step back still started a segment.

Leave comments out of jump detection. A comment gets the segment of the
packets around it in the file; reset comments still start a segment.

@h-mayorquin h-mayorquin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused about what puts comments out of order among themselves. In #1924 you explained that the firmware stamps a comment with the newest sample time:
#1924 (comment)

That matches what I see in the files. In the flag 1 comments I looked at (four spec 2.3 sources and your Hub1 and NSP files), the packet timestamp is when the comment was sent, and the start is stored in Data, 10 ms to 3.5 s earlier. LB-0110 (table 4-9) describes Data the same way. If a comment is stamped when it is sent, the time it takes to write the text should not reorder comments. I also checked every Blackrock .nev on gin that opens and your two recordings, and in none of them is a comment stamped earlier than the comment written before it.

So, what produces this? Do you have a file where it happens? maybe the one with 43 segments? If it is the same datagram reordering as in #1958, I think the 10 ms window there would cover comments too and we would not need to leave them out of the check.

@cboulay

cboulay commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

I guess you're referring to this:

Hub1's split happens at a comment. Central stamps a comment when its event begins and writes it a few ms later, so the spike written next is earlier than the comment. The firmware stamps comments with the newest sample time, while spikes wait in a buffer of about 115 samples, so comments lead by 3 to 4 ms. That also explains the 3 spikes lost at the segment edge (#1925).

The second and third sentence are seemingly contradicting. Sorry, that was sloppy.

The following is possible:

  1. Someone opens the comment dialog in Central. The comment isn't sent yet but gets t0
  2. They use the API to send another comment, getting timestamped when it arrives at t1
  3. The comment dialog is finished, so the comment with t0 arrives after the comment with t1

@h-mayorquin h-mayorquin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining this. The case with the comment dialog and the API makes sense to me. I am approving.

Did you mention previously (sorry if you did) whether you could share or not a file with this characteristics? It would be great to have one

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.

2 participants