Created
June 15, 2018 15:41
-
-
Save asherp/2fb5cd71c91609d3b0821dd92fd6a036 to your computer and use it in GitHub Desktop.
windowed time average
This file contains 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
def windowed_time_average(data, window = 3): | |
window = 3 | |
results = [] | |
for i in range(len(data)): | |
if i < window: | |
results.append(np.sum(data[:i+1])/window) | |
else: | |
results.append(np.sum(data[i-window+1:i+1])/window) | |
return np.array(results) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment