Python 2.7 compatibility bug.

I was overwriting x,y variables with the list comprehension, causing
the lists in x,y to be replaced with a single value.
This commit is contained in:
Roger Labbe 2014-12-31 13:22:16 -08:00
parent 401a0004e1
commit bb0f9eb5ef

View File

@ -224,8 +224,8 @@ def plot_3d_sampled_covariance(mean, cov):
ys = np.arange(miny, maxy, (maxy-miny)/40.)
xv, yv = np.meshgrid (xs, ys)
zs = np.array([100.* stats.multivariate_gaussian(np.array([x,y]),mean,cov) \
for x,y in zip(np.ravel(xv), np.ravel(yv))])
zs = np.array([100.* stats.multivariate_gaussian(np.array([xx,yy]),mean,cov) \
for xx,yy in zip(np.ravel(xv), np.ravel(yv))])
zv = zs.reshape(xv.shape)
ax = plt.figure().add_subplot(111, projection='3d')
@ -241,5 +241,7 @@ def plot_3d_sampled_covariance(mean, cov):
if __name__ == "__main__":
#show_position_chart()
#plot_3d_covariance((2,7), np.array([[8.,0],[0,4.]]))
plot_3d_sampled_covariance((2,7), np.array([[8.,0],[0,4.]]))
plot_3d_sampled_covariance([2,7], [[8.,0],[0,4.]])
#show_residual_chart()