Reading vtk generated py pizza

Submitted by SergeiD on Tue, 04/12/2011 - 09:09

Hello.
I want to post process LIGGGHTS results with my python script.
So, I do convert from the dump to vtk by pizza.py and next want to read that vtk in my script in order to add some data to it. But I have a problem with reading. I do:

from vtk import *
rdr=vtkPolyDataReader()
rdr.SetFileName(fileIn)
rdr.Update()
grd=rdr.GetOutput()
pdata=grd.GetPointData()

Problem is pdata have only 2 arrays:

In [22]: pdata.GetNumberOfArrays()
Out[22]: 2
In [23]: pdata.GetArrayName(0)
Out[23]: 'v'
In [24]: pdata.GetArrayName(1)
Out[24]: 'atom_type'

So, no 'radius' and other arrays.
Please, could not explain me why is it?

ps. I did the test on examples/LIGGGHTS/packing case.

pps. In fact, I want to use voro++ to add to the LIGGGHTS results of the Voronoi volumes and perform further processing in ParaView. So, is there a ready-made solution for that?

Thanks!

SergeiD | Fri, 04/15/2011 - 10:51

No, I use gran_pizza_17Aug10.
Subject is not relevant for me now. I solved the problem by using only the dump module. But perhaps is there a bug in the pizza-vtk?

ps. Why is the pizza not a python package? I did it a package by adding __init__.py into /src and rename it to /pizza. So, I can import pizza modules by "from pizza.dump import dump" for example.

ckloss's picture

ckloss | Sun, 04/17/2011 - 15:25

>>ps. Why is the pizza not a python package?
good question. What would be the advantages? if you create an alias for pizza with python - i .../src/pizza.py, you can still write your own script for pizza by starting pizza -f script.

Christoph

SergeiD | Sun, 04/17/2011 - 17:19

For example, if I want to use vtk package (not pizza-vtk), I can do

import vtk
from pizza.dump import dump

In other case I can't use vtk because pizza's path is in front, so instead vtk will imports pizza-vtk.

ckloss's picture

ckloss | Mon, 04/18/2011 - 11:08

If you would find this useful, feel free to change the pizza implementation, and send me the code so that we can release it (with attribution to you)

Christoph