I'm not sure I completely understand about your inputs[0]. As for iterating over time with the python programmable filter, inside the filter it will only have access to values from a single time step at each invocation of RequestData(). You can think of the order of operations if you have 5 time steps as:<br>
1) iterate over each of the 5 time steps (i.e. load a file and update the pipeline with that data set)<br>2) update the python programmable filter output for the current data set resulting from the loaded file<br><br>If you want time statistics for your variables I think you probably want to use the calculator filter to square the value at each point and then use the temporal statistics filter to get an average of those values. After that you can just multiply the results by the number of time steps.<br>
<br>If I'm misunderstanding what you're trying to do, I'd suggest giving a description of what you're trying to do and maybe there's a simpler way of doing it.<br><br>Andy<br><br><div class="gmail_quote">
On Wed, Sep 5, 2012 at 2:56 PM, Frank Horowitz <span dir="ltr"><<a href="mailto:frank.horowitz@cornell.edu" target="_blank">frank.horowitz@cornell.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<div style="direction:ltr;font-size:10pt;font-family:Tahoma">OK Andy,
<br>
<br>
Thanks for that!<br>
<br>
I've compiled and installed Paraview from git's release branch, and (a slight modification) of your code runs correctly. I think that means that my paraview/python integration is semi-sane.<br>
<br>
However, my problem still occurs. Recall that I have a time series of .vtu files (indexed by integers built-in to their filenames) being fed into inputs[0] (at least as I understand it).<br>
<br>
In my original code snippet, I assumed that the "m = x*x" statement would iterate not only over the point values of the spatial array, but also over all timeslices. Is that a correct assumption? Is that the source of my problems???<br>
<br>
Thanks again for your help,<br>
Frank Horowitz<br>
<br>
<div style="font-size:16px;font-family:Times New Roman">
<hr>
<div style="direction:ltr"><font face="Tahoma" color="#000000"><b>From:</b> Andy Bauer [<a href="mailto:andy.bauer@kitware.com" target="_blank">andy.bauer@kitware.com</a>]<br>
<b>Sent:</b> Tuesday, September 04, 2012 7:57 PM<br>
<b>To:</b> Frank Horowitz<br>
<b>Cc:</b> <a href="mailto:paraview@paraview.org" target="_blank">paraview@paraview.org</a><br>
<b>Subject:</b> Re: [Paraview] Newbie question on Python Programmable Filters<br>
</font><br>
</div><div><div class="h5">
<div></div>
<div>Hi Frank,<br>
<br>
I didn't have a problem with the following on my windows machine using the ParaView 3.14.1 installer.
<br>
=======<br>
try: paraview.simple
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
except: from paraview.simple import *</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
paraview.simple._DisableFirstRenderCameraReset()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
Wavelet1 = Wavelet()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
RenderView1 = GetRenderView()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
ProgrammableFilter1 = ProgrammableFilter()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
ProgrammableFilter1.PythonPath = ''</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
ProgrammableFilter1.RequestInformationScript = ''</p>
<p style="margin:0px;text-indent:0px">ProgrammableFilter1.Script = 'x = inputs[0].PointData[\'RTData\']\nprint "x shape =",x.shape\n\nm = x*x # I _thought_ this should run at numpy speeds?\nprint "m shape=",m.shape\n\n# more debugging code to finish computation
of the norm omitted\n\noutput.PointData.append(m,"Displacement Norm")'</p>
<p style="margin:0px;text-indent:0px">Show()</p>
<p style="margin:0px;text-indent:0px">Render()</p>
<p style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
=============<br>
</p>
<br>
Does this work for you? If it doesn't, I wonder if it's an issue with having multiple pythons and numpy or system environments causing problems. What version of paraview are you using and how did you get it built/installed on your machine?<br>
<br>
Andy<br>
<br>
<div class="gmail_quote">On Tue, Sep 4, 2012 at 6:04 PM, Frank Horowitz <span dir="ltr">
<<a href="mailto:frank.horowitz@cornell.edu" target="_blank">frank.horowitz@cornell.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hal Canary wrote on Tue Sep 4 15:22:01 EDT 2012:<br>
<div>> On 09/04/2012 02:20 PM, Frank Horowitz wrote:<br>
> ><br>
> x = inputs[0].PointData['Scalars_']<br>
><br>
><br>
><br>
> I thought one needs to convert a vtkarray to a numpy array with<br>
><br>
> x = numpy.array(inputs[0].PointData['Scalars_'])<br>
><br>
> before doing anything with it.<br>
<br>
<br>
</div>
Computations after that style of construction hang too. To my eye, the results of such an expression should be 100% standard numpy, obeying 100% standard numpy semantics.<br>
<br>
It appears that there is a bug in numpy integration to the Python Programmable Filter.<br>
<br>
I'll re-compile from source and report back on the results. Is the bug tracking system evident from the homepage?<br>
<br>
Cheers,<br>
Frank Horowitz<br>
<div>
<div><br>
<br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">
http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div></div></div>
</div>
</div>
</blockquote></div><br>