From 503081bf13f0ba14f43ec76c974e867970f242e7 Mon Sep 17 00:00:00 2001 From: Ben Root Date: Thu, 24 Feb 2011 21:56:21 -0600 Subject: [PATCH] Fixed a numpy broadcasting error in simple_3danim.py --- examples/animation/simple_3danim.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/animation/simple_3danim.py b/examples/animation/simple_3danim.py index 7cb69b7c5d89..c1514b33b64a 100644 --- a/examples/animation/simple_3danim.py +++ b/examples/animation/simple_3danim.py @@ -14,13 +14,13 @@ def Gen_RandLine(length, dims=2) : dims is the number of dimensions the line has. """ lineData = np.empty((dims, length)) - lineData[:, 0] = np.random.rand(1, dims) + lineData[:, 0] = np.random.rand(dims) for index in xrange(1, length) : # scaling the random numbers by 0.1 so # movement is small compared to position. # subtraction by 0.5 is to change the range to [-0.5, 0.5] # to allow a line to move backwards. - step = ((np.random.rand(1, dims) - 0.5) * 0.1) + step = ((np.random.rand(dims) - 0.5) * 0.1) lineData[:, index] = lineData[:, index-1] + step return lineData