pyvista: Missing meshes in Renderer
When using the .add_mesh()
method of BackgroundPlotter
, some meshes are missing in the plotting window. An error is printed in the terminal which seems to have to do with qt.
QSocketNotifier: Multiple socket notifiers for same socket 848 and type Read
QSocketNotifier: Multiple socket notifiers for same socket 848 and type Read
Unfortunately, I have not been able to reproduce this outside of my package to. It seems that the bug is fixed by setting a unique name keyword argument for each mesh.
System Information:
Date: Mon Sep 30 21:12:28 2019 GMT, sommartid
Windows : OS
8 : CPU(s)
AMD64 : Machine
64bit : Architecture
Jupyter : Environment
Python 3.6.8 |Anaconda, Inc.| (default, Feb 11 2019, 15:03:47) [MSC v.1915 64 bit (AMD64)]
0.22.2 : pyvista
8.2.0 : vtk
1.15.4 : numpy
2.5.0 : imageio
1.4.3 : appdirs
0.4.3 : scooby
3.1.0 : matplotlib
5.9.2 : PyQt5
7.2.0 : IPython
7.4.2 : ipywidgets
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 18 (14 by maintainers)
Great that you were able to solve it @banesullivan! I have very limited time at the moment so cannot check the pull request right now but please go ahead anyway.
This jives with my situation. I was doing something along the lines of:
Clearly the intermediate objects constructed this way could run the risk of getting collected and having nonunique
id
s, like you mention above.Modifying @GuillaumeFavelier’s snippet from the above coment, we can see that memory ID addresses are reused when creating these spheres.
which raises an assertion error and produces
It appears that since we instantiate the PyVista mesh in a for loop, that memory management is seeing no references to those IDs and reusing them. What this means is that we need a different default
name
tracker in PyVista other than theid()
of that object as apparently it is not unique in these cases:from https://docs.python.org/3/library/functions.html#id
From what I could find, it could be related to the fact that the
_point_arrays
attribute of the mesh has not been set correctly. Could you maybe try the following patch as a temporary workaround @kjelljorner ?@GuillaumeFavelier That mirrors my experiences. I tried to reproduce my example with this quite elaborate code examples.
Using color property and missing out on some of the spheres:
Without color and plotting all atoms: