Hi Andrea 2008/5/22 Andrea Gavana <[EMAIL PROTECTED]>: > I am building some 3D grids for visualization starting from a much > bigger grid. I build these grids by satisfying certain conditions on > x, y, z coordinates of their cells: up to now I was using VTK to > perform this operation, but VTK is slow as a turtle, so I thought to > use numpy to get the cells I am interested in. > Basically, for every cell I have the coordinates of its center point > (centroids), named xCent, yCent and zCent. These values are stored in > numpy arrays (i.e., if I have 10,000 cells, I have 3 vectors xCent, > yCent and zCent with 10,000 values in them). What I'd like to do is:
You clearly have a large dataset, otherwise speed wouldn't have been a concern to you. You can do your operation in one pass over the data, and I'd suggest you try doing that with Cython or Ctypes. If you need an example on how to access data using those methods, let me know. Of course, it *can* be done using NumPy (maybe not in one pass), but thinking in terms of for-loops is sometimes easier, and immediately takes you to a highly optimised execution time. Cheers Stéfan _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion