Skip to content

Conversation

@larsoner
Copy link
Member

@GuillaumeFavelier on pyvista/pyvista#958 and pyvista/pyvistaqt#66 using pytest mne/viz/_brain I get:

Traceback (most recent call last):
  File "/home/larsoner/python/mne-python/mne/viz/_brain/_brain.py", line 45, in safe_event
    return fun(*args, **kwargs)
  File "/home/larsoner/python/mne-python/mne/viz/_brain/_brain.py", line 432, in _clean
    self.clear_points()
  File "/home/larsoner/python/mne-python/mne/viz/_brain/_brain.py", line 1245, in clear_points
    self.remove_point(sphere)
  File "/home/larsoner/python/mne-python/mne/viz/_brain/_brain.py", line 1235, in remove_point
    self.plotter.remove_actor(sphere._actors)
  File "/home/larsoner/python/pyvista/pyvista/plotting/plotting.py", line 616, in remove_actor
    renderer.remove_actor(actor, reset_camera)
  File "/home/larsoner/python/pyvista/pyvista/plotting/renderer.py", line 1174, in remove_actor
    rv = self.remove_actor(a, reset_camera=reset_camera)
  File "/home/larsoner/python/pyvista/pyvista/plotting/renderer.py", line 1182, in remove_actor
    _remove_mapper_from_plotter(self.parent, actor, False)
  File "/home/larsoner/python/pyvista/pyvista/plotting/renderer.py", line 1462, in _remove_mapper_from_plotter
    for name in list(plotter._scalar_bar_mappers.keys()):
AttributeError: 'NoneType' object has no attribute '_scalar_bar_mappers'

Can you look and push commits to fix?

@GuillaumeFavelier
Copy link
Contributor

Okay, I'm on it

@GuillaumeFavelier
Copy link
Contributor

This is my report for pytest mne/viz/_brain on mne-python/ref:

  1. pyvista/master, pyvistaqt/master:
    all tests are green

  2. pyvista/mem, pyvistaqt/master:
    Segmentation fault in test_brain_init
    Does not crash if I use -k init and the test is green

  3. pyvista/master, pyvistaqt/mem:
    MemoryError in test_brain_traces for volume and mixed, test_brain_linkviewer

  4. pyvista/mem, pyvistaqt/mem:
    Segmentation fault in test_brain_traces
    Does not crash if I use -k traces and I got the same MemoryError as in 3)

I think the MemoryError is related to your traceback, I'll investigate

@GuillaumeFavelier
Copy link
Contributor

GuillaumeFavelier commented Oct 23, 2020

I identified the issue with MemoryError on 3). BasePlotter.deep_clean() is forced in pyvistaqt/mem

deep_clean() will set self.parent = None which is used to remove the actors in our function clear_points().

I would recommend to proceed with caution here. PyVista made the difference between 'close' and 'clean'. I suggest that we stick to it until we can have a proper discussion or plan in pyvista/pyvista#959

The way I see it, Brain -> BackgroundPlotter -> BasePlotter (-> : depends on) so the sequence should be (in this order):

Brain.close(), BackgroundPlotter.close(), BasePlotter.close(), Brain.clean(), BackgroundPlotter.clean(), BasePlotter.clean()

@GuillaumeFavelier
Copy link
Contributor

GuillaumeFavelier commented Oct 23, 2020

I identified the issue with the segfault on 2). On our code, the patch to remove lights should be removed and self.plotter.interactor=None needs to removed. The refs to vtkXOpenGLRenderWindow will remain though.

EDIT: I can work something out, it's just some cleaning to do

@larsoner
Copy link
Member Author

Brain.close(), BackgroundPlotter.close(), BasePlotter.close(), Brain.clean(), BackgroundPlotter.clean(), BasePlotter.clean()

Do you mean BasePlotter.deep_clean?

@GuillaumeFavelier
Copy link
Contributor

Do you mean BasePlotter.deep_clean?

Yes. I used 'clean' just to give the idea

@larsoner
Copy link
Member Author

I reverted the deep_clean in pyvistaqt and now things pass there and on this PR!

I'll go ahead and merge this since it has a fix for latest matplotlib

@larsoner larsoner merged commit 529dd9c into mne-tools:master Oct 23, 2020
@larsoner larsoner deleted the ref branch October 23, 2020 11:26
larsoner added a commit to adam2392/mne-python that referenced this pull request Oct 23, 2020
* upstream/master:
  Fix separate canvas (mne-tools#8408)
  FIX: focalpoint (mne-tools#8405)
  WIP: Refs (mne-tools#8406)
  tiny cosmetic improvements to BEM code (mne-tools#8404)
  MRG, ENH: Fix memory on CircleCI (mne-tools#8379)
  MRG: Update backend parameter in stc.plot() (mne-tools#8395)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants