As mentioned in #78, a custom slice-tuple is faster than using moveaxis and slicing on an easily-accessible axis then moving back.
While I was at this I also added a short-cut version of np.lib.stride_tricks.sliding_window_view when using a single integer on a single axis. This version is also different from the nps version in that it puts the new win axis in front of the target axis, whereas the nps version puts the target axis at the very end.
I use both of these functions in my Window refactor which should be a PR soon.
As mentioned in #78, a custom slice-tuple is faster than using moveaxis and slicing on an easily-accessible axis then moving back.
While I was at this I also added a short-cut version of
np.lib.stride_tricks.sliding_window_view
when using a single integer on a single axis. This version is also different from the nps version in that it puts the new win axis in front of the target axis, whereas the nps version puts the target axis at the very end.I use both of these functions in my Window refactor which should be a PR soon.