Skip to content

Add active .xdf monitoring for near real-time timeline updates#7

Draft
Copilot wants to merge 6 commits intomasterfrom
copilot/add-active-xdf-file-support
Draft

Add active .xdf monitoring for near real-time timeline updates#7
Copilot wants to merge 6 commits intomasterfrom
copilot/add-active-xdf-file-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 9, 2026

This change enables timeline updates from an actively written LabRecorder .xdf instead of relying only on new-file discovery. It reuses existing multi-XDF loading/processing paths while adding fallback metadata handling for in-progress files.

  • Active recording selection + metadata fallback

    • Added discovery helpers to:
      • select the most recent .xdf when multiple candidates exist
      • derive reference datetime from file metadata when close-time header fields are missing (falling back to file mtime for open/in-progress files)
  • Active .xdf polling in TimelineBuilder

    • Extended refresh config with:
      • enable_active_xdf_monitoring (default True)
      • active_xdf_poll_interval_seconds (default 10.0)
    • Added a fixed-interval QTimer poll loop.
    • Tracks active file signature (size, mtime_ns) to detect incremental writes.
  • In-place datasource refresh (no duplicate tracks)

    • On active file growth/change, rebuilds datasource payloads and updates existing timeline datasources in place (intervals_df, detailed_df, raw/lab metadata), then emits datasource change signals so renderers refresh.
    • Keeps existing discovery behavior for newly created XDF/video files.
    • Uses a narrower refresh path when only one loaded XDF exists.
  • Shared fallback integration

    • Wired stream processing to use the new reference-datetime fallback helper so open-file loading paths consistently handle missing close-time metadata.
builder.set_refresh_config(
    xdf_discovery_dirs=[lab_recorder_dir, log_dir],
    n_most_recent=15,
    enable_active_xdf_monitoring=True,
    active_xdf_poll_interval_seconds=10.0,
)

Copilot AI linked an issue Apr 9, 2026 that may be closed by this pull request
4 tasks
Copilot AI changed the title [WIP] Add actively recording .xdf file support for EEG data display Add active .xdf monitoring for near real-time timeline updates Apr 9, 2026
Copilot AI requested a review from CommanderPho April 9, 2026 13:53
@CommanderPho
Copy link
Copy Markdown
Collaborator

CommanderPho commented Apr 9, 2026

It launches but when there's an actively recording .xdf file the timeline GUI seems to freeze upon launch.

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.

Add actively recording .xdf file support/monitoring

2 participants