Last active
March 21, 2020 16:48
-
-
Save syaffers/0e483c4a8f78d34f596ece683ba06800 to your computer and use it in GitHub Desktop.
Looped window extraction from numpy matrix
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
| def extract_windows(array, clearing_time_index, max_time, sub_window_size): | |
| examples = [] | |
| start = clearing_time_index + 1 - sub_window_size + 1 | |
| for i in range(max_time+1): | |
| example = array[start+i:start+sub_window_size+i] | |
| examples.append(np.expand_dims(example, 0)) | |
| return np.vstack(examples) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment