Skip to content

SpikeGLX: fix segment and event times ignoring firstSample - #1952

Open
h-mayorquin wants to merge 1 commit into
NeuralEnsemble:masterfrom
h-mayorquin:fix_spikeglx_timing
Open

h-mayorquin wants to merge 1 commit into
NeuralEnsemble:masterfrom
h-mayorquin:fix_spikeglx_timing

Conversation

@h-mayorquin

Copy link
Copy Markdown
Contributor

#1609 fixed the signal start times for #1607 but two other places still count from the start of each file instead of using firstSample. The segment window runs from 0 to the duration of the longest stream, and the nidq digital events are timed from the first sample of the file. On spikeglx/DigitalChannelTest_g0 the nidq signal spans 11.90 to 174.61 s while the segment spans 0 to 162.71 s, and the first XD0 ON comes out at 0.0936 s instead of 11.9944 s.

This PR starts each segment at its earliest stream, ends it at the latest stream stop, and adds the nidq start time to the event times. I extended test_t_start_reading to check the start and stop of every segment of 5-19-2022-CI4 against values computed from the .meta files, and test_nidq_digital_channel to check the first XD0 ON against firstSample and the sample of the first rising edge in the .bin. Both fail on master. This shifts the event times by firstSample / niSampRate, so code that added that offset by hand should stop doing it.

@h-mayorquin
h-mayorquin requested a review from alejoe91 November 6, 2026 19:43

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