Skip to content

ENH: Implement TimeChange behaviour for evoked_topo and recursive option in link#13968

Open
Gnefil wants to merge 18 commits into
mne-tools:mainfrom
Gnefil:evoked-topo-timechange
Open

ENH: Implement TimeChange behaviour for evoked_topo and recursive option in link#13968
Gnefil wants to merge 18 commits into
mne-tools:mainfrom
Gnefil:evoked-topo-timechange

Conversation

@Gnefil

@Gnefil Gnefil commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Reference issue (if any)

Implements #13928.

What does this implement/fix?

It enables plot_evoked_topo figures to interact with other figures sharing TimeChange event.

The strategy is to implement on_time_change function, link subfigures with the main figure, and mark the current time (set as a figure attribute) with a vertical line. Clicks on the subfigures publish TimeChange events, main figure subscribes to external events, and publish/subscribe transmit events/callbacks through the link function.

Additional information

ui_events.link() function now has a merge parameter that allows mutually linking the link-groups that figs belong to separately.

@Gnefil Gnefil marked this pull request as ready for review June 21, 2026 14:52
Copilot AI review requested due to automatic review settings June 21, 2026 14:52
@Gnefil Gnefil requested a review from wmvanvliet as a code owner June 21, 2026 14:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds TimeChange-based UI event interoperability to mne.viz.plot_evoked_topo (enabling time synchronization with other interactive figures) and extends mne.viz.ui_events.link() with a merge option to merge existing link-groups.

Changes:

  • Add TimeChange publishing/subscribing to the magnified (single-channel) topo time series and track current time on the main plot_evoked_topo figure.
  • Extend mne.viz.ui_events.link() with merge= to unify existing link-groups.
  • Add/adjust tests, a tutorial snippet, and a changelog entry covering the new behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tutorials/evoked/20_visualize_evoked.py Adds an example linking an interactive topomap and plot_evoked_topo for synchronized time selection.
mne/viz/ui_events.py Adds merge parameter to link() to merge figures’ existing link-groups.
mne/viz/topo.py Implements TimeChange interactions for the magnified topo time series and subscribes the main topo figure to time-change events.
mne/viz/tests/test_ui_events.py Adds a test covering merge=True link-group behavior.
mne/viz/tests/test_topo.py Adds tests for time-change propagation/select-line behavior in plot_evoked_topo.
doc/changes/dev/13968.newfeature.rst Adds a changelog entry describing the new TimeChange behavior and merge parameter.

Comment thread mne/viz/topo.py Outdated
Comment thread mne/viz/topo.py
Comment thread mne/viz/topo.py Outdated
Comment thread mne/viz/ui_events.py Outdated
Comment thread doc/changes/dev/13968.newfeature.rst Outdated
Comment thread tutorials/evoked/20_visualize_evoked.py Outdated

@wmvanvliet wmvanvliet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also document the UI events that plot_evoked_joint now publishes/subscribes to?
Does plot_evoked_topo also changle the TimeChange event?

    Notes
    -----
    The figure will publish and subscribe to the following UI events:

    * :class:`~mne.viz.ui_events.TimeChange`

Comment thread tutorials/evoked/20_visualize_evoked.py Outdated
Comment thread tutorials/evoked/20_visualize_evoked.py Outdated
Comment thread mne/viz/topo.py Outdated
Gnefil and others added 2 commits June 28, 2026 18:35

@Gnefil Gnefil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated according to second round of reviews.

@Gnefil Gnefil requested a review from mscheltienne as a code owner June 29, 2026 07:34

@wmvanvliet wmvanvliet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good. Just two minor things

Comment thread mne/viz/ui_events.py Outdated
Comment thread mne/viz/topo.py
@Gnefil Gnefil changed the title ENH: Implement TimeChange behaviour for evoked_topo and merge option in link ENH: Implement TimeChange behaviour for evoked_topo and recursive option in link Jul 1, 2026
Comment thread doc/changes/dev/13968.apichange.rst Outdated
Comment thread doc/changes/dev/13968.newfeature.rst Outdated
Comment thread mne/viz/ui_events.py Outdated
Comment thread mne/viz/ui_events.py Outdated
Comment thread mne/viz/ui_events.py Outdated
Gnefil and others added 2 commits July 1, 2026 19:54
Co-authored-by: Marijn van Vliet <w.m.vanvliet@gmail.com>
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.

3 participants