Repository navigation
Outlet: stamp a regular-rate chunk with its last sample's time - #56
Merged
Merged
Conversation
pylsl's push_chunk reads a scalar timestamp as the capture time of the most recent sample and derives the others backwards from the nominal rate. The outlet passed axis.value(n), the time one period after the last sample, so every pushed sample was stamped one sample period late.
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.
OutletProcessor._processstamps a regular-rate chunk withmessage.axes[dim].value(dat.shape[0]). That is the time one period after the chunk's last sample.pylsl.StreamOutlet.push_chunkreads a scalartimestampas the capture time of the most recent sample and derives the earlier samples from the nominal rate. As a result, every pushed sample was stamped one sample period late: about 33 µs at 30 kHz, but 10 ms for a 100 Hz stream such as binned features or decoder outputs.The fix passes
value(n - 1), the last sample's own time, so sample i is stamped withaxis.value(i).datatimestamps) are unchanged.test_outlet_non_time_stream_dimasserted the old value; it now expectsvalue(n - 1).test_outlet_stamps_chunk_with_last_sample_time, pins the behaviour.Behaviour change: LSL timestamps from regular-rate outlets move one sample period earlier. Anything that compared them against the old stamps, including recordings or latency measurements, will see that shift.
Tests:
uv run pytest testsgives 115 passed. The ruff and ruff-format pre-commit hooks pass.