[Paraview] Newbie question on Python Programmable Filters

Frank Horowitz frank.horowitz at cornell.edu
Tue Sep 4 14:20:03 EDT 2012


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







More information about the ParaView mailing list