# Streamtracer with CSV data

**URL:** https://discourse.vtk.org/t/streamtracer-with-csv-data/5720
**Category:** Support
**Created:** [May 6, 2021, 8:00pm UTC](https://discourse.vtk.org/t/streamtracer-with-csv-data/5720 "2021-05-06T20:00:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Ondrej\_Tkadlec](https://discourse.vtk.org/user_avatar/discourse.vtk.org/ondrej_tkadlec/32/3358_2.png) [@Ondrej\_Tkadlec](https://discourse.vtk.org/u/Ondrej_Tkadlec)
#### Post date: [May 6, 2021, 8:00pm UTC](https://discourse.vtk.org/t/streamtracer-with-csv-data/5720/1 "2021-05-06T20:00:31Z")

</div>

Hi,  
I’m trying to make 3D streamtracer with data from CSV file. It has 3 columns x,y,z for points in 3D space and 3 columns vx,vy,vz for the 3D vector that belongs to that point. I’m able to plot glyph plot but I’m unable to do streamtracer. The code so far is:

```
df = pd.read_csv("file.csv")
x_size = df.x.nunique()
y_size = df.y.nunique()
z_size = df.z.nunique()

no_datapts = x_size*y_size*z_size

points = vtk.vtkPoints()
vel = vtk.vtkFloatArray()
vel.SetNumberOfComponents(3)
vel.SetNumberOfTuples(no_datapts)

index = 0
for row in df.iterrows():
    points.InsertPoint(index, row[1]["x"], row[1]["y"], row[1]["z"])
    vel.SetTuple3(index, row[1]["vx"], row[1]["vy"], row[1]["vz"])
    index += 1

grid = vtk.vtkStructuredGrid()
grid.SetPoints(points)
grid.GetPointData().SetVectors(vel)

```

Then I create lineseed and finally a create streamtracer ( and I set integrating method etc.)

```
lineSeed = vtk.vtkLineSource()
lineSeed.SetPoint1(0,0,0)
lineSeed.SetPoint2(0,1,0)
lineSeed.SetResolution(10)

streamTracer = vtk.vtkStreamTracer()
streamTracer.SetInputData(grid)
streamTracer.SetSourceConnection(lineSeed.GetOutputPort())

```

It doesnt create any streamlines (of course I connect the streamtracer to ScalarSurface or TubeFilter). Am I passing wrong data format to streamtracer or what is my mistake?  
Thanks, Ondrej
