ezmsg-org / ezmsg

Pure-Python DAG-based high-performance SHM-backed pub-sub and multi-processing pattern
https://ezmsg.readthedocs.io/en/latest/
MIT License
9 stars 5 forks source link

Add utility funcs for slice_along_axis and sliding_win_oneaxis #79

Closed cboulay closed 5 months ago

cboulay commented 6 months ago

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.