[Paraview] scan all point data in a 'for' loop

David E DeMarle dave.demarle at kitware.com
Mon Apr 18 17:58:46 EDT 2011


Please keep the discussion on the mailing list so everyone can benefit
from and/or critique the questions and responses.

I suggest creating the multiple curves by recording a macro that
instantiates the plot and python programmable filter pair, then edit
the macro to make it repeat that N times.

At the end use a merge or append filter to join the individual results
into one table.

David E DeMarle
Kitware, Inc.
R&D Engineer
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-371-3971 x109



On Mon, Apr 18, 2011 at 5:48 PM, Stéphane Backaert
<stephanebackaert at gmail.com> wrote:
> Thank you for your answer!
>
> I saw this web page before ("always do a lot of search before asking!"), but my idea is a little bit tricky:
> I would like to create, by a python script, a serie of PlotOnIntersectionCurve spheres, each with a different radius (from 0:0.1:1 for example). So that, I get a sort of cylindrical data from my slice.
> After that, I would like to make a average along each circle (= each PlotOnIntersectionCurve) and put this scalar in a table (format?): my slice become a data array (dimension=number of different radii). At the end, I will put this 1D array in a csv file...
> That's why I prefere to use script instead of programmable filter, it is too "local"!
> Obviously, any suggest is welcome!!
>
> Indeed, by fetching my data before, that's work:
> plot = GetActiveSource()
> plot_f = servermanager.Fetch(plot)
> a= plot_f.GetPointData().GetArray(0).GetTuple3(2)
>>>> a
> (-0.00043179647764191031, -0.00069251807872205973, 10.001429557800293)
> :-)
>
> Best,
> Stephane
> Le 18 avr. 2011 à 22:57, David E DeMarle a écrit :
>
>> You should use a python programmable filter, not the python shell.
>>
>> The python shell is in the client, and typically has no acess to the
>> data on the server, the python filter runs on the server. If you must
>> use the shell, use servermanager.Fetch to bring the actual data to the
>> client and then use py wrapped VTK to inspect it.
>>
>> See http://paraview.org/Wiki/Python_Programmable_Filter for examples.
>>
>> David E DeMarle
>> Kitware, Inc.
>> R&D Engineer
>> 28 Corporate Drive
>> Clifton Park, NY 12065-8662
>> Phone: 518-371-3971 x109
>>
>>
>>
>> On Mon, Apr 18, 2011 at 4:50 PM, Stéphane Backaert
>> <stephanebackaert at gmail.com> wrote:
>>> Hello,
>>>
>>> I made a PlotOnIntersectionCurve on one of my slices: I get in a spreadsheet view a list of points that belong to this intersection.
>>>
>>> I would like to make a 'for' loop on each point (to make an average of components of the vectors associated to each point actually) in a python script...
>>> Here what I did:
>>>
>>> plot = GetActiveSource() (after choose my PlotOnIntersectionCurve source in the Pipeline Browser)
>>> datainfo = plot.GetPointDataInformation()
>>> a1 = datainfo.GetArray(1)
>>>
>>> what command should I use after (GetTuple3 don't work on a1...)
>>>
>>> Thank you!!
>>> _______________________________________________
>>> 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
>>>
>
>


More information about the ParaView mailing list