to_vtk is too lenient with model array sizes
See original GitHub issue@thast pointed out to me that there is an issue when passing non-vectorized data arrays to the to_vtk()
method.
import pyvista as pv
import numpy as np
import discretize
mesh = discretize.TensorMesh.readUBC('Mesh_model/mesh3d.msh')
model3d = np.load('Mesh_model/model.npy')
print(model3d.shape, model3d.size)
((10000, 28), 280000)
Then this:
mesh.to_vtk({'model3d': model3d})
works fine but as soon as you try to use that PyVista mesh, the VTK backend will segfault.
The reason you are able to create the PyVista object has to do with this check:
Should we change this to check the first axes of the model array? This way users could pass arrays containing vector data (nc
by 3):
...
if mod.shape[0] != nc:
raise RuntimeError(...
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
TTK is too short, and/or the action is too compressed. - Reddit
I'm curious how the game would play if the health of all players and vehicles was doubled. I think infantry combat would be...
Read more >TTK/hMPS1 Is an Attractive Therapeutic Target for Triple ...
We confirmed by immunohistochemistry and reverse phase protein array that TNBC expressed higher levels of TTK protein compared to the other ...
Read more >Overexpression of ASPM, CDC20, and TTK Confer a Poorer ...
TTK inhibitors increased the efficacy of taxane chemotherapy in patient-derived xenograft models and in an immunocompetent mouse model of triple ...
Read more >Ttk tracheal expression and requirements. (A) Late-stage ttk ...
Ttk tracheal expression and requirements. (A) Late-stage ttk mutant embryo showing an absence of branch fusion in the dorsal trunk (DT) (arrows).
Read more >DIC package — spam 0.6.1.3 documentation
'imagette2mask': 3D numpy array of same size as imagette2 or None,. 'returnStatus': int,. Describes success in extracting imagette1 and imagette2. If == 1 ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks @banesullivan.
I think changing the test from
size
toshape
is a good idea.My issue when not vectorizing the model was that it did not throw me an error. Later, trying to use the
pyvista
object, I still did not get an error but my wholePython
kernel died. This can be annoying if your script is long to run, and you do not know what went wrong. Getting an error earlier, without killing the whole kernel, would be very beneficial.In most cases in SimPEG, we use
order='F'
. Non vectorized model are not common. In this case, it was just me making a silly oversight, while interpolating from multiple 1D mesh to a global 3D mesh.Okay awesome! Then I think #163 is an appropriate fix for this issue and it should prevent kernel crashes.