openpiv.pyprocess.moving_window_array

openpiv.pyprocess.moving_window_array(array, window_size, overlap)[source]

This is a nice numpy trick. The concept of numpy strides should be clear to understand this code.

Basically, we have a 2d array and we want to perform cross-correlation over the interrogation windows. An approach could be to loop over the array but loops are expensive in python. So we create from the array a new array with three dimension, of size (n_windows, window_size, window_size), in which each slice, (along the first axis) is an interrogation window.