[Paraview] Fwd: Python Calculator: create a multi-component field

Berk Geveci berk.geveci at kitware.com
Thu Apr 2 11:01:49 EDT 2015


Dear Christophe,

It seems like the documentation got out of date. Thank you for reporting
it. There is also a make_vector() function now. You can pass it 2 or 3
components:

def make_vector(arrayx, arrayy, arrayz=None):
    """Given 2 or 3 scalar arrays, returns a vector array. If only
    2 scalars are provided, the third component will be set to 0."""


I defer to Utkarsh to explain how to contribute to the tex documentation.
It is definitely very welcome.

Finally, I am not sure that I understand the comment about the potential
bug. Can you please give the steps to reproduce?

Thanks,
-berk

On Thu, Apr 2, 2015 at 5:23 AM, Christophe Bourcier <
christophe.bourcier.pv at gmail.com> wrote:

> Dear Paraview folks,
>
> It seems there is a mistake in the Paraview User's Guide at the end of the
> section Python Calculator.
>
> To create a multi-component field from multiple scalar fields, hstack used
> to work before Paraview 4.2.0.
>
> But since Paraview 4.2.0, we must use numpy.column_stack. This change may
> have been caused by the great work done in 4.2.0 to be able to use numpy
> arrays as vtk arrays with automatic conversion from numpy to vtk and
> inversely.
>
> Using hstack will create a dataset with many components (number of nodes
> times the number of field in hstack).
>
> For instance, create a sphere source with default properties.
>
> In Paraview 4.1.0, use this formula to create the same field as Normals:
> hstack((Normals[:,0], Normals[:,1], Normals[:,2]))
>
> In Paraview 4.2.0 and 4.3.1, if you use numpy.hstack((Normals[:,0],
> Normals[:,1], Normals[:,2])), you will get a field with 150 components,
> since the default sphere has 50 points. And it may lead to a memory
> oversize for a source with thousands points.
>
> In Paraview 4.2.0 and 4.3.1, the following formula gives the wanted
> result:
> numpy.column_stack((Normals[:,0], Normals[:,1], Normals[:,2]))
>
> Note that you must change the name of the result, otherwise the number of
> components is not updated between two different formulas. This might be a
> bug.
>
> I have not found where the latex documentation is. Is it available
> somewhere as a git repository? What is the policy on contributing to it?
>
> Christophe
>
>
> _______________________________________________
> 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:
> http://public.kitware.com/mailman/listinfo/paraview
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150402/2425b107/attachment.html>


More information about the ParaView mailing list