Last active
March 26, 2016 00:21
-
-
Save stephtdouglas/0cf6e5c12e4d37f59cfb to your computer and use it in GitHub Desktop.
strided array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Created by Brett Morris @bmorris3 | |
# Saving for future use | |
def strided_array(a, window_width): | |
as_strided = np.lib.stride_tricks.as_strided | |
#window_width = 4 | |
new_shape = (len(a) - window_width + 1, window_width) | |
b = as_strided(a, new_shape, (a.strides[0], a.strides[0])) | |
return b | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment