Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7b88fcf

Browse filesBrowse files
committed
BUG: Fixes a bug in mlab functions which are incorrectly using itemsize property (only valid if the array is a view of a 1D array in memory) instead of the actual strides property
1 parent 30891be commit 7b88fcf
Copy full SHA for 7b88fcf

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed

‎lib/matplotlib/mlab.py

Copy file name to clipboardExpand all lines: lib/matplotlib/mlab.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -584,10 +584,10 @@ def stride_windows(x, n, noverlap=None, axis=0):
584584
step = n - noverlap
585585
if axis == 0:
586586
shape = (n, (x.shape[-1]-noverlap)//step)
587-
strides = (x.itemsize, step*x.itemsize)
587+
strides = (x.strides[0], step*x.strides[0])
588588
else:
589589
shape = ((x.shape[-1]-noverlap)//step, n)
590-
strides = (step*x.itemsize, x.itemsize)
590+
strides = (step*x.strides[0], x.strides[0])
591591
return np.lib.stride_tricks.as_strided(x, shape=shape, strides=strides)
592592

593593

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

634634
if axis == 0:
635635
shape = (n, x.size)
636-
strides = (0, x.itemsize)
636+
strides = (0, x.strides[0])
637637
else:
638638
shape = (x.size, n)
639-
strides = (x.itemsize, 0)
639+
strides = (x.strides[0], 0)
640640

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

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.