Skip to content

feat: Live LSL timeline with EEG + Motion tracks and backscroll; fix pull_chunk, blockSignals, exec_()#4

Merged
CommanderPho merged 21 commits intomasterfrom
copilot/implement-live-timeline-backscroll
Mar 5, 2026
Merged

feat: Live LSL timeline with EEG + Motion tracks and backscroll; fix pull_chunk, blockSignals, exec_()#4
CommanderPho merged 21 commits intomasterfrom
copilot/implement-live-timeline-backscroll

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Implements a real-time LSL-connected timeline displaying live EEG and Motion streams with backscroll — drag the viewport into buffered history while streaming continues, then snap back with a "⟳ Sync to Live" button. Also fixes three bugs discovered during first run.

New: pypho_timeline/rendering/datasources/specific/lsl.py

  • LSLStreamReceiverQObject with a QTimer poller and resolve_bypred-based stream discovery. Emits data_received(channel_names, timestamps, samples). Degrades gracefully without pylsl.
  • _LiveRingBufferQMutex-guarded rolling deque, auto-trims to buffer_seconds. Exposes to_dataframe() / get_window(t0, t1).
  • LiveEEGTrackDatasource / LiveMotionTrackDatasource — extend IntervalProvidingTrackDatasource, wire to a receiver, implement the TrackDatasource protocol with live data.

New: live_lsl_timeline.py

  • LiveLSLTimelineQMainWindow with EEG + Motion tracks, 200 ms live-follow timer, and backscroll detection via ViewBox.sigRangeChangedManually.
  • "⟳ Sync to Live" toggle — re-engages the follow timer and snaps both viewports to the live head.
  • --synthetic flag starts in-process pylsl outlets for demo without hardware.
eeg_receiver = LSLStreamReceiver(stream_type='EEG')
eeg_ds = LiveEEGTrackDatasource(receiver=eeg_receiver, buffer_seconds=300.0)
motion_receiver = LSLStreamReceiver(stream_type='Accelerometer')
motion_ds = LiveMotionTrackDatasource(receiver=motion_receiver, buffer_seconds=300.0)
window = LiveLSLTimeline(eeg_datasource=eeg_ds, motion_datasource=motion_ds)
window.show()
eeg_receiver.start(); motion_receiver.start()

Bug fixes

  • pull_chunk crashpull_chunk(dest_obj=numpy_array) returns (n_int, timestamps), not (samples, timestamps); old code hit TypeError: 'int' object is not subscriptable on first data. Dropped dest_obj entirely.
  • vb.blockSignals broke live renderingblockSignals(True) around setXRange() muted sigRangeChanged, stopping the TrackRenderingMixin viewport callbacks and freezing track detail loads in live mode. Removed — setXRange() never emits sigRangeChangedManually.
  • app.exec()app.exec_() — consistent with main.py / __main__.py.
Original prompt

This section details on the original issue you should resolve

<issue_title>Feature: Live Timeline with backscroll</issue_title>
<issue_description>Idea: Let's say you're recording live EEG data from hardware, and notice a cognitive event that you'd like to analyze. You'd typically verbally note the event which will appear on the timeline as a text log entry. Next, you'd like to see if it's reflected in the current EEG data in some way. You might notice a discrete change in the current window (say the spectogram), but to understand if it's meaningful/significant/related you'd typically need to see how it compared to the time before it (in the previous "state"). To do this, you'd need to be able to manually scroll backwards to previous data -- this feature is already implemented in the current timeline.

Task: Implement a real-time synchronized viewer for incoming EEG data like stream_viewer (https://github.com/CommanderPho/stream_viewer.git) but with backscroll abilities: meaning you can grab the window with the left mouse button+hold and drag it back to previous times for comparison.

You should then be able to easily resync the window to the present/live when you're done looking.

Perhaps even better would be the ability to vertically duplicate the entire timeline widget (splitting the parent window into a vertical stack) where one remains live synchronized and the other freely scrolls to historical data for comparison.
</issue_description>

<agent_instructions>Analyze 'stream_viewer' and implement a live LSL-stream connected timeline showing both EEG and Motion data in a new python script.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…port

Co-authored-by: CommanderPho <962210+CommanderPho@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement live timeline with backscroll for EEG data feat: Live LSL timeline with EEG + Motion tracks and backscroll Mar 3, 2026
Co-authored-by: CommanderPho <962210+CommanderPho@users.noreply.github.com>
Copilot AI changed the title feat: Live LSL timeline with EEG + Motion tracks and backscroll feat: Live LSL timeline with EEG + Motion tracks and backscroll; fix pull_chunk, blockSignals, exec_() Mar 3, 2026
@CommanderPho CommanderPho merged commit bb3d0d7 into master Mar 5, 2026
2 of 8 checks passed
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.

Feature: Live Timeline with backscroll

2 participants