[Paraview] PV 3.10.1 using python to slice and integratevariable
Adriano Gagliardi
agagliardi at ara.co.uk
Thu Jun 16 13:26:47 EDT 2011
Another option is to write a programmable filter that will take the input
(from the integrate variables) and write it out using standard python
commands. You can then reference this in your script.
iv = IntegrateVariables(Input=blah)
pf = ProgrammableFilter(Input=pf)
pf.Script = """
pdi = self.GetInputDataObject(0,0)
your_var = pdi.GetPointData().GetArray("your_var")
fout = open("results.txt",'a')
for i in xrange(len(your_var)):
fout.write( "%s %s %s" % (your_var.GetTuple3(i)[0],
your_var.GetTuple3(i)[1], your_var.GetTuple3(i)[2]) )
fout.close()
"""
If you have a number of slices stored in a vtkMultiBlockDataSet then you'll
have to iterate over each of them first.
Ad
===================================
Adriano Gagliardi MEng PhD
Business Sector Leader
Computational Aerodynamics
Aircraft Research Association Ltd.
Manton Lane
Bedford
Tel: 01234 32 4644
E-mail: agagliardi at ara.co.uk
Url: www.ara.co.uk
_____
From: paraview-bounces at paraview.org [mailto:paraview-bounces at paraview.org]
On Behalf Of Andy Bauer
Sent: 16 June 2011 18:10
To: Stephen Wornom
Cc: paraview at paraview.org
Subject: Re: [Paraview] PV 3.10.1 using python to slice and
integratevariable
You could interactively run through the scripts with pvpython and then use
dir() and help() to figure out how to write out the information properly.
You'll probably need to do something like:
SetActiveSource(<the filter that connects to your writer>)
writer = XMLPolyDataWriter() # most writers take off the vtk part
writer.FileName= "file.vtp"
writer.UpdatePipeline()
Hope this helps,
Andy
On Thu, Jun 16, 2011 at 8:57 AM, Stephen Wornom <stephen.wornom at inria.fr>
wrote:
pat marion wrote:
Did you try python trace? Tools menu --> Start Trace. Then load your data
and carry out steps 1, 2, and 3. Tools menu --> Stop Trace.
Thanks Pat,
Worked correctly (We saved the .py script for reference)
with the following exception.
The integrate variables opens a spread sheet with the different values.
We then do save data to save the spreadsheet.
Stop trace
*But* the trace does not contain the save spread sheet commands. Therefore
we do not see how to generalize the trace.py (add a loop over theta 0 -
180).
Almost there, what do you suggest?
Many thanks for your help.
Stephen
Pat
On Wed, Jun 15, 2011 at 4:39 PM, Stephen Wornom <stephen.wornom at inria.fr
<mailto:stephen.wornom at inria.fr>> wrote:
We are using PV to analyze flow around a sphere.
1- We extract the surface of the sphere from the mean flow solution.
2- We make a slice in x (say at the center x=0)
3- Then click integrate variables. Result: We get the integrated
values for the circle at x=0.
4- We would like to create a python script do automate this for
say 60 slices.
Would someone share a python script that we could adapt to do
this? (We have zero experience with python).
We would be greatly appreciative!
Stephen
-- stephen.wornom at inria.fr <mailto:stephen.wornom at inria.fr>
2004 route des lucioles - BP93
Sophia Antipolis
06902 CEDEX
Tel: 04 92 38 50 54
Fax: 04 97 15 53 51
_______________________________________________
Powered by www.kitware.com <http://www.kitware.com>
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
--
stephen.wornom at inria.fr
2004 route des lucioles - BP93
Sophia Antipolis
06902 CEDEX
Tel: 04 92 38 50 54
Fax: 04 97 15 53 51
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the ParaView Wiki at:
http://paraview.org/Wiki/ParaView
Follow this link to subscribe/unsubscribe:
http://www.paraview.org/mailman/listinfo/paraview
**********************************************************************
This email contains information that is private and confidential and is intended only for the addressee.
If you are not the intended recipient please delete it and notify us immediately by e-mailing the sender.
Note: All email sent to or from this address may be accessed by someone other than the recipient, for
system management and security reasons.
Aircraft Research Association Ltd. Registered in England, Registration No 503668 Registered Office:
Manton Lane, Bedford MK41 7PF England VAT No GB 196351245
**********************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.paraview.org/pipermail/paraview/attachments/20110616/ac3a82bb/attachment.htm>
More information about the ParaView
mailing list