-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
ENH: block parameter for viz plots #10222
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
Conversation
|
Beautiful!!!!! 😍😍😍 |
|
Did you try it @hoechenberger ? Does it work for you? |
|
We have to use Detailsimport os
import mne
from mne.datasets import sample
data_path = sample.data_path()
sample_dir = os.path.join(data_path, 'MEG', 'sample')
subjects_dir = os.path.join(data_path, 'subjects')
fname_stc = os.path.join(sample_dir, 'sample_audvis-meg')
stc = mne.read_source_estimate(fname_stc, subject='sample')
initial_time = 0.096
mne.viz.set_3d_backend('pyvista')
brain = stc.plot(subjects_dir=subjects_dir, initial_time=initial_time,
clim=dict(kind='value', lims=[3, 6, 9]),
size=600,
hemi='rh',
views=['lat', 'med'],
brain_kwargs=dict(block=True),
) |
|
Yes, works! |
|
Any opinion @larsoner ? |
larsoner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than my deprecation complaint and needing latest.inc entries, looks reasonable to me.
Has anyone tested if multiple block=True calls can be made (e.g., sequential stc.plot(brain_kwargs=dict(block=True)) calls)?
Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
I think the first call should block so anything after should be executed when the window is closed. |
|
Agreed that should happen in theory, can you test that it works as expected? |
|
I tested the following real quick: import os
import mne
from mne.datasets import sample
data_path = sample.data_path()
sample_dir = os.path.join(data_path, 'MEG', 'sample')
subjects_dir = os.path.join(data_path, 'subjects')
fname_stc = os.path.join(sample_dir, 'sample_audvis-meg')
stc = mne.read_source_estimate(fname_stc, subject='sample')
initial_time = 0.096
mne.viz.set_3d_backend('pyvista')
brain = stc.plot(subjects_dir=subjects_dir, initial_time=initial_time,
clim=dict(kind='value', lims=[3, 6, 9]),
size=600,
hemi='rh',
views=['lat', 'med'],
brain_kwargs=dict(block=True),
)
brain = stc.plot(subjects_dir=subjects_dir, initial_time=initial_time,
clim=dict(kind='value', lims=[3, 6, 9]),
size=600,
hemi='rh',
views=['lat', 'med'],
brain_kwargs=dict(block=True),
)and this is what I got: output.mp4I realize now that it is NOT obvious. I actually close the windows with my shortcut 😅 they do not close by themselves |
larsoner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deprecation not fully implemented or documented yet
Co-authored-by: Richard Höchenberger <richard.hoechenberger@gmail.com>
This reverts commit e3b8420.
larsoner
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM +1 for merge. Good to go from your end @GuillaumeFavelier ?
|
It is ready for me @larsoner |
|
Thanks @GuillaumeFavelier @hoechenberger ! |
This PR introduces the
blockparameter to start the Qt event loop and effectively hold the context.This PR is what I had in mind @hoechenberger
Related to #10221