[Paraview] Plot over Line source

Cory Quammen cory.quammen at kitware.com
Thu Sep 10 09:34:47 EDT 2015


Richard,

I'm glad you got it working.

cory

On Wed, Sep 9, 2015 at 1:45 PM, no name <keinepostnurmuell at gmail.com> wrote:

> I just managed to do this myself and I had to do it the same way again,
> redo everything by copy and paste, there seems to be a bug in here too, but
> I am not capable of reproducing it :( I just wanted to let you know.
>
> Thanks for your Help!
>
> Richard
>
> On 9 September 2015 at 18:20, no name <keinepostnurmuell at gmail.com> wrote:
>
>> this is straight what I was looking for! Thank you SO MUCH for pointing
>> out this bug to me. This drove me mad :(
>>
>> One last question: Line Chart != PlotOverLine, so its hard for me to plot
>> x and y axis, or like in my script mx over hx, as nothing happens when I
>> choose to use one of my coordinates as "X-Axis Parameter" and just let the
>> other one being drawn.
>>
>> Can't I make a real Plot over Line?
>>
>> Thanks again for your time!
>> Richard
>>
>> On 9 September 2015 at 15:12, Cory Quammen <cory.quammen at kitware.com>
>> wrote:
>>
>>> Hi Richard,
>>>
>>> If you don't mind, let's keep the discussion on the list so that others
>>> may benefit from the discussion.
>>>
>>> Outputting a vtkTable is the right thing to do. What I suspect is
>>> happening with the first error message is that if you execute a
>>> programmable source with the output set to one type of data set (e.g.,
>>> vtkPolyData), there is a bug that doesn't let you switch to a different
>>> type of output. As a workaround, you can create a new Programmable Source,
>>> copy and paste your code from the original Programmable Source into the new
>>> one, and set the output type to vtkTableData *before* you click Apply.
>>>
>>> To view line plots of your data, you'll need to create a Line Chart View
>>> by splitting the 3D Render View. To do this, look for the icon on the top
>>> right of the 3D Render View that has two vertically-oriented rectangles
>>> side by side (tool tip "Split Horizontal"). In the list of views that comes
>>> up, click on "Line Chart View". If your line plots are not visible right
>>> away, you will need to make them visible by clicking on the eye icon next
>>> to the Programmable Source. Voila, you should have a line plot.
>>>
>>> Hope that helps,
>>> Cory
>>>
>>> On Wed, Sep 9, 2015 at 5:23 AM, no name <keinepostnurmuell at gmail.com>
>>> wrote:
>>>
>>>> Hey Cory
>>>>
>>>> Thanks for the hint! I did some coding and I got stuck at the vtkTable
>>>> as Output DataSet Type.
>>>>
>>>>
>>>> I used -> Programmable Source and then vtkTable which gives me the
>>>> following error code:
>>>>
>>>> ERROR: In
>>>> C:\DBD\pvs-x64\paraview\src\paraview\VTK\Common\ExecutionModel\vtkDemandDrivenPipeline.cxx,
>>>> line 810
>>>>
>>>> vtkPVDataRepresentationPipeline (000000009F2FC720): Input for
>>>> connection index 0 on input port index 0 for algorithm
>>>> vtkGeometryRepresentationWithFaces(00000000946A85F0) is of type vtkTable,
>>>> but a vtkDataSet is required.
>>>>
>>>>
>>>>
>>>> ERROR: In
>>>> C:\DBD\pvs-x64\paraview\src\paraview\VTK\Common\ExecutionModel\vtkDemandDrivenPipeline.cxx,
>>>> line 810
>>>>
>>>> vtkPVDataRepresentationPipeline (000000009F2FAB00): Input for
>>>> connection index 0 on input port index 0 for algorithm
>>>> vtkGeometryRepresentation(000000004FAC3570) is of type vtkTable, but a
>>>> vtkDataSet is required.
>>>>
>>>> for the code I am using:
>>>>
>>>> import numpy as np
>>>>
>>>>
>>>> switching_log = 'C:\\Users\\raphael\\Desktop\\logs auswertung\\newsims\\flat_Aex_1_E_-11\\flat_12\\switching.log'
>>>>
>>>> class DataFile(object):
>>>>
>>>>     def __init__(self, filename, h_xyz, m_xyz):
>>>>
>>>>         self._filename = filename
>>>>
>>>>         self._h_xyz = h_xyz
>>>>
>>>>         self._m_xyz = m_xyz
>>>>
>>>>                     def read_dat_file(self):
>>>>
>>>>         data = np.genfromtxt(self._filename, delimiter='', \
>>>>
>>>>         usecols=(0, self._h_xyz, self._m_xyz), unpack=True)
>>>>
>>>>         return data
>>>>
>>>>
>>>> log = DataFile(switching_log, 9, 13)
>>>>
>>>> data = log.read_dat_file()
>>>>
>>>>
>>>> A = np.rec.fromarrays(data, dtype= {'names': ['Time', 'Hx', 'Mx'], 'formats':['int','f8', 'f8']})
>>>>
>>>> print A.dtype.names
>>>>
>>>>
>>>> for name in A.dtype.names:
>>>>
>>>>     array = A[name]
>>>>
>>>>     output.RowData.append(array, name)
>>>>
>>>>
>>>> Now I could use the "vtkMultiBlockSet" or "vtkPolyData" as output
>>>> DataSet, but then I get:
>>>>
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>> File "<string>", line 19, in <module>
>>>>
>>>> File "<string>", line 41, in RequestData
>>>>
>>>> File "C:\Program Files (x86)\ParaView
>>>> 4.3.1\lib\paraview-4.3\site-packages\vtk\numpy_interface\dataset_adapter.py",
>>>> line 121, in __getattr__
>>>>
>>>> return getattr(self.VTKObject, name)
>>>>
>>>> AttributeError: RowData
>>>>
>>>>
>>>> Because output.rowdata needs a vtkTable. I found the vtkTable in the
>>>>  Paraview Guide in Chapter 13.2.1 "Reading a CSV" file - which is basically
>>>> my thing, but I dont exactly understand where the difference between the
>>>> example and my situation lies ...
>>>>
>>>>
>>>> Thanks for your help!
>>>>
>>>>
>>>> Richard
>>>>
>>>> On 8 September 2015 at 15:00, Cory Quammen <cory.quammen at kitware.com>
>>>> wrote:
>>>>
>>>>> Hi Richard,
>>>>>
>>>>> You won't be able to set a vtkDataArray subclass as the input to a
>>>>> PlotOverLine filter. Instead, you should read the log files in a
>>>>> Programmable Source, and connect the Programmable Source to the
>>>>> PlotOverLine filter.
>>>>>
>>>>> See Chapter 13 of the ParaView Guide [1].
>>>>>
>>>>> Hope that helps,
>>>>> Cory
>>>>>
>>>>> [1]
>>>>> http://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v4.3&type=data&os=all&downloadFile=TheParaViewGuide-v4.3-CC-Edition.pdf
>>>>>
>>>>>
>>>>> On Tue, Sep 8, 2015 at 3:57 AM, no name <keinepostnurmuell at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hey there
>>>>>>
>>>>>> I have some hundred VTU files and I want to plot some data in a graph
>>>>>> (Plot over Line - POL) next to it. The Problem is, the data from these POLs
>>>>>> is coming from a simple log file, basically conaining only x and y values
>>>>>> (like two np.arrays).
>>>>>>
>>>>>> I can transform the arrays via
>>>>>>
>>>>>> from vtk.util import numpy_support
>>>>>> values = np.array((x,y))
>>>>>> vtk_values = numpy_support.numpy_to_vtk(values, array_type=vtk.VTK_FLOAT)
>>>>>> vtk_values.setName('values_2_show')
>>>>>> vtk_values.setComponentName(1, 'x_value')
>>>>>> vtk_values.setComponentName(2, 'y_value')
>>>>>>
>>>>>> But so far I have no success with how to change the input (source)
>>>>>>
>>>>>> VTUFILE = FindSource('VTUFILE*')
>>>>>> plotOverLine1 = PlotOverLine(Input=VTUFILE, Source='High Resolution Line Source')
>>>>>>
>>>>>> to a simple array.
>>>>>>
>>>>>> Thanks for any help!
>>>>>> Richard
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Cory Quammen
>>>>> R&D Engineer
>>>>> Kitware, Inc.
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Cory Quammen
>>> R&D Engineer
>>> Kitware, Inc.
>>>
>>
>>
>


-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150910/514f92ae/attachment.html>


More information about the ParaView mailing list