|
From: Pierre GM <pgm...@gm...> - 2007-04-11 08:27:04
|
On Wednesday 11 April 2007 03:28:09 elekis wrote:
Hi,
Just some quick comments:
1. learn list comprehensions, they're far faster than regular loops.
data = [(i,j,int(numpy.random.random()*10))
for i in range(XI) for j in range(JI)]
2. if you don't really need the triplets, but just the random part, just use:
Z = (numpy.random.random(XI*YI)*10).astype(int).reshape(Xl,Yl)
3. It's more efficient to use numpy.empty than numpy.zeros to initialize an
array you're going to fill afterwards.
4. You may have found a bug in plot_wireframe, actually. The code doesn't look
quite right. My understanding is that the 3d part is not really supported,
either...
Hope it helps.
|