Repository navigation
Conversation
…nts by id At the 1 ns timestamp resolution of PTP files, spikes and events at the edge of a segment were kept or dropped by rounding: the segment bounds went through float seconds back to ticks, and np.searchsorted compared uint64 timestamps with a Python int as float64. spike_count and event_count used the same window and could disagree with the timestamps returned. Without t_start/t_stop, items are selected by segment id alone, as the getters already did, and the counts select the same way. Explicit bounds are compared with the times neo reports (timestamps as float64 seconds), so a bound taken from neo, such as segment_t_start, selects the item it came from. t_stop stays exclusive; documented, with the advice to pass t_stop + 1e-5 to include an item at t_stop.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For a multi-segment
.nev,BlackrockRawIOclipped spikes and events to the segment's time window: the bounds were float seconds converted back to ticks, then compared withnp.searchsorted(which comparesuint64with a Pythonintas float64). Float64 seconds at 1.75e9 (PTP files, 1 ns resolution) are only precise to about 240 ns, so items at a segment's edge were kept or dropped by rounding.spike_count/event_countused the same window and could disagree withget_spike_timestamps. Non-PTP files (30 kHz ticks) are not affected.On the NEV of
blackrock_ptp_with_missing_samplesopened alone (4 segments), 4 of 999 spikes were lost, with and without explicit bounds. Converting explicit bounds to exact integer ticks does not fix it (5 lost), because the rounding is in the float seconds the caller passes.Changes:
t_start/t_stop, items are selected by segment id alone (the getters already did), andspike_count/event_countdo the same.segment_t_start) selects the item it came from.t_stopstays exclusive. This is now documented, with the advice to passt_stop + 1e-5to include an item att_stop(the old+1 tickin the default path was a no-op at 1 ns).The new test checks every unit of every segment of that file against the segment ids, with and without bounds, and fails on the old code.
Found while working on Blackrock reading with Colin McNabb at Blackrock Neurotech.