Skip to content

Instantly share code, notes, and snippets.

View teoliphant's full-sized avatar
💭
I may be slow to respond.

Travis E. Oliphant teoliphant

💭
I may be slow to respond.
View GitHub Profile
@teoliphant
teoliphant / rolling.py
Last active October 23, 2019 19:54
Create a function to make a "sliding_window" output array from an input array and a rolling_window size.
import numpy as np
def array_for_sliding_window(x, wshape):
"""Build a sliding-window representation of x.
The last dimension(s) of the output array contain the data of
the specific window. The number of dimensions in the output is
twice that of the input.
Parameters