[Paraview] programmable access to vector components (via Python)

Berk Geveci berk.geveci at kitware.com
Fri May 25 16:13:16 EDT 2012


Which version of ParaView is this? This bug sounds very familiar to me and
I vaguely remember sitting down with Utkarsh to fix it. If it is an older
version, can you try 3.14?

As for the Python notation, take a look at:

http://paraview.org/Wiki/ParaView/Users_Guide/Python_Programmable_Filter
http://paraview.org/Wiki/ParaView/Users_Guide/Python_Calculator

You need to use something like: inputs[0].CellData['**mechTensor'][:, n]
where n is whichever component that you are accessing. This notation is
based on Numpy. You can learn more about it here:

Guide to NumPy -
Trelgol<http://www.google.com/url?sa=t&rct=j&q=numpy%20book&source=web&cd=1&ved=0CGAQFjAA&url=http%3A%2F%2Fwww.tramy.us%2Fnumpybook.pdf&ei=iee_T6LGNeK02gWuqqSwDQ&usg=AFQjCNEqRdLrjjyLB8CFsWb1wecnEuDfNg>

Note that NumPy is much more powerful and efficient that the Array
Calculator so I'd recommend using the Python Calculator or the Python
Programmable Filter whenever possible.


-berk


On Fri, May 25, 2012 at 10:03 AM, Fabian Wein <
fabian.wein at am.uni-erlangen.de> wrote:

> It appears to me you have found a limitation (or bug?) in the
>> Calculator filter. My comments are inserted below.
>>
>
> I just submitted a bug report: http://paraview.org/Bug/view.**php?id=13204<http://paraview.org/Bug/view.php?id=13204>
>
>
>  files, however, I have never used it. I graduated from VTK
>> XML-structured ASCII-text results files to the EnSight
>> binary-formatted specification in order to get compact, manageable
>> file-sets for my modestly large explicit transient dynamic simulations.
>>
>
> We are happy with HDF5 but this requires a own reader plugin for
> our format which we wrote some years ago. With HDF5 we have also access
> via Matlab, with is a plus for us.
>
>
>  If the error message reflects a "limitation" in the Calculator, then
>> the Calculator only processes scalars and vectors (1st-order tensors),
>> and that in itself is no small accomplishment.
>>
>
> My "mechTensor" is just a vector with 6 components, so the limitation is
> with the size of the vector.
>
> This answers two of my questions:
>
>
>  * am I right with the assumption, that the calculator does not like
>> double characters after the underline?
>> * Is this XX, YY, ... coming from Paraview?
>>
>
> Anyone who can help me with the following two?
>
>
>  * How do I access the vector components via python?
>> * Where can I find more information about the python interface?
>>
>
> Thanks a lot,
>
> Fabian
>
> ______________________________**_________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/**
> opensource/opensource.html<http://www.kitware.com/opensource/opensource.html>
>
> Please keep messages on-topic and check the ParaView Wiki at:
> http://paraview.org/Wiki/**ParaView <http://paraview.org/Wiki/ParaView>
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/**mailman/listinfo/paraview<http://www.paraview.org/mailman/listinfo/paraview>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120525/1d485854/attachment.htm>


More information about the ParaView mailing list