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

Request: RangedAgg Unit (needs better name too) #45

Closed cboulay closed 4 months ago

cboulay commented 8 months ago

On the provided axis, for each range, slice the data within the range criteria and apply an operator (mean, median, sum).

I'm happy to do this as a PR but I'd like some suggestions for names and settings.

Unit name possibilities:

And for the settings, when defining the ranges, should that be an ordered dictionary with keys corresponding to tick-values/labels along the new axis and values specify the range along the old axis? Or maybe we keep the axis the same and the new tick-values are the mean of the tick-values caught in the slice? The latter seems more straightforward.

griffinmilsap commented 7 months ago

This will take a moment to digest; I haven't considered this pattern for this sort of operation yet -- Possible this "RangedAggregate" function belongs in core, or possibly even in AxisArray? Also thinking some variety on "map" might make a better name that's consistent with similar functionality in functional programming, XArray, and Pandas.