Plot streamlines from dat file

20 views
Skip to first unread message

Дмитрий Долгов

unread,
Sep 30, 2012, 12:18:37 PM9/30/12
to scit...@googlegroups.com
How can i plot streamlines from data file (not *.mat file)? I have tried plot some like this:

#   x            y               z             u             v             w           p
0.066459 0.093541 -0.099303 0.000000 0.000000 0.000000 0.000000
0.071808 0.093541 -0.099303 0.000000 0.000000 0.000000 0.000000
0.079205 0.093541 -0.099303 0.000000 0.000000 0.000000 0.000000
...................................................................................................

I have used this code:

from scitools.easyviz import *
from time import sleep
import scitools.filetable as ft

s = open('tmp.dat', 'r')
x, y, z, u, v, w, p = ft.read_columns(s)
s.close()

setp(show=False)
sx,sy,sz = ndgrid([80]*4,seq(20,50,10),seq(0,15,5),sparse=False)
sl = streamline(x,y,z,u,v,w,sx,sy,sz)
sl.setp(linecolor='r')
view(3)
axis([60,140,10,60,-5,20])
setp(show=True)
show()

and i have got error:

Traceback (most recent call last):
  File "streamline_demo1.py", line 21, in <module>
    show()
  File "/usr/lib64/python2.7/site-packages/scitools/easyviz/common.py", line 4402, in show
    self._replot()
  File "/usr/lib64/python2.7/site-packages/scitools/easyviz/vtk_.py", line 1177, in _replot
    self._create_vtk_data()
  File "/usr/lib64/python2.7/site-packages/scitools/easyviz/vtk_.py", line 1031, in _create_vtk_data
    sgrid = self._get_2d_structured_grid(item, vectors=True)
  File "/usr/lib64/python2.7/site-packages/scitools/easyviz/vtk_.py", line 540, in _get_2d_structured_grid
    sgrid.SetDimensions(item.getp('dims'))
TypeError: argument 1: expected a sequence of 3 values, got 1 values

Can anybody help me?) 
 

Johannes Ring

unread,
Oct 3, 2012, 5:30:11 AM10/3/12
to scit...@googlegroups.com
Hi,

When plotting streamlines in 3D, your u, v and w arrays needs to be 3D as well.

Johannes
> --
> You received this message because you are subscribed to the Google Groups
> "scitools" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/scitools/-/I1wX5oBHoNIJ.
> To post to this group, send email to scit...@googlegroups.com.
> To unsubscribe from this group, send email to
> scitools+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/scitools?hl=en.
Reply all
Reply to author
Forward
0 new messages