`streamlines_evenly_spaced_2D` fails if no vector is specified and the mesh does not have an active vector
See original GitHub issueUpdate
@adeak suggested specifying the vector. The problem itself is solved.
However, as @adeak pointed out, this should be handled more gracefully, like throwing an error or elevate a vector if it is the only unambiguous one available.
The same issue seems to occur to streamlines
as well, which seems to silently produces no field lines at all but does not fail with segmentation fault.
Describe the bug, what’s wrong, and what you expect:
streamlines_evenly_spaced_2D
gives Segmentation fault
for a simple rectilinear grid.
Could be related to https://github.com/pyvista/pyvista/issues/1508
To Reproduce
- Download the data test.vtr.zip (~1.6MB), remove the extension ‘.zip’.
- Run the script
import pyvista as pv
# print(pv.Report()) # pyvista : 0.34.dev0, vtk : 9.0.3
mesh = pv.read('test.vtr')
# print(mesh)
# RectilinearGrid (0x7f5bcc098640)
# N Cells: 79401
# N Points: 80000
# X Bounds: -7.995e+02, 7.965e+02
# Y Bounds: 5.000e-01, 7.965e+02
# Z Bounds: 0.000e+00, 0.000e+00
# Dimensions: 400, 200, 1
# N Arrays: 1
if False: # the mesh itself seems fine
pl = pv.Plotter()
pl.add_mesh(mesh)
pl.show()
else: # getting streamlines gives Segmentation fault (core dumped)
stream = mesh.streamlines_evenly_spaced_2D(start_position=(0,600,0))
pl = pv.Plotter()
pl.add_mesh(stream)
pl.show()
Screenshots Paraview result looks OK.
System Information: Please run the following code wherever you are experiencing the bug and paste the output below. This report helps us track down bugs and it is critical to addressing your bug:
# Get system info
import pyvista as pv
print(pv.Report())
--------------------------------------------------------------------------------
Date: Fri Mar 11 16:52:22 2022 EST
OS : Linux
CPU(s) : 4
Machine : x86_64
Architecture : 64bit
RAM : 15.5 GiB
Environment : Python
File system : ext4
GPU Vendor : Intel
GPU Renderer : Mesa Intel(R) HD Graphics 4600 (HSW GT2)
GPU Version : 4.6 (Core Profile) Mesa 21.3.7
Python 3.8.12 (default, Oct 12 2021, 13:49:34) [GCC 7.5.0]
pyvista : 0.34.dev0
vtk : 9.0.3
numpy : 1.21.2
imageio : 2.9.0
appdirs : 1.4.4
scooby : 0.5.11
matplotlib : 3.5.1
PyQt5 : 5.9.2
IPython : 7.31.1
colorcet : 3.0.0
cmocean : 2.0
ipyvtklink : 0.2.2
scipy : 1.8.0
itkwidgets : 0.32.1
tqdm : 4.62.3
meshio : 5.3.2
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top GitHub Comments
Any of the options 1-3 are better than the current state. I think 2 or 3 fits better with pyvista’s style, although my personal preference is to be “explicit over implicit”. I worry only a little that 2 might be confusing, so it would need a good clear error message.
There are other places where similar checks could be done, e.g.
orient
for glyphing,warp_by_vector()
and so on. It might be worth unifying these with a single helper.