Re: [Paraview] Plain text data with white space delimiters; Use raw array as axis/variables

2018-01-26 Thread Liang Wang
Thanks, Andy. That works! Now the problem is how I can use the 1d arrays to
construct 3d plots.

Now I have many 1d arrays: x, y, z, variable1, variable2, ..., etc.

Unfortunately, they are AMR data, not regularly indexed, (in fact they are
TecPlot ascii data, but ParaView could not read them correctly for some
reason, this is another issue, though).

I would like to make 3d plots, 2d slice, or at least 1d cuts. I am OK to
use Python interface but might need some instruction how to create 3d data
from these flattened 1d arrays.
I guess there are some tutorials to convert numpy array to vtk arrays, I
might start from that. Then I need to convert the row data ParaView GUI
reads in to numpy array then to vtk array?

I have attached the data if anyone can kindly try it. At least it is a
valid TecPlot file which other people tested using TecPlot.

On Fri, Jan 26, 2018 at 9:49 AM, Andy Bauer  wrote:

> Hi,
>
> ParaView should be able to handle this. Try giving the filename a .csv
> extension and then add a space for the Field Delimiter Characters options.
> Optionally, you may also want to enable the Merge Consecutive Delimiters
> option.
>
> On Fri, Jan 26, 2018 at 8:33 AM, Liang Wang  wrote:
>
>> Hi All,
>>
>> 1) Does the ParaView GUI read a plain text file with white space as
>> delimiters?
>> 2) Can ParaView use a giving 1d array as an axis?
>>
>> My problem:
>>
>> I have a plain text data file, each column is a different variable, and
>> delimiters are white space, e.g.,
>>
>> x y z variable1 variable 2
>>
>> Is there a way to read such a file and use x, y, z as coordinates of the
>> resulting variables?
>>
>> For example, in TecPlot you can read in such a file and set axises to use
>> the x, y, z (or any other named variables).
>>
>> For 1), does ParaView have an extra setting to set common options for
>> plain text data like delimiter, header, skiprow, etc.?
>>
>> For 2), it appears to me that in ParaView all field/cell data is
>> associated with a predefined axis, so it is not that straightforward to use
>> a raw array as axis or as variable, though this is possible in the
>> Python interface. Is this correct.
>>
>> Best,
>>
>> Liang
>>
>>
>>
>> ___
>> 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:
>> https://paraview.org/mailman/listinfo/paraview
>>
>>
>


test_tecplot.dat
Description: Binary data
___
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:
https://paraview.org/mailman/listinfo/paraview


[Paraview] Plain text data with white space delimiters; Use raw array as axis/variables

2018-01-26 Thread Liang Wang
Hi All,

1) Does the ParaView GUI read a plain text file with white space as
delimiters?
2) Can ParaView use a giving 1d array as an axis?

My problem:

I have a plain text data file, each column is a different variable, and
delimiters are white space, e.g.,

x y z variable1 variable 2

Is there a way to read such a file and use x, y, z as coordinates of the
resulting variables?

For example, in TecPlot you can read in such a file and set axises to use
the x, y, z (or any other named variables).

For 1), does ParaView have an extra setting to set common options for plain
text data like delimiter, header, skiprow, etc.?

For 2), it appears to me that in ParaView all field/cell data is associated
with a predefined axis, so it is not that straightforward to use a raw
array as axis or as variable, though this is possible in the Python
interface. Is this correct.

Best,

Liang
___
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:
https://paraview.org/mailman/listinfo/paraview


Re: [Paraview] Python: How to change the location and size of orientation axes?

2017-04-08 Thread Liang Wang
It turned out using the vtkPVAxesWidget might be more appropriate because
it is attached to a fixed renderer thus does not rotate when you rotate
your main renderer. However, I still do not know how to set the location
and size of the resulting orientation axes more accurately. Maybe it is
because the resulting renderer always zoom to match the dimension of the
resulting orientation axes?


from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()

renderView1 = GetActiveViewOrCreate('RenderView')

sphere1 = Sphere()
sphere1.Radius = 1.0
sphere1Display = Show(sphere1, renderView1)
sphere1Display.SetRepresentationType('Outline')

renderer = renderView1.GetRenderer()

renderView1.OrientationAxesVisibility = 0

import vtk
a = vtk.vtkPVAxesWidget()
a.SetParentRenderer(renderer)
a.SetViewport(0, 0, 0.4, 0.4) # default is (0, 0, 0.25, 0.25)

r = a.GetRenderer()

aa = a.GetAxesActor() # vtkPVAxesActor

#aa.SetOrigin(-5.0, -5.0, -5.0) # not working
#aa.SetPosition(-5.0, -5.0, -5.0) # not working
#aa.SetScale(2.0, 2.0, 2.0) # not working
#aa.SetShaftTypeToCylinder()
#aa.SetCylinderRadius(aa.GetCylinderRadius()*2.0)
#aa.SetConeRadius(aa.GetConeRadius()*2.0)

Interact()


On Sat, Apr 8, 2017 at 7:46 PM, Liang Wang  wrote:

> I figured out a way by using the vtkAxesActor class directly.
>
> An example script:
>
> from paraview.simple import *
> paraview.simple._DisableFirstRenderCameraReset()
>
> renderView1 = GetActiveViewOrCreate('RenderView')
>
> sphere1 = Sphere()
> sphere1.Radius = 1.0
> sphere1Display = Show(sphere1, renderView1)
> sphere1Display.SetRepresentationType('Outline')
>
> import vtk
> renderer = renderView1.GetRenderer()
> axes = vtk.vtkAxesActor()
>
> #axes.SetAxisLabels(0) # 0/1 to turn off/on axis labels
>
> transform = vtk.vtkTransform()
> transform.Translate(-1.0, -1.0, -1.0)
> transform.Scale(0.75, 0.75, 0.75)
> axes.SetUserTransform(transform)
>
> tprop = vtk.vtkTextProperty()
> #tprop.SetFontSize(6) # seems to be overriden by vtkCaptionActor2D
> tprop.SetBold(1)
> tprop.SetItalic(0)
> tprop.SetColor(1.0, 1.0, 1.0)
> tprop.SetOpacity(1.0)
> tprop.SetFontFamilyToTimes()
>
> for label in [
> axes.GetXAxisCaptionActor2D(),
> axes.GetYAxisCaptionActor2D(),
> axes.GetZAxisCaptionActor2D(),
> ]:
> # set Positoin2
> label.SetWidth(label.GetWidth() * 0.5)
> label.SetHeight(label.GetHeight() * 0.5)
> label.SetCaptionTextProperty(tprop)
>
> renderer.AddActor(axes)
>
> Interact()
>
>
> On Sat, Apr 8, 2017 at 4:08 PM, Liang Wang  wrote:
>
>> From http://public.kitware.com/pipermail/paraview/2010-July/018081.html
>> it was not possible back then to change the size of orientation axes.
>>
>> Is it possible now, hopefully through Python, too?
>>
>
>
___
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


Re: [Paraview] Python: How to change the location and size of orientation axes?

2017-04-08 Thread Liang Wang
I figured out a way by using the vtkAxesActor class directly.

An example script:

from paraview.simple import *
paraview.simple._DisableFirstRenderCameraReset()

renderView1 = GetActiveViewOrCreate('RenderView')

sphere1 = Sphere()
sphere1.Radius = 1.0
sphere1Display = Show(sphere1, renderView1)
sphere1Display.SetRepresentationType('Outline')

import vtk
renderer = renderView1.GetRenderer()
axes = vtk.vtkAxesActor()

#axes.SetAxisLabels(0) # 0/1 to turn off/on axis labels

transform = vtk.vtkTransform()
transform.Translate(-1.0, -1.0, -1.0)
transform.Scale(0.75, 0.75, 0.75)
axes.SetUserTransform(transform)

tprop = vtk.vtkTextProperty()
#tprop.SetFontSize(6) # seems to be overriden by vtkCaptionActor2D
tprop.SetBold(1)
tprop.SetItalic(0)
tprop.SetColor(1.0, 1.0, 1.0)
tprop.SetOpacity(1.0)
tprop.SetFontFamilyToTimes()

for label in [
axes.GetXAxisCaptionActor2D(),
axes.GetYAxisCaptionActor2D(),
axes.GetZAxisCaptionActor2D(),
]:
# set Positoin2
label.SetWidth(label.GetWidth() * 0.5)
label.SetHeight(label.GetHeight() * 0.5)
label.SetCaptionTextProperty(tprop)

renderer.AddActor(axes)

Interact()


On Sat, Apr 8, 2017 at 4:08 PM, Liang Wang  wrote:

> From http://public.kitware.com/pipermail/paraview/2010-July/018081.html
> it was not possible back then to change the size of orientation axes.
>
> Is it possible now, hopefully through Python, too?
>
___
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


[Paraview] Python: How to change the location and size of orientation axes?

2017-04-08 Thread Liang Wang
>From http://public.kitware.com/pipermail/paraview/2010-July/018081.html
it was not possible back then to change the size of orientation axes.

Is it possible now, hopefully through Python, too?
___
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


Re: [Paraview] Attach arrows onto streamlines/stream tubes more smoothly

2017-03-15 Thread Liang Wang
Indeed, using Cone glyph gives much better results, and tweaking by
"Stride" is very helpful!

Thank you, Andy and Utkarsh.

On Wed, Mar 15, 2017 at 8:14 PM, Utkarsh Ayachit <
utkarsh.ayac...@kitware.com> wrote:

> To control spacing of the glyphs, on the Glyph's properties panel you
> can change the Glyph Mode to "Every Nth Point" and then tweak the
> "Stride".
>
> On Wed, Mar 15, 2017 at 8:12 PM, Utkarsh Ayachit
>  wrote:
> > Try changing the "Glyph Type" to Cone. See attached image.
> >
> > On Wed, Mar 15, 2017 at 6:16 PM, Andy Bauer 
> wrote:
> >> I think it is because you have set the Shaft radius to 0. The start of
> the
> >> arrow doesn't appear because of this and I'm suspecting that the start
> of
> >> the arrow is centered along the streamline. Maybe try using using
> either a
> >> non-zero value for the Shaft radius that is bigger than the Tube radius
> or
> >> use the Cone glyph type instead.
> >>
> >> On Wed, Mar 15, 2017 at 5:59 PM, Liang Wang 
> wrote:
> >>>
> >>> Hi Andy,
> >>>
> >>> The results are similar if I apply glyph on streamlines directly (see
> the
> >>> attached image).
> >>>
> >>> I guess the difficulty part is that arrow heads are not easily
> centered on
> >>> lines/tubes?
> >>>
> >>> On Wed, Mar 15, 2017 at 5:50 PM, Andy Bauer 
> >>> wrote:
> >>>>
> >>>> Hi,
> >>>>
> >>>> How does it look if you Glyph the streamlines themselves instead of
> the
> >>>> tubes?
> >>>>
> >>>> On Wed, Mar 15, 2017 at 5:40 PM, Liang Wang 
> wrote:
> >>>>>
> >>>>> By using the arrow glyph filter on the lines/tubes, the arrows are
> often
> >>>>> slightly dislocated (and thus slightly misaligned) from the tubes
> themselves
> >>>>> (see the attached image).
> >>>>>
> >>>>> In comparison, I am trying to get images like
> >>>>> http://www.tecplot.com/wp-content/uploads/2016/01/fstream.jpg or
> >>>>> https://i.stack.imgur.com/z8nkm.png
> >>>>>
> >>>>> Logically, the arrows could have been an attribute of the
> >>>>> streamlines/stream tubes?
> >>>>>
> >>>>> ___
> >>>>> 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


Re: [Paraview] StreamTracer: Combined ReasonForTermination or select individual polylines?

2017-03-14 Thread Liang Wang
A follow-up question: How to perform the `Find Data` by `criteria` in
Python? I tried to record a macro but only got

extractSelection1 = ExtractSelection(Input=tube1,
Selection=None)

On Tue, Mar 14, 2017 at 3:47 PM, Liang Wang  wrote:

> Thank you, Andy.
>
>
> I):
>
> I'm using 5.3 and your example is what I would get. But what I want is a
> way to tell if the two streamlines from the same seed point are terminated
> for different reasons. It might be more clear from the image I attached. I
> would like to tell
>
> 1) closed field lines that have both ends terminated on the sphere surface
> (the red tubes)
> 2) semi-open field lines that have on the ends terminated on the sphere
> surface, the other goes out-of-domain (the red and blue tubes)
> 3) open field lines that have both ends out-of-bound (not shown in the
> image, would be blue tubes)
>
> (Or, ideal, I would be happier to be able to tell if the open end of the
> semi-open field lines goes out of the southern or northern bound)
>
> Indeed, I saw people doing this in Mayavi-based python (see
> https://github.com/KristoforMaynard/Viscid/blob/
> dev/viscid/cython/streamline.pyx and http://kristoformaynard.
> github.io/Viscid/docs/master/examples/mayavi.html). One obstacle I can
> see is that ParaView (or vtk?) probably treats the two streamlines from the
> same seed point independently, thus it won't be easy to tag them together.
>
> II):
>
> I realize that I am demanding too much. I tried your way of `Find Data`,
> and now I am able to manually choose individual streamlines, which is
> already helpful.
>
>
>
> On Tue, Mar 14, 2017 at 3:17 PM, Andy Bauer 
> wrote:
>
>> Hi,
>>
>> What version of ParaView are you using?
>>
>> From my testing it looks like each direction for the stream tracer seeds
>> has a separate reason for termination in PV 5.3 -- see the attached image.
>> The domain is a box with length 20 on each side, the velocity is [1, 0, 0],
>> the seeds are a line source going from min to max of the bounding box
>> ([-10, -10, -10] to [10,10,10]).  The red is for when the maximum
>> streamline length has exceeded my specified max length of 5 and the blue is
>> for when the streamline exited the domain.
>>
>> Is there a case where the same reason for termination value is being used
>> for multiple termination criteria?
>>
>> You can use the SeedIds cell data array in the Threshold filter or use
>> the Edit->Find Data option to select a given streamline from the seed id.
>>
>> Cheers,
>> Andy
>>
>>
>>
>> On Tue, Mar 14, 2017 at 2:24 PM, Liang Wang  wrote:
>>
>>> If the IntegrationDirection is set to BOTH, the two segments of the
>>> streamlines from the seed might terminate for different reasons. For
>>> example, one end might end due to STAGNATION, the other due
>>> to OUT_OF_DOMAIN. When coloring by ReasonForTermination, then the two
>>> segments are colored differently.
>>>
>>> My question is: Can a user create more cases of ReasonForTermination so
>>> that we can tell examples like above? Or, how can I select individual
>>> streamlines by its SeedIds (I tried IdsSelection, but that appears to work
>>> for cell/point data only, not for polydata?)
>>>
>>> My current solution is to use threshold filter to select lines in the
>>> different regions and apply different solid colors. But it would be nice if
>>> I can handle a few different cases more directly, even if that involves
>>> some coding in C++ or Python.
>>>
>>> Thanks.
>>>
>>> ___
>>> 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


[Paraview] StreamTracer: Combined ReasonForTermination or select individual polylines?

2017-03-14 Thread Liang Wang
If the IntegrationDirection is set to BOTH, the two segments of the
streamlines from the seed might terminate for different reasons. For
example, one end might end due to STAGNATION, the other due
to OUT_OF_DOMAIN. When coloring by ReasonForTermination, then the two
segments are colored differently.

My question is: Can a user create more cases of ReasonForTermination so
that we can tell examples like above? Or, how can I select individual
streamlines by its SeedIds (I tried IdsSelection, but that appears to work
for cell/point data only, not for polydata?)

My current solution is to use threshold filter to select lines in the
different regions and apply different solid colors. But it would be nice if
I can handle a few different cases more directly, even if that involves
some coding in C++ or Python.

Thanks.
___
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


[Paraview] Python API to set color palette?

2017-03-11 Thread Liang Wang
I don't find a dedicated Python function to set color palette.
It does not appear to be an option to the simple.SaveScreenshot function
either.

Or, can I directly set each color available in the Edit -> Settings ->
Color Palette?

Best,
Liang
___
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


[Paraview] xdmf: orders of Origin DXDYDZ arrays in Origin_DXDYDZ

2015-05-19 Thread Liang Wang
In the first place, I do not understand the difference between 3DRectMesh
and 3DCoRectMesh.

I picked the following coordinate for testing:

Nz,Ny,Nx = [80, 90, 100]
z0,y0,x0 = [-3.,-2.,-1.]
lz,ly,lx = [Nz*3,Ny*2,Nx]
dz,dy,dx = [lz/(Nz-1), ly/(Ny-1), lx/(Nx-1)]

I found I have to use the following lines in the xdmf to get the correct
grid to be shown in Paraview for 3DRectMesh and 3DCoRectMesh, respectively:


  
  
 -1 -2 -3
 1 2 3
  


  
  
 -3 -2 -1
 3 2 1
  

Note that, the Dimensions for Topology in both cases are in zyx order,
while the Origin/DxDyDz arrays have different orders in the two cases:

3DRectMesh requires Origin=[x0,y0,z0], DX=[dx,dy,dz], i.e., xyz order
3DCoRectMesh requires Origin=[z0,y0,x0], DX=[dz,dy,dx], i.e., zyx order.

Am I writing the correct xdmf codes? How would you specify these data?
Thanks.
___
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