[prev in list] [next in list] [prev in thread] [next in thread] 

List:       paraview
Subject:    [Paraview] Fwd: Paraview/Python script speed extracting data
From:       "Thomas, Christian" <c.thomas () imperial ! ac ! uk>
Date:       2015-02-26 12:04:44
Message-ID: 6C8BFABD-3338-4E43-BA9E-73592ABC9321 () Imperial ! ac ! uk
[Download RAW message or body]

Hi all,

I have sorted out my bottleneck/time processing speed issue. I'm sure the following \
method\script is well known to many python/paraview users. I had to include

delete (source_name) and del source_ name, once each source was no longer needed. \
                This was particularly useful when running loops around several \
                filters.
Example: delete(T1), del T1

I also included the clip filter several times to reduce the size of the mesh\data \
file.

C1 = Clip(Input = T1)
C1.ClipType = "Plane"
C1.ClipType.Origin = [0.0, 0.0, ZMin[0]]
C1.ClipType.Normal = [0.0, 0.0, 1.0]

Regards
Christian



Dr. Christian Thomas
Postdoctoral Research Associate

Department of Mathematics
Room 737, Huxley Building
180, Queen’s Gate
Imperial College London
SW7 2AZ

c.thomas@imperial.ac.uk<mailto:c.thomas@imperial.ac.uk>







Begin forwarded message:

Subject: Paraview/Python script speed extracting data
Date: 20 February 2015 13:05:48 GMT
To: <paraview@paraview.org<mailto:paraview@paraview.org>>

Hi

I'm writing a python script that uses several paraview filters. I then extract data \
from the final filter for further analysis in python. However, I'm having a problem \
with the speed of the data extraction (can take several minutes). I have tried \
writing to a file (createwriter) and then reading the file. I have also tried \
servermanager.Fetch() and GetPoints… Although I am able to get data with both \
methods, they are both very slow. I was wondering if there was anything obvious in my \
paraview/python script that was slowing the process or if anyone has a suggestion at \
how I may speed things up. (I realise this could just be down to the size of my \
initial input, for small data files Mesh - 15MB, solution - 50MB).

The script is below. Any suggestions would be greatly appreciated.

Regards
Christian



TBR = TAUMeshReader( FileName=Dir+'Mesh' )
TBR.SurfaceMeshOnly = 0
TBR.SolutionFileName = Dir+'solution'
MB = MergeBlocks(Input = TBR)
T1 = Transform(Input = MB)
T1.Transform.Rotate = [-float(Rot/2.0), 0.0, Sweep]
ISO = IsoVolume(Input = T1)
ISO.ThresholdRange = [MIN_Tot_Pre, BLE_Tot_Pre]
ISO.InputScalars = ['POINTS','total_pressure']
SL = Slice(Input = T1)
SL.SliceType="Plane"
SL.SliceOffsetValues = n
SL.SliceType.Origin = Inboard
SL.SliceType.Normal = Normal
Con = Contour(Input = SL)
Con.PointMergeMethod = "Uniform Binning"
Con.ContourBy = ['POINTS', 'total_pressure']
Con.Isosurfaces = [BLE_Tot_Pre]
Pass = PassArrays(Con)
Pass.PointDataArrays = ['wall_distance']
h=CreateWriter(Dir+'Edge.csv',Pass)
h.FieldAssociation = "Points"
h.Precision = 15
h.UpdatePipeline()

….read Edge.csv file for further analysis


[Attachment #3 (text/html)]

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; "> <div>Hi all,</div>
<div><br>
</div>
<div>I have sorted out my bottleneck/time processing speed issue. I'm sure the \
following method\script is well known to many python/paraview users.&nbsp;</div> \
<div>I had to include&nbsp;</div> <div><br>
</div>
<div>delete (source_name) and del source_ name, once each source was no longer \
needed. This was particularly useful when running loops around several filters.</div> \
<div>Example: delete(T1), del T1</div> <div><br>
</div>
<div>I also included the clip filter several times to reduce the size of the \
mesh\data file.&nbsp;</div> <div><br>
</div>
<div>
<div>C1 = Clip(Input = T1)</div>
<div>C1.ClipType = &quot;Plane&quot;</div>
<div>C1.ClipType.Origin = [0.0, 0.0, ZMin[0]]</div>
<div>C1.ClipType.Normal = [0.0, 0.0, 1.0]</div>
</div>
<div><br>
</div>
<div>Regards</div>
<div>Christian</div>
<div><br>
</div>
<div><br>
</div>
<br>
<div apple-content-edited="true">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; "> Dr. Christian Thomas<br>
Postdoctoral Research Associate<br>
<br>
Department of Mathematics<br>
Room 737, Huxley Building</div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; "> 180, Queen’s Gate<br>
Imperial College London</div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: \
after-white-space; "> SW7 2AZ<br>
<br>
<a href="mailto:c.thomas@imperial.ac.uk">c.thomas@imperial.ac.uk</a><br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
</div>
<div><br>
<div>Begin forwarded message:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: \
0px;"> <span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, \
1.0);"><b>Subject: </b></span><span style="font-family:'Helvetica'; \
font-size:medium;"><b>Paraview/Python script speed extracting data</b><br> \
</span></div> <div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; \
margin-left: 0px;"> <span style="font-family:'Helvetica'; font-size:medium; \
color:rgba(0, 0, 0, 1.0);"><b>Date: </b></span><span style="font-family:'Helvetica'; \
font-size:medium;">20 February 2015 13:05:48 GMT<br> </span></div>
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: \
0px;"> <span style="font-family:'Helvetica'; font-size:medium; color:rgba(0, 0, 0, \
1.0);"><b>To: </b></span><span style="font-family:'Helvetica'; \
font-size:medium;">&lt;<a \
href="mailto:paraview@paraview.org">paraview@paraview.org</a>&gt;<br> </span></div>
<br>
<div>Hi<br>
<br>
I'm writing a python script that uses several paraview filters. I then extract data \
from the final filter for further analysis in python. However, I'm having a problem \
with the speed of the data extraction (can take several minutes). I have tried \
writing to  a file (createwriter) and then reading the file. I have also tried \
servermanager.Fetch() and GetPoints… Although I am able to get data with both \
methods, they are both very slow. I was wondering if there was anything obvious in my \
paraview/python script that  was slowing the process or if anyone has a suggestion at \
how I may speed things up. <br>
(I realise this could just be down to the size of my initial input, for small data \
files Mesh - 15MB, solution - 50MB).<br> <br>
The script is below. Any suggestions would be greatly appreciated.<br>
<br>
Regards<br>
Christian<br>
<br>
<br>
<br>
<span class="Apple-tab-span" style="white-space:pre"></span>TBR = TAUMeshReader( \
FileName=Dir&#43;'Mesh' )<br> <span class="Apple-tab-span" \
style="white-space:pre"></span>TBR.SurfaceMeshOnly = 0<br> <span \
class="Apple-tab-span" style="white-space:pre"></span>TBR.SolutionFileName = \
Dir&#43;'solution'<br> <span class="Apple-tab-span" style="white-space:pre"></span>MB \
= MergeBlocks(Input = TBR)<br> <span class="Apple-tab-span" \
style="white-space:pre"></span>T1 = Transform(Input = MB)<br> <span \
class="Apple-tab-span" style="white-space:pre"></span>T1.Transform.Rotate = \
[-float(Rot/2.0), 0.0, Sweep]<br> <span class="Apple-tab-span" \
style="white-space:pre"></span>ISO = IsoVolume(Input = T1)<span \
class="Apple-tab-span" style="white-space:pre"> </span><br>
<span class="Apple-tab-span" style="white-space:pre"></span>ISO.ThresholdRange = \
[MIN_Tot_Pre, BLE_Tot_Pre]<br> <span class="Apple-tab-span" \
style="white-space:pre"></span>ISO.InputScalars = ['POINTS','total_pressure']<br> \
<span class="Apple-tab-span" style="white-space:pre"></span>SL = Slice(Input = \
T1)<br> <span class="Apple-tab-span" \
style="white-space:pre"></span>SL.SliceType=&quot;Plane&quot;<br> <span \
class="Apple-tab-span" style="white-space:pre"></span>SL.SliceOffsetValues = n<br> \
<span class="Apple-tab-span" style="white-space:pre"></span>SL.SliceType.Origin = \
Inboard<br> <span class="Apple-tab-span" \
style="white-space:pre"></span>SL.SliceType.Normal = Normal<br> <span \
class="Apple-tab-span" style="white-space:pre"></span>Con = Contour(Input = SL)<br> \
<span class="Apple-tab-span" style="white-space:pre"></span>Con.PointMergeMethod = \
&quot;Uniform Binning&quot;<br> <span class="Apple-tab-span" \
style="white-space:pre"></span>Con.ContourBy = ['POINTS', 'total_pressure']<br> <span \
class="Apple-tab-span" style="white-space:pre"></span>Con.Isosurfaces = \
[BLE_Tot_Pre]<br> <span class="Apple-tab-span" style="white-space:pre"></span>Pass = \
PassArrays(Con)<br> <span class="Apple-tab-span" \
style="white-space:pre"></span>Pass.PointDataArrays = ['wall_distance']<br> <span \
class="Apple-tab-span" \
style="white-space:pre"></span>h=CreateWriter(Dir&#43;'Edge.csv',Pass)<br> <span \
class="Apple-tab-span" style="white-space:pre"></span>h.FieldAssociation = \
&quot;Points&quot;<br> <span class="Apple-tab-span" \
style="white-space:pre"></span>h.Precision = 15<br> <span class="Apple-tab-span" \
style="white-space:pre"></span>h.UpdatePipeline()<br> <br>
<span class="Apple-tab-span" style="white-space:pre"></span>….read Edge.csv file for \
further analysis<br> <br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
</blockquote>
</div>
<br>
</body>
</html>



_______________________________________________
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

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

--===============0067305267==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic