question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`streamlines_evenly_spaced_2D` fails if no vector is specified and the mesh does not have an active vector

See original GitHub issue

Update

@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. Screenshot_2022-03-11_17-11-02


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:open
  • Created 2 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
MatthewFlammcommented, Mar 12, 2022

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.

1reaction
adeakcommented, Mar 12, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a set which satisfies none of the vector space axioms?
The question is meaningless; a set does not satisfy (nor not satisfy) the vector space axioms. What is needed to test the axioms...
Read more >
Proving not a vector space | Wellesley College ... - YouTube
This video works through an example of proving that a space is NOT a vector space.FULL NOTES: Download the notes in the video...
Read more >
1.7 Linear Independence - Berkeley Math
A vector in a linearly dependent set may fail to be a linear combination of the other vectors. Theorem 8. If a set...
Read more >
EE263 homework problems Lecture 2 – Linear functions and ...
these functions; you don't have to use these commands. 2.12 Undirected graph. ... f : Rn → R, at a point x ∈...
Read more >
HOMEWORK 2 – solutions
Solution. [4 points] No, X4 is not a subspace. It does not contain the zero vector. (It also fails to be closed under...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found