underworldcode / underworld3

https://underworldcode.github.io/underworld3/
Other
21 stars 10 forks source link

Broken pyvista visualizations #185

Closed gthyagi closed 7 months ago

gthyagi commented 7 months ago

Hi @lmoresi,

Recent changes in the following line have broken the pyvista visualizations https://github.com/underworldcode/underworld3/blob/ec93030d354d990856a581c00b35a16227e3cd42/src/underworld3/visualisation.py#L29

lmoresi commented 7 months ago

Can you expand on the problem itself ?

gthyagi commented 7 months ago
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[27], line 2
      1 if uw.mpi.size == 1 and visualize:
----> 2     plot_mesh(mesh, _save_png=True, _dir_fname=output_dir+'[/mesh.png](http://localhost:8888/mesh.png)', _title=case, _show_clip=True)

Cell In[26], line 24, in plot_mesh(_mesh, _save_png, _dir_fname, _title, _show_clip)
     22 if _save_png:
     23     pl.camera.zoom(1.4)
---> 24     pl.screenshot(_dir_fname, scale=3.5,)

File [~/manual_install_pkg/venv_uw3_git_gthyagi_9424/venv_uw3/lib/python3.11/site-packages/pyvista/plotting/plotter.py:5884](http://localhost:8888/lab/tree/uw_folder/UW3_Annulus_Spherical_Benchmarks/Spherical_Benchmarks/~/manual_install_pkg/venv_uw3_git_gthyagi_9424/venv_uw3/lib/python3.11/site-packages/pyvista/plotting/plotter.py#line=5883), in BasePlotter.screenshot(self, filename, transparent_background, return_img, window_size, scale)
   5882 with self.image_scale_context(scale):
   5883     self._make_render_window_current()
-> 5884     return self._save_image(self.image, filename, return_img)

File [~/manual_install_pkg/venv_uw3_git_gthyagi_9424/venv_uw3/lib/python3.11/site-packages/pyvista/plotting/plotter.py:1792](http://localhost:8888/lab/tree/uw_folder/UW3_Annulus_Spherical_Benchmarks/Spherical_Benchmarks/~/manual_install_pkg/venv_uw3_git_gthyagi_9424/venv_uw3/lib/python3.11/site-packages/pyvista/plotting/plotter.py#line=1791), in BasePlotter.image(self)
   1789 if self.render_window is None and self.last_image is not None:
   1790     return self.last_image
-> 1792 self._check_rendered()
   1793 self._check_has_ren_win()
   1795 data = image_from_window(self.render_window, scale=self.image_scale)

File [~/manual_install_pkg/venv_uw3_git_gthyagi_9424/venv_uw3/lib/python3.11/site-packages/pyvista/plotting/plotter.py:1752](http://localhost:8888/lab/tree/uw_folder/UW3_Annulus_Spherical_Benchmarks/Spherical_Benchmarks/~/manual_install_pkg/venv_uw3_git_gthyagi_9424/venv_uw3/lib/python3.11/site-packages/pyvista/plotting/plotter.py#line=1751), in BasePlotter._check_rendered(self)
   1750 """Check if the render window has been shown and raise an exception if not."""
   1751 if not self._rendered:
-> 1752     raise AttributeError(
   1753         '\nThis plotter has not yet been set up and rendered '
   1754         'with ``show()``.\n'
   1755         'Consider setting ``off_screen=True`` '
   1756         'for off screen rendering.\n'
   1757     )

AttributeError: 
This plotter has not yet been set up and rendered with ``show()``.
Consider setting ``off_screen=True`` for off screen rendering.
gthyagi commented 7 months ago

when I set off_screen=True it is throwing other errors

lmoresi commented 7 months ago

I still need a bit more context. I had not seen errors with pyvista. Is there a super-simple case where we can see this going wrong.

I guess we need to add more tests to avoid these issues.

gthyagi commented 7 months ago

resolved in PR #188

gthyagi commented 6 months ago

I have created PR #194 to fix pyvista issue in binder.