Hmm, I tried extracting out the components using the Calculator filter and then using the PythonCalculator filter to do that math.atan2 function.  Underneath the covers I believe there is a conversion from a vtkDataArray to a numpy array and then back again.  I don&#39;t think this is getting done for the math.atan2 function (it&#39;s not listed in the web page of python calculator functions) so you may be stuck here unless someone else has an idea.<br>
<br>Andy<br><br><div class="gmail_quote">On Wed, Feb 16, 2011 at 10:25 AM, Nico Schlömer <span dir="ltr">&lt;<a href="mailto:nico.schloemer@gmail.com">nico.schloemer@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
That sounds *exactly* like what I need. Great!<br>
I&#39;m having problems selecting the data sets though: Where<br>
&quot;atan(psi__Y/psi__X)&quot; works with the calculator filter, &quot;math.atan2(<br>
psi__Y, psi__X)&quot; fails in the PythonCalculator with<br>
<br>
============== *snip* ==============<br>
Traceback (most recent call last):<br>
  File &quot;&lt;string&gt;&quot;, line 19, in &lt;module&gt;<br>
  File &quot;&lt;string&gt;&quot;, line 27, in RequestData<br>
NameError: name &#39;psi__Y&#39; is not defined<br>
============== *snap* ==============<br>
<br>
I looked at <a href="http://www.paraview.org/Wiki/Python_Calculator" target="_blank">http://www.paraview.org/Wiki/Python_Calculator</a> but<br>
couldn&#39;t figure out what&#39;s wrong.<br>
<font color="#888888"><br>
--Nico<br>
</font><div><div></div><div class="h5"><br>
<br>
<br>
On Wed, Feb 16, 2011 at 2:43 PM, Tim Gallagher &lt;<a href="mailto:tim.gallagher@gatech.edu">tim.gallagher@gatech.edu</a>&gt; wrote:<br>
&gt; You can use the Python Calculator, which will let you use any valid Python expression -- such as math.atan2().<br>
&gt;<br>
&gt; Tim<br>
&gt;<br>
&gt; ----- Original Message -----<br>
&gt; From: &quot;Nico Schlömer&quot; &lt;<a href="mailto:nico.schloemer@gmail.com">nico.schloemer@gmail.com</a>&gt;<br>
&gt; To: &quot;Andy Bauer&quot; &lt;<a href="mailto:andy.bauer@kitware.com">andy.bauer@kitware.com</a>&gt;<br>
&gt; Cc: <a href="mailto:paraview@paraview.org">paraview@paraview.org</a><br>
&gt; Sent: Wednesday, February 16, 2011 8:29:02 AM<br>
&gt; Subject: Re: [Paraview] unstructured grid, programmable filters: extract, process array data<br>
&gt;<br>
&gt; Almost there!<br>
&gt;<br>
&gt;&gt; atan(coordsX/coordsY)<br>
&gt;<br>
&gt; If instead of coordsX I use psi__{X,Y}, things work. However, I need<br>
&gt; something slightly different than atan: I&#39;d like to get the complex<br>
&gt; argument of a complex number X+iY (i.e., the angle with the positive<br>
&gt; real axis). It&#39;s quite ~similar~ to what atan does, see for example<br>
&gt; &lt;<a href="http://gcc.gnu.org/onlinedocs/gcc-4.0.4/gfortran/ATAN2.html" target="_blank">http://gcc.gnu.org/onlinedocs/gcc-4.0.4/gfortran/ATAN2.html</a>&gt;. In<br>
&gt; Python, the function is called math.atan2() as well.<br>
&gt; ParaView&#39;s  calculator filter does however not support atan2(), and<br>
&gt; that was my original motivation to look at programmable filters<br>
&gt; actually. Well, it&#39;d be much nicer if the same thing could be done<br>
&gt; with the calculator of course!<br>
&gt; Workarounds?<br>
&gt;<br>
&gt; --Nico<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Feb 15, 2011 at 6:56 PM, Andy Bauer &lt;<a href="mailto:andy.bauer@kitware.com">andy.bauer@kitware.com</a>&gt; wrote:<br>
&gt;&gt; This sounds like a job for the calculator filter.  &quot;coordsX^2+coordsY^2&quot; for<br>
&gt;&gt; your first example (or &quot;psi__X^2+psi__Y^2&quot; for the psi variables) and<br>
&gt;&gt; &quot;atan(coordsX/coordsY)&quot; for the second example.<br>
&gt;&gt;<br>
&gt;&gt; It can operate on point or cell data (set in the Attribute Model drop-down<br>
&gt;&gt; menu), replace invalid numbers with a specified value, and you can name the<br>
&gt;&gt; resulting array as well.<br>
&gt;&gt;<br>
&gt;&gt; Andy<br>
&gt;&gt;<br>
&gt;&gt; 2011/2/15 Nico Schlömer &lt;<a href="mailto:nico.schloemer@gmail.com">nico.schloemer@gmail.com</a>&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Hi all,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I&#39;ve been looking at<br>
&gt;&gt;&gt; &lt;<a href="http://www.paraview.org/Wiki/Python_Programmable_Filter" target="_blank">http://www.paraview.org/Wiki/Python_Programmable_Filter</a>&gt; to create a<br>
&gt;&gt;&gt; programmable filter, but I&#39;m a bit lost as to whether or not I need<br>
&gt;&gt;&gt; GetPolyData, CopyAttributes,...<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Essentially, I have an unstructured grid in an ExodusII file (like the<br>
&gt;&gt;&gt; attached file actually) with point data &quot;psi&quot; in it that has two<br>
&gt;&gt;&gt; components (X,Y). I can plot psi:X, psi:Y, and psi:magnitude alright<br>
&gt;&gt;&gt; with the default GUI options, but what I would really like to have<br>
&gt;&gt;&gt; plotted is X^2+Y^2 (no sqrt()) and something along the lines of<br>
&gt;&gt;&gt; arctan(Y/X).<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Is there simple code somewhere some that takes array data off of an<br>
&gt;&gt;&gt; unstructured grid, does something with it and returns the extra array<br>
&gt;&gt;&gt; from the filter?<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Cheers,<br>
&gt;&gt;&gt; Nico<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Visit other Kitware open-source projects at<br>
&gt;&gt;&gt; <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Please keep messages on-topic and check the ParaView Wiki at:<br>
&gt;&gt;&gt; <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Follow this link to subscribe/unsubscribe:<br>
&gt;&gt;&gt; <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
&gt; _______________________________________________<br>
&gt; Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; 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>
&gt;<br>
&gt; Follow this link to subscribe/unsubscribe:<br>
&gt; <a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
&gt;<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>