[Paraview] Problem with numpy array

Caffagni, Andrea Andrea.Caffagni at ferrari.com
Wed Apr 18 02:14:44 EDT 2018


Dear Users,
I need to solve an eigenproblem in a point of a CFD field.
Using the GradientOfUnstructuredDataSet I calculate the velocity gradient of my velocity field, than I isolate may point of interest and I have written the following ProgrammableFilter:

import numpy as np
from numpy import linalg as LA
from paraview import numpy_support
input = inputs[0]

numPoints = input.GetNumberOfPoints()
print "number of points",numPoints
tensors = input.PointData['Gradients']
print "tensors[0:3]",tensors[0:3]
eigenvalues,eigenvectors = LA.eig(tensors)
print 'eigenvalues', eigenvalues[0]
print 'eigenvectors',eigenvectors[0]
output.PointData.append(eigenvalues,'eigenvalues')
output.PointData.append(eigenvectors,'eigenvectors')

I have obtained the following error message:

Traceback (most recent call last):
File "<string>", line 22, in <module>
File "<string>", line 14, in RequestData
File "C:\Program Files\ParaView 5.3.0-Qt5-OpenGL2-Windows-64bit\bin\lib\site-packages\numpy\linalg\linalg.py", line 1095, in eig
_assertRankAtLeast2(a)
File "C:\Program Files\ParaView 5.3.0-Qt5-OpenGL2-Windows-64bit\bin\lib\site-packages\numpy\linalg\linalg.py", line 202, in _assertRankAtLeast2
'at least two-dimensional' % len(a.shape))
numpy.linalg.linalg.LinAlgError: 0-dimensional array given. Array must be at least two-dimensional


I imagine that the problem is linked to the vtk array, I need to convert my ‘Gradients’ matrix in a nparray?
Someone have the same problem?

Best Regards,
Andrea



_________________________________________________________________________________________________________________



Questo messaggio è da intendersi esclusivamente ad uso del destinatario e può contenere informazioni che sono di natura privilegiata, confidenziale o non divulgabile secondo le leggi vigenti. Se il lettore del presente messaggio non è il destinatario designato, o il dipendente/agente responsabile per la consegna del messaggio al destinatario designato, si informa che ogni disseminazione, distribuzione o copiatura di questa comunicazione è vietata anche ai sensi della normativa vigente in materia di protezione dei dati personali. Se avete ricevuto questo messaggio per errore, vi preghiamo di notificarcelo immediatamente a mezzo e-mail di risposta e successivamente di procedere alla cancellazione di questa e-mail e relativi allegati dal vostro sistema.

_________________________________________________________________________________________________________________



This message is intended only for the use of the addressee and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is prohibited under the applicable data protection law. If you have received this e-mail by mistake, please notify us immediately by return e-mail and delete this e-mail and all attachments from your system.



_________________________________________________________________________________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/paraview/attachments/20180418/f7d74ac8/attachment.html>


More information about the ParaView mailing list