bucky.util.array_utils
#
Provide some generic utility functions that operate on numpy/cupy arrays
Module Contents#
Functions#
|
Use stride_tricks to add an extra dim on the end of an ndarray for each elements window. |
|
Undo a broadcasted array view, squashing the broadcasted dims. |
- bucky.util.array_utils.rolling_window(a, window_size, center=False, axis=0, pad=True, pad_mode='reflect', reflect_type='even', freq=1)[source]#
Use stride_tricks to add an extra dim on the end of an ndarray for each elements window.
- bucky.util.array_utils.unbroadcast(array)[source]#
Undo a broadcasted array view, squashing the broadcasted dims.
Given an array, return a new array that is the smallest subset of the original array that can be re-broadcasted back to the original array.
See https://stackoverflow.com/questions/40845769/un-broadcasting-numpy-arrays for more details.