-
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
MRG, ENH: Fix plot_vector_source_estimates #7030
MRG, ENH: Fix plot_vector_source_estimates #7030
Conversation
Can you touch the examples that use vector source estimate plotting so we can see if the auto mode is working for them? |
Codecov Report
@@ Coverage Diff @@
## master #7030 +/- ##
==========================================
+ Coverage 89.71% 89.71% +<.01%
==========================================
Files 434 438 +4
Lines 77293 77480 +187
Branches 12559 12587 +28
==========================================
+ Hits 69344 69513 +169
- Misses 5148 5156 +8
- Partials 2801 2811 +10 |
From what I tried locally, the difference in Y axis is too big: y = np.array(brain.geo[hemi].coords[:, 1])
y_diff = (np.max(y) - np.min(y)) / 5. # presumably get fifth of the width There is probably something I missed. |
Sometimes that's what my brain feels like though. Are we sure it's not correct? 😆 |
By discussing offline with @larsoner, I should check if the units get converted and use the convenient |
I checked the |
Maybe a bit too big? I think it might look better if you shrink to 0.75 or 0.5 the size -- do either of those look better (or at least as good) to you? |
Agreed 10% is clearest |
I also like 10% best |
Don't hesitate to tell me if you want me to modify anything else or test another parameters. Otherwise, this PR is ready for reviews. |
@GuillaumeFavelier don't forget to push the 10% change |
... and also update the |
Any idea how I can fix this?
|
doc/changes/latest.inc
Outdated
@@ -95,6 +95,8 @@ Bug | |||
|
|||
- Fix missing scaling of tolerance parameter in :func:`mne.inverse_sparse.tf_mixed_norm` and :func:`mne.inverse_sparse.mixed_norm`, by `Mathurin Massias`_ | |||
|
|||
- Fix the automatic scaling of the glyphs in :func:`plot_vector_source_estimates` by using 10% of the brain width, by `Guillaume Favelier`_ |
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.
mne.viz.plot_vector_source_estimates
It must match the namespace in python_reference.rst
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.
Oh I see!
change |
I didn't notice that this PR was supposed to close #7020, I'll update right now. |
I put that in when I thought it was sufficient. Feel free to remove the label if you want to proceed with multiple PRs, or keep at it in this one. Either way is fine by me |
Thanks @larsoner I decided to fix everything in this PR. |
It might require more reviews as it moves forward though. |
Now I suggest a patch enabling depth peeling when |
That's fine, I'm sure @jasmainak is up for it :) |
For reference on depth peeling: enthought/mayavi#491 (comment) |
Why this is not enabled by default actually? Any ideas? 🤔 |
It's slower (requires multiple draw passes) and is not supported on all hardware. So better not to use it unless you need to. For example if we can fix it by setting some opacity, translucency, or depth testing params it would be faster and work on more graphics cards. |
I understand. But the number of parameters to modify to obtain a similar result plus the maintenance of those which is not trivial in my opinion has a certain cost. And I wouldn't be worried about performance for such a lightweight 3D scene especially considering how modern hardware gets more powerful each year. I did not have to work on a very demanding example so far on MNE but maybe there is. |
Looks (and sounds) reasonable to me, @jasmainak can you try it? |
just wondering if it's the right choice to scale both length and thickness, or whether keeping thickness constant and scaling only length would be better. Personally I'm not sure. |
It might not be so easy to have Mayavi (or PyVista) just scale one of the two params. @GuillaumeFavelier do you know? I'm okay with it either way, agreed we should at least think about it. |
okay okay, certified tester @jasmainak is coming. Give me a moment to try :) |
I like the 3D glyphs far far better than the 2D ones and I don't see any noticeable lag on my mac. However, I think some tiny tweaks would certainly help
|
I found a small bug in this commit when trying to plot both hemispheres of the MNE source estimate in this script. Shown below is my traceback. Also, as a user I have to say that implementing the 3D glyphs would be much easier to view even though they take up slightly more space. Scaling by both length and thickness makes it immediately clear which vertices contribute the most.
|
I can confirm that I can reproduce the issue! |
This PR closes #7020:
scale_factor=None
brain_alpha
is in [0.8, 1]