[Paraview] How to get array member data in python shell or programmable filter in paraview?

David E DeMarle dave.demarle at kitware.com
Wed Aug 8 10:39:52 EDT 2012


In general to access the real data, use the python programmable
filter, which executes on the server where the data exists, to access
the data array contents. See the wiki for examples.

If the data is small, use servermanager.Fetch in the python shell to
copy the data from the server to the client. From there you have
direct access the arrays.

For example, with the wavelet source:
>>> proxy_toa_filter = GetActiveSource()
>>> its_data = servermanager.Fetch(proxy_toa_filter)
>>> its_data.GetPointData().GetArray('RTData').GetValue(0)
60.763465881347656
>>> its_data.GetPointData().GetArray('RTData').GetValue(1)
85.877952575683594

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Tue, Aug 7, 2012 at 7:23 PM, Mei Chen <mei.chen.web at gmail.com> wrote:
> Hi,
>
> I use GradientOfUnstructuredDataSet to get Gradients. I can see the
> Gradients_0, ..., Gradients_8 on the Scalars part if I add a new Calculator
> filter after the GradientOfUnstructuredDataSet filter. My question is how to
> get these Gradients_0, ..., Gradients_8 in Python Shell or Programmable
> Filter? I would like to do some data process with them.
>
> I tried to get by this way:
> reader = GetActiveSource()
> gradientsAll = reader.PointData.GetArray(1) # suppose the Gradients is the
> second variables in the data list
> gradientsAll.GetRange(0) # I can see the range of the 9 gradient scalars but
> I cannot access the data
>
> I want to create a Jacobi matrix of these 9 gradients to calculate other
> support matrix and the eigenvalues (for example, to get the Lambda2
> criterion). I also need the number of points. I check the proxy but have no
> idea which function can be used.
> Any suggestion or example of codes will be very appreciated!
>
>
> Thanks,
> Mei Chen
>
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview
>


More information about the ParaView mailing list