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><br><br>Pat<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">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 class="h5"><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>