Skip to content

Conversation

@GuillaumeFavelier
Copy link
Contributor

@GuillaumeFavelier GuillaumeFavelier commented Mar 26, 2020

This PR updates the render window only when it is expected or necessary (meaning after a user interaction) instead of being called constantly at a very small interval. I expect this to lower the burden on the CPU.

Note: My CPU usage for a standard script went from ~25-30% to around 1% on idle.

It's an item of #7162

@GuillaumeFavelier
Copy link
Contributor Author

GuillaumeFavelier commented Mar 26, 2020

Can you try this @hoechenberger ? It would be nice if this could at least improve your situation.

self.time_call(idx, update_widget=True)
if time_point == max_time:
self.playback = False
self.plotter.update() # critical for smooth animation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always should have been indented one more level :( But if you now have time_call effectively trigger the .update(), then indeed it makes sense to remove it entirely now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was necessary after PyVista 0.24, probably something can be improved upstream

@hoechenberger
Copy link
Member

@GuillaumeFavelier I tested this with:

In [1]: %pwd
Out[1]: '/Users/hoechenberger/Development/mne-python/examples/inverse'

In [2]: import mne

In [3]: mne.viz.set_3d_backend('pyvista')
Using pyvista 3d backend.


In [4]: %run plot_vector_mne_solution.py

And I get a mayavi window… I think there might be a PyVista window shortly popping up and then disappearing, but I'm not sure (maybe it's the mayavi window all along, changing some of its properties)

@GuillaumeFavelier
Copy link
Contributor Author

@hoechenberger #7060 is not merged yet

@agramfort
Copy link
Member

agramfort commented Mar 26, 2020 via email

@larsoner
Copy link
Member

The vector PR has not been merged, you need to test a standard STC for this PR

@hoechenberger
Copy link
Member

Oh sorry, I thought it had been merged. Losing track with all these PRs and amazing new features by @GuillaumeFavelier :D

This PR fixes the CPU hogging issue for me!

@GuillaumeFavelier
Copy link
Contributor Author

This PR fixes the CPU hogging issue for me!

Fantastic!

Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed it seems to work great

@larsoner larsoner added this to the 0.20 milestone Mar 26, 2020
@codecov
Copy link

codecov bot commented Mar 26, 2020

Codecov Report

Merging #7517 into master will decrease coverage by 0.04%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #7517      +/-   ##
==========================================
- Coverage   90.12%   90.08%   -0.05%     
==========================================
  Files         452      453       +1     
  Lines       82885    82767     -118     
  Branches    13100    13062      -38     
==========================================
- Hits        74703    74560     -143     
- Misses       5347     5381      +34     
+ Partials     2835     2826       -9     

@larsoner
Copy link
Member

@GuillaumeFavelier can you fix the conflict? then I'll merge

@GuillaumeFavelier
Copy link
Contributor Author

I'm on it

@larsoner
Copy link
Member

CIs were happy before merge and still are locally so I'll go ahead and merge, thanks @GuillaumeFavelier

@GuillaumeFavelier
Copy link
Contributor Author

I'll check how it goes directly on master then

@larsoner larsoner merged commit 691c59b into mne-tools:master Mar 26, 2020
@GuillaumeFavelier GuillaumeFavelier deleted the time_viewer_update branch June 11, 2020 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants