Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to replace raw and replace ICA traces in plot #133

Open
adam2392 opened this issue Jul 19, 2022 · 1 comment
Open

Add the ability to replace raw and replace ICA traces in plot #133

adam2392 opened this issue Jul 19, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@adam2392
Copy link
Member

Is your feature request related to a problem? Please describe.
I would like to be able to use the mne-qt-browser and dynamically replace the trace (raw or ica) that is visualized. For example, I would like to plot the raw EEG or ica source based on which channel/component is selected by the user.

# pseudocode: this is a time-series plot from MNE QTBrowser
# it only selects the component in ICA instance that is currently selected
ts_plot.replace_ica(ica[curr_sel_comp, :])

# redraw, so the data shows up in the visualization (I think that's how QT / matplotlib canvases work)
ts_plot.re_draw()

Describe the solution you'd like
@marsipu thanks for your help so far. Are you able to point out what changes you think will be needed in order for this refactoring to be enabled?

Additional context
Discussion came up in: https://mne.discourse.group/t/embedding-time-series-plot-of-mne-qt-browser-into-our-own-gui/5090/10?u=adam2392

@marsipu
Copy link
Member

marsipu commented Jul 19, 2022

@adam2392 I think you need to go deeper and make this a change in mne itself.
More specifically I think one could add a method like replace_data to BrowserBase.
You would have to consider all relevant data-attributes like e.g. self._data and self._times and make it work for all possible data-instances (raw, epochs, ica).

Then you might want to refresh the view and set the time-back to 0.
For qt-backend this would look something like this:

self.mne.t_start = 0
self.mne.plt.setXRange(self.mne.t_start, self.mne.t_start + self.mne.duration)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants