Regularly I need to apply a function to a series of
y[i] in a windowed (rolling) way, where the window is defined by values of another series
x[i] instead of the indices
i themselves. E.g.
x represents timestamps,
y are some measurements, and the target result is a rolling average of measurements wrt time. I could not find any existing library that can perform this kind of mapping, neither in Julia nor in Python. For quite some time I wrote ad-hoc implementations with different hardcoded assumptions in different projects of mine, but recently I decided to format this as a reasonably reusable package.
The package can be installed from https://github.com/aplavin/WindowMap.jl, and there is a jupyter notebook with simple usage examples: https://github.com/aplavin/WindowMap.jl/blob/master/examples.ipynb. For now it is not general enough for my usage: only univariate and bivariate applications are supported, and in the bivariate case the window can only be a product of two univariate windows; I’m planning to extend the package in this direction.
As I’m not experienced in writing general and reusable Julia code and packages, I would be really thankful for any comments and suggestions regarding the overall design of this package. The whole source code is only one file with 120 lines now: https://github.com/aplavin/WindowMap.jl/blob/master/src/WindowMap.jl. I’m also curious of how you think performance could be improved while keeping the generality.