-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MRG: Add toggle to save_movie in _TimeViewer #7257
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
MRG: Add toggle to save_movie in _TimeViewer #7257
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7257 +/- ##
==========================================
- Coverage 90.13% 90.12% -0.02%
==========================================
Files 454 454
Lines 81535 81701 +166
Branches 13015 13042 +27
==========================================
+ Hits 73493 73634 +141
- Misses 5210 5222 +12
- Partials 2832 2845 +13 |
I think there are two complementary use cases here. One where you want to save a movie the way PySurfer does (
I'd say we could do one or two of:
I would vote for 1 and 3. |
I'll go for an offline
Sounds like a plan. |
|
The latest changes:
|
|
Now that I was thinking of two ways to handle that:
But mne-python/mne/viz/_brain/_brain.py Lines 1030 to 1068 in 5b3934f
|
|
you want to have a save_movie "button" in the 3d window? Not sure what you have in mind |
|
I would make it a menu file dialog |
The time for me to design the proof of concept and show the screenshot here but @larsoner explained exactly what I meant with 1) |
|
... and then maybe after you pick a path we have another "options" screen where you can set the other parameters. But I would say this is a (much) lower priority than some of the other stuff, the high priority would be |
|
+1 GUI integration is a second order pb
and yes menu buttons sounds reasonable to me
… |
|
The key binding to |
mne/viz/_brain/_brain.py
Outdated
| times = np.arange(n_frames, dtype=float) | ||
| times /= framerate * time_dilation | ||
| times += tmin | ||
| interp_func = interp1d(self._times, np.arange(self._n_times)) |
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.
Need to pass interpolation here
mne/viz/_brain/_brain.py
Outdated
| except (ImportError, ModuleNotFoundError): | ||
| has_imageio = False | ||
| warn("The imageio module is not found, " | ||
| "save_movie() will return the image sequence instead") |
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.
I wouldn't do this. Let's just raise an error, say that it's required for movie saving, and add to requirements.txt/environment.yml/README.rst
|
it works already reasonably well. Now 2 things:
|
agramfort
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.
although I would suggest to add an entry in the latest.inc page and write some sentences
in https://mne.tools/dev/auto_tutorials/source-modeling/plot_visualize_stc.html#sphx-glr-auto-tutorials-source-modeling-plot-visualize-stc-py saying that movies can be produced.
Co-Authored-By: Alexandre Gramfort <alexandre.gramfort@m4x.org>
|
Pushed a commit to fix https://circleci.com/gh/mne-tools/mne-python/18592 but @GuillaumeFavelier there are merge conflicts |
|
This was expected. I did a moderate refactor on the latest merged pr about time_viewer. I'll take care of it and rename. |
|
@GuillaumeFavelier let me know when CIs are green after fixing the merge
conflicts. Should be good to go then
… |
|
Thanks @GuillaumeFavelier |
| if time.shape != (array.shape[-1],): | ||
| raise ValueError('time has shape %s, but need shape %s ' | ||
| '(array.shape[-1])' % | ||
| (time.shape, (array.shape[-1],))) |
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.
@GuillaumeFavelier this merge commit that you made undid the nice refactoring that made use of _time_interp_funcs, we had a single path for interpolation in place and this undid it. It's why CircleCI is headed for failure on master:
https://circleci.com/gh/mne-tools/mne-python/18662
Can you look to see if this can be removed?
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.
I'm on it
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.
My bad for the regression
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.
Wait are you sure though? because I added _interpolate_data afterwards.
I fixed it in: 82b016a
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.
I opened #7462
This reverts commit 7f6120b.
This PR adds a toggle to save the scene displayed in
_TimeVieweras a GIF using PyVista movie feature. The shortcut for the toggle iso.TL:DR: for implementation specific reason, I would push more for offline
save_movie()instead, similar toPySurfer. I would like to have your opinion on this @larsonerNote/Known issue
From my experience of this feature, the interface stutters using the default
GIF-PIL(Pillow) format for imageioappend_data(). This is probably because disk access is performed at each call. I had better success withGIL-FI(FreeImage) format: the interface was still responsive during recording and suffers for lag only while saving to disk (end of recording).For reference:
append_data()append_data()It's an item of #7162