I typically use VTK directly when I want to access the raw data from python/numpy. See the series of Blog post by Berk Geveci for more information on that: http://kitware.com/blog/home/post/709

In ParaView, to my understanding, you first have to get the data from the backend to the frontend with "servermanager.Fetch". I attached a modified version of the script that shows you how to do this in a quick-and-dirty way. See more here: http://www.paraview.org/Wiki/ParaView/Python_Scripting

If there is a better way to get access to the raw data, I would be really happy to learn how to do this.

Best regards,
Armin





On 07/03/2015 11:21 AM, [email protected] wrote:
Thanks for the script, but how can I now access the data that were found
by ProbeLocation? How can I put them in a variable, print them on the
screen?

Cheers,
Mc Fly




---- Message d'origine ----
De : "Armin Wehrfritz" <[email protected]>
À : [email protected]
Objet : Re: [Paraview] Probe location in a script
Date : 02/07/2015 17:07:42 CEST

Here is a little script that shows you how to read and write dataset in
ParaView using a simple for loop.

Hope this helps.

-Armin




On 07/02/2015 05:47 PM, [email protected] wrote:
 > Thanks for the tip. I actually already used tracing in order to find the
 > command:
 > Probelocation.ProbeType.Center = [10.0,20.0,30.0]
 >
 > But the problem is that I don't know how to access to the data (rho, vx,
 > vy...) at that location in the python script
 >
 > And since tracing does not capture "Save data", I don't even know how to
 > write the data in a file
 >
 > Cheers,
 > Mc Fly
 >
 >
 >
 >
 > Date : 02/07/2015 15:55:04 CEST
 >
 > Hi McFly,
 >
 > The Python Tracing facility in ParaView is perfect for this kind of
 > task. It records a trace of your actions in the ParaView GUI to a Python
 > script that you can modify a bit to process a bunch of files. To turn on
 > tracing, choose the Tools -> Start Trace menu item.
 >
 > More info on tracing is available in the ParaView User Guide [1] under
 > section 1.6.2.
 >
 > Best regards,
 > Cory
 >
 > [1] http://www.paraview.org/paraview-guide/
 >
 > On Thu, Jul 2, 2015 at 9:39 AM, <[email protected]
 > <mailto:[email protected]>> wrote:
 >
 > __
 >
 > Hi everybody,
 >
 > I am a new Paraview user. I am trying to extract points from a bunch
 > of vtu files. It is pretty easily done with "probe location". But
 > since I have a lot of files, I would like to automatize the process
 > (with a macro or a python script).
 >
 > Could someone maybe show me how it's done?
 >
 > My best guess is that I should have the following in a python script:
 > Probelocation.ProbeType.Center = [10.0,20.0,30.0]
 > assuming I want to probe at x=10, y=20, z=30. But then, I don't
 > really know how to retrieve the variables values at that location.
 >
 > Thanks a lot,
 > Mc Fly
 >
 > _______________________________________________
 > 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
 >
 > Search the list archives at: http://markmail.org/search/?q=ParaView
 >
 > Follow this link to subscribe/unsubscribe:
 > http://public.kitware.com/mailman/listinfo/paraview
 >
 >
 >
 >
 > --
 > Cory Quammen
 > R&D Engineer
 > Kitware, Inc.
 >
 >
 > _______________________________________________
 > 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
 >

_______________________________________________
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



_______________________________________________
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

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# Generate some dummy dataset and write them to files
for i in range(10):
    data = Wavelet()
    data.WholeExtent = [-10, 10, -10, 10, -10, 10]
    data.Maximum = (31**(i+1))-1
    data.Center = [i, i, i]
    SaveData('./wavelet_%01i.xmf' % (i), proxy=data)

    # Clean-up
    Delete(data)
    del data


# Read the dataset from the files and probe them
probeData = [0]*10
for i in range(10):
    reader = XDMFReader(FileNames=['./wavelet_%01i.xmf' % (i)])
    reader.PointArrayStatus = ['RTData']

    # create a new 'Probe Location'
    probeFilter = ProbeLocation(Input=reader, ProbeType='Fixed Radius Point Source')

    # init the 'Fixed Radius Point Source' selected for 'ProbeType'
    probeFilter.ProbeType.Center = [i, i, i]
    probeFilter.ProbeType.NumberOfPoints = 1
    probeFilter.ProbeType.Radius = 0.0
    probeFilter.UpdatePipeline()

    data = servermanager.Fetch(probeFilter)
    probeData[i] = data.GetPointData().GetScalars().GetTuple(0)
print probeData

_______________________________________________
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

Reply via email to