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
15 stars 6 forks source link

`windowing` generator should return an AxisArray not List[AxisArray] #100

Closed cboulay closed 6 months ago

cboulay commented 8 months ago

I'd like to change the behavaiour of the windowing generator method. Currently, its output is a List[AxisArray]. The unit then iterates over the list, yielding one at a time.

When the newaxis parameter is not None, segments / windows (even if only one) appear on a new axis named something like "step" or "win", and the generator return always has len=1. If newaxis is None then a list is returned with len for the number of windows found on this iteration.

I would like to make newaxis in the generator non-optional with a default value of "win". This means that we always get a new "win" axis. Then, if the Unit was configured with newaxis=None, it's up to the node to multiple yields of single-window AxisArray messages without the "win" axis present.

The main reason for this change is that at present the windowing generator cannot be composed with other generator functions. A common use case that this change will simplify is a STFT where the output of windowing goes into spectrum ('time' axis becomes 'freq') and modify_axis to convert the 'win' axis to 'time'.

This will not change the functioning of the Window(ez.Unit) in any way, only the generator method.

Pleaset let me know what you think.

griffinmilsap commented 8 months ago

This sounds good to me. Feel free to submit a PR and we can get it merged in a jiffy.