-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
backend parameter of viz._3d.plot_source_estimates needs some love #8394
Comments
Good catch @hoechenberger !
+1 for checking if any 3d backend is available and use We already have |
What do you think @agramfort, @larsoner ? |
agreed ! |
Ok so:
Is that what we want? Are there maybe use cases where one does have a working 3D backend but might want to use MPL anyway? (for love of pixelated graphics?) |
+100 to get rid of the matplotlib backend altogether and tell people to use nilearn's surface plotting and show how to do it in |
not too fast.
what I have seen in the past is:
- students with a broken mayavi (core dump on import). Passing matplotlib
as explicit backend fixed it. Otherwise mne would crash.
- when I teach intro to mne for young grad students I tell them install
numpy, scipy and matplotlib. It's all they need to get started and do
things. I cannot tell them to install a conda env at the beginning of my
class.
why not the nilearn option (I never used it myself) but I must be certain
it just works like the matplotlib version. It should work on google collab
too as it's what most students use on hands on session with master students.
… |
Yes I would also like us to be careful about removing MPL support. It's a great fallback to have when we're using the MNE Study Template on a remote server without X11. |
indeed we use it in the study template. So let's not break this.
… |
If we're going to keep it, we should probably make sure it actually works, and add it to some examples like we do for the rest of our code. I would be surprised if all combinations of transparent, lims, pos_lims, surface, etc. work correctly for the matplotlib backend like they do for the 3D one(s). In other words, I'm worried that the matplotlib version "works" in the sense that it gives an output, but that output is sometimes incorrect because that code has been as far as I've seen mostly unchanged for years (despite improvements and fixes to our STC code for the 3D backends). |
...and I think moving to nilearn hopefully would put some of the "make sure it works" burden onto the nilearn folks rather than us -- hence the motivation for at least using their stuff under the hood. But if adding |
Let's put it another way: |
nilearn is easy to install so it's a possibility I can endorse but I need
to make sure it works smoothly, typically in google collab
I hear that options may be ignored with matplotlib but with default
parameters it works
… |
We should not only provide an example but it should be as convenient to use as the current MPL backend, IMHO, even if only a small set of the functionality we offer for 3D backends is supported. But to move forward for now, we should merge #8395, as it fixes two bugs :) |
I see that this is a closed discussion but I want to chime in with an unpopular opinion that it would be nice to have |
I don't think the To me it's probably worth putting effort into figuring out how to get CPU-based rendering using Mesa OpenGL software rendering on any system whose OpenGL isn't good enough to render 3D properly. Then we can rely on VTK + Brain to do everything. And if this works hopefully we can just kill the matplotlib backend someday. I've hacked together solutions like this on other systems so in principle I think it's possible. I've also seen some conda-forge stuff involving osmesa but I don't know the details -- if we could tell people they could install an osmesa variant of VTK rather than the standard one, that might automagically make Brain work for people. |
It's not broken it's partial. I pushed for this to have a solution for
master students while teaching
and as a fall back when mayavi was really impossible to install / use.
Serious work publication
oriented cannot be done with matplotlib backend
… |
Describe the bug
Passing
backend='pyvista'
toplot_source_estimates()
currently is not supported, although we do support PyVista:mne-python/mne/viz/_3d.py
Line 1750 in 6f16c37
Also, the
backend
parameter is not used for anything except for checking whether we should use Matplotlib or not; ifbackend != 'matplotlib'
, we simply use_get_3d_backend()
to retrieve the backend to use. This means that e.g.if you have PyVista installed, passingbackend='mayavi'
will still use thepyvista
backend.mne-python/mne/viz/_3d.py
Lines 1751 to 1762 in 6f16c37
Expected results
backend
should be allowed to be'pyvista'
as wellbackend
should be honoredAdditional information
Also wondering if the
backend
param should be deprecated or changed. Maybe it could only supportmatplotlib
and3d
or so, and3d
would select the default 3D backend?Or we deprecate it and if we cannot detect a valid 3D backend, we fall back to Matplotlib. (We already kind of do that, if I'm reading the code correctly)
cc @GuillaumeFavelier
The text was updated successfully, but these errors were encountered: