[Paraview] Newbie question on Python Programmable Filters

Berk Geveci berk.geveci at kitware.com
Thu Sep 6 12:17:00 EDT 2012

I am just starting to read this thread so I wanted to answer various
questions here separately.

Your assumption is correct. m = x*x will be 100% evaluated by NumPy. In
theory, this should be pretty much instantaneous for ~1M elements, even for
20 timeslices.

On Tue, Sep 4, 2012 at 2:20 PM, Frank Horowitz
<frank.horowitz at cornell.edu>wrote:

> Hi All,
> I'm trying to visualize some vector component field time series written by
> a seismic wave propagation code, and converted into .vtu files by a set of
> upstream scripts.
> I'm trying to compute the norm of the vector at each timeslice and then
> visualize the resulting scalar field. The data are all PointData. There are
> approximately 866,000 values for each compoment per timeslice, and about 20
> time slices.
> I'm trying to do this computation via the Python Programmable Filter
> (mostly so I can learn its tricks for future reference). However, I'm
> running into an apparent hang. The following code (complete with many more
> debugging print statements than I would use in production) is the simplest
> code I can make fail reliably:
> --- begin code snippet ---
> x = inputs[0].PointData['Scalars_']
> print "x shape =",x.shape
> y = inputs[1].PointData['Scalars_']
> print "y shape =",y.shape
> z = inputs[2].PointData['Scalars_']
> print "z shape =",z.shape
> m = x*x  # I _thought_ this should run at numpy speeds…
> print "m shape=",m.shape
> # more debugging code to finish computation of the norm omitted
> output.PointData.append(m,"Displacement Norm")
> --- end code snippet ---
> I can run everything -- cutting and pasting initial subsets of the code
> into the program text box -- with the print output I expected all the way
> to the "m = x*x" statement.  If I include the "m=x*x" statement the process
> hangs. It does not even print out the preceding print statements.
> I was under the impression that such syntax as my "x*x" used above would
> be evaluated by numpy, and the (implicit) loop should be executed at C
> speeds.  Am I correct in that understanding?  If not, how should I go about
> coding an equivalent computation in the Programmable Filter that would
> execute at C (numpy) speeds?
> Thanks in advance for any help you might be able to provide,
>         Frank Horowitz
>         Cornell, Earth and Atmospheric Sciences
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20120906/ffa42d22/attachment.htm>

More information about the ParaView mailing list