[Paraview] Problem with numpy array
Cory Quammen
cory.quammen at kitware.com
Wed Apr 18 11:33:18 EDT 2018
Hey Andy,
Does the GradientOfUnstructuredDataSet filter produce a tensor from an
input vector field? My testing in ParaView indicates it doesn't , but I'm
not super familiar with it.
Thanks,
Cory
On Wed, Apr 18, 2018 at 11:14 AM, Caffagni, Andrea <
Andrea.Caffagni at ferrari.com> wrote:
> Dear Cory,
>
> This is the complete message that I have obtained like output:
>
>
>
> 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
>
> number of points 1
>
> tensors[0:3] [VTKArray([[[ 8.34616375, -23.89611435, 2.00894117],
>
> [ 0.67995167, -23.11237526, 289.07113647],
>
> [ 27.26550674, -231.06710815, 16.90883636]]], dtype=float32)]
>
>
>
>
>
> From this, I have thought about the vtk array.
>
>
>
> Best regards,
>
> Andrea
>
>
>
> *From:* Cory Quammen [mailto:cory.quammen at kitware.com]
> *Sent:* Wednesday, April 18, 2018 15:11
> *To:* Caffagni, Andrea
> *Cc:* paraview at public.kitware.com
> *Subject:* Re: [Paraview] Problem with numpy array
>
>
>
> Hi Andrea,
>
>
>
> Besides the error message, what does your script print?
>
>
>
> Thanks,
>
> Cory
>
>
>
>
>
> On Wed, Apr 18, 2018 at 2:14 AM, Caffagni, Andrea <
> Andrea.Caffagni at ferrari.com> wrote:
>
> 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.
>
>
>
> ____________________________________________________________
> _____________________________________________________
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/ParaView
>
> Search the list archives at: http://markmail.org/search/?q=ParaView
>
> Follow this link to subscribe/unsubscribe:
> https://public.kitware.com/mailman/listinfo/paraview
>
>
>
>
>
> --
>
> Cory Quammen
> Staff R&D Engineer
> Kitware, Inc.
>
> ____________________________________________________________
> _____________________________________________________
>
>
>
> 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.
>
>
>
> ____________________________________________________________
> _____________________________________________________
>
--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/paraview/attachments/20180418/464b4301/attachment.html>
More information about the ParaView
mailing list