Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix in mlab for strided views of np.arrays [backport to 1.4.x] #3467

Merged
merged 1 commit into from Sep 6, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions lib/matplotlib/mlab.py
Expand Up @@ -584,10 +584,10 @@ def stride_windows(x, n, noverlap=None, axis=0):
step = n - noverlap
if axis == 0:
shape = (n, (x.shape[-1]-noverlap)//step)
strides = (x.itemsize, step*x.itemsize)
strides = (x.strides[0], step*x.strides[0])
else:
shape = ((x.shape[-1]-noverlap)//step, n)
strides = (step*x.itemsize, x.itemsize)
strides = (step*x.strides[0], x.strides[0])
return np.lib.stride_tricks.as_strided(x, shape=shape, strides=strides)


Expand Down Expand Up @@ -633,10 +633,10 @@ def stride_repeat(x, n, axis=0):

if axis == 0:
shape = (n, x.size)
strides = (0, x.itemsize)
strides = (0, x.strides[0])
else:
shape = (x.size, n)
strides = (x.itemsize, 0)
strides = (x.strides[0], 0)

return np.lib.stride_tricks.as_strided(x, shape=shape, strides=strides)

Expand Down