This works indeed. It's been a while since I have programmed in Python, I should have thought of it :) Thank you very much!<br><br>Milos<br><br><br><div class="gmail_quote">On Thu, Sep 16, 2010 at 12:31 AM, pat marion <span dir="ltr"><<a href="mailto:pat.marion@kitware.com">pat.marion@kitware.com</a>></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;">Why not something like-<br><br><br>import subprocess<br><br>for f in filenames:<br>Â subprocess.call(["/path/to/pvpython", "process_single_dataset.py", f])<br>
<font color="#888888"><br><br>Pat</font><div><div></div><div class="h5"><br><br><div class="gmail_quote">
On Wed, Sep 15, 2010 at 5:35 PM, Milos Ilak <span dir="ltr"><<a href="mailto:ilak@mech.kth.se" target="_blank">ilak@mech.kth.se</a>></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;">
Hi,<br><br>I have a related question. I would like to use the Python interface to create movies of large datasets from .png files. Having the .pngs gives me flexibility in encoding them. I know that ParaView can export animations as .pngs files, but I would like to do this in offscreen mode and without running the animation in ParaView first.<br>
<br>I haven't been able to figure out how to run a single instance of ParaView during every iteration of a loop over file names (or, say, camera angles) within a Python script, i.e. open ParaView, work on one file, output a .png, and then close ParaView. <br>
<br>The fix below with clearing the pipeline each time seems to work, but I was wondering if it would be possible to invoke ParaView 'from scratch' during each call and how. Also, would there be any disadvantages to doing that, as opposed to having a single instance of ParaView during the entire loop and clearing the pipeline as below?<br>
<br>I apologize if this has been discussed, but I haven't been able to find any of those discussions if so. <br><br>Milos<div><div></div><div><br><br><br><br><br><br><div class="gmail_quote">On Wed, Sep 15, 2010 at 10:12 PM, logari81 <span dir="ltr"><<a href="mailto:logari81@googlemail.com" target="_blank">logari81@googlemail.com</a>></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;">Thank you for the quick response. You are right, what I actually need is<br>
to clear the pipeline. Your snippet seems to work well except some<br>
naming counters which are not reset but in my use case this isn't very<br>
important.<br>
<br>
Thanks a lot for your help.<br>
<br>
Best Regards<br>
<br>
Kostas<br>
<div><div></div><div><br>
On Wed, 2010-09-15 at 15:49 -0400, pat marion wrote:<br>
> If your intention is to just clear the pipeline, try this code, copied<br>
> from the paraview coprocessor template:<br>
><br>
> def GetProxiesToDelete():<br>
> Â Â iter = servermanager.vtkSMProxyIterator()<br>
> Â Â iter.Begin()<br>
> Â Â tobedeleted = []<br>
> Â Â while not iter.IsAtEnd():<br>
> Â Â Â if iter.GetGroup().find("prototypes") != -1:<br>
> Â Â Â Â Â iter.Next()<br>
> Â Â Â Â Â continue<br>
> Â Â Â proxy = servermanager._getPyProxy(iter.GetProxy())<br>
> Â Â Â proxygroup = iter.GetGroup()<br>
> Â Â Â iter.Next()<br>
> Â Â Â if proxygroup != 'timekeeper' and proxy != None and<br>
> proxygroup.find("pq_helper_proxies") == -1 :<br>
> Â Â Â Â Â tobedeleted.append(proxy)<br>
><br>
> Â Â return tobedeleted<br>
><br>
> # explicitly delete the proxies -- we do it this way to avoid problems<br>
> with prototypes<br>
> tobedeleted = GetProxiesToDelete()<br>
> while len(tobedeleted) > 0:<br>
> Â Â Delete(tobedeleted[0])<br>
> Â Â tobedeleted = GetProxiesToDelete()<br>
><br>
><br>
> On Wed, Sep 15, 2010 at 3:21 PM, pat marion <<a href="mailto:pat.marion@kitware.com" target="_blank">pat.marion@kitware.com</a>><br>
> wrote:<br>
> Â Â Â Â I'm afraid your use case is not well supported. Â There is<br>
> Â Â Â Â logic in the paraview gui application that ensures a clean<br>
> Â Â Â Â disconnect, which includes a hard reset of the python<br>
> Â Â Â Â interpreter context. Â Using only python modules, there is<br>
> Â Â Â Â manual clean up required after a disconnect that is not yet<br>
> Â Â Â Â supported.<br>
><br>
> Â Â Â Â You might find that your script still works, you'll just be be<br>
> Â Â Â Â spammed with those error messages. Â Also, try calling<br>
> Â Â Â Â Connect() instead of servermanager.Disconnect(...). Â This will<br>
> Â Â Â Â disconnect & reconnect a little more cleanly, but still not<br>
> Â Â Â Â perfect.<br>
><br>
> Â Â Â Â Pat<br>
><br>
><br>
><br>
><br>
> Â Â Â Â On Wed, Sep 15, 2010 at 2:52 PM, logari81<br>
> Â Â Â Â <<a href="mailto:logari81@googlemail.com" target="_blank">logari81@googlemail.com</a>> wrote:<br>
> Â Â Â Â Â Â Â Â In the meanwhile I have realized that the error occurs<br>
> Â Â Â Â Â Â Â Â only when I<br>
> Â Â Â Â Â Â Â Â include a Delete() statement in my script. Thus the<br>
> Â Â Â Â Â Â Â Â following very<br>
> Â Â Â Â Â Â Â Â simple script reproduces the error:<br>
><br>
> Â Â Â Â Â Â Â Â import sys<br>
> Â Â Â Â Â Â Â Â sys.path.append('/usr/lib/paraview')<br>
> Â Â Â Â Â Â Â Â from paraview.simple import *<br>
> Â Â Â Â Â Â Â Â cone = Cone()<br>
> Â Â Â Â Â Â Â Â Delete(cone)<br>
> Â Â Â Â Â Â Â Â servermanager.Disconnect(servermanager.ActiveConnection)<br>
><br>
> Â Â Â Â Â Â Â Â Hopefully someone can explain this behavior.<br>
><br>
> Â Â Â Â Â Â Â Â Best Regards<br>
><br>
> Â Â Â Â Â Â Â Â Kostas<br>
><br>
><br>
><br>
> Â Â Â Â Â Â Â Â On Wed, 2010-09-15 at 18:59 +0200, logari81 wrote:<br>
> Â Â Â Â Â Â Â Â > Hi,<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â > actually I have the same question as in this<br>
> Â Â Â Â Â Â Â Â previous email:<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â <a href="http://www.paraview.org/pipermail/paraview/2008-March/007506.html" target="_blank">http://www.paraview.org/pipermail/paraview/2008-March/007506.html</a><br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â > I use the python interface in an application that I<br>
> Â Â Â Â Â Â Â Â am developing and I<br>
> Â Â Â Â Â Â Â Â > import paraview with:<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â > from paraview.simple import *<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â > During the import a connection to the builtin server<br>
> Â Â Â Â Â Â Â Â is also established<br>
> Â Â Â Â Â Â Â Â > silently. Though, in my application I need to clear<br>
> Â Â Â Â Â Â Â Â the pipeline<br>
> Â Â Â Â Â Â Â Â > occasionally in order to begin with a new output, so<br>
> Â Â Â Â Â Â Â Â I tried<br>
> Â Â Â Â Â Â Â Â > disconnecting from the server with:<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â servermanager.Disconnect(servermanager.ActiveConnection)<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â > but I receive the error:<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â > ERROR:<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â In /build/buildd/paraview-3.8.0/Servers/Common/vtkProcessModuleConnectionManager.cxx, line 175<br>
> Â Â Â Â Â Â Â Â > vtkProcessModuleConnectionManager (0x1d33240):<br>
> Â Â Â Â Â Â Â Â Invalid connection ID: 5<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â > This behavior is tested with ParaView 3.8.0 on<br>
> Â Â Â Â Â Â Â Â Ubuntu 10.04.<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â > I would be glad for any hints.<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â > Kind Regards<br>
> Â Â Â Â Â Â Â Â ><br>
> Â Â Â Â Â Â Â Â > Kostas<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<br>
> Â Â Â Â Â Â Â Â <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<br>
> Â Â Â Â Â Â Â Â 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>
><br>
><br>
><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><br clear="all"><br></div></div><font color="#888888">-- <br><font color="#888888"><div>
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div>
<div><span>Miloš Ilak</span></div><div>Linné Flow Centre</div><div>KTH
Mechanics, Stockholm </div><div>+46(0) 8 790-7152</div><div><a href="http://www2.mech.kth.se/%7Eilak/" target="_blank">www2.mech.kth.se/~<span>ilak</span></a><br><br></div></div></span></span>
</div></font><br>
</font></blockquote></div><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><font color="#888888"><div>
<span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div>
<div><span>Miloš Ilak</span></div><div>Linné Flow Centre</div><div>KTH
Mechanics, Stockholm </div><div>+46(0) 8 790-7152</div><div><a href="http://www2.mech.kth.se/%7Eilak/" target="_blank">www2.mech.kth.se/~<span>ilak</span></a><br><br></div></div></span></span>
</div></font><br>