Now, you can't expect to be able to do this in general. Namely, if the functionality needs the len of the array, then the iterable needs to be "Sized". But in the case of find_peaks and correlate, you should theoretically be able to get, as an output, an iterable of peaks and correlation scores respectively.
In some cases (like find_peaks) you should be able to do this, simply feeding the data to a buffer that has enough "local visibility". But I've never managed to subclass numpy arrays, so that's already a hurdle.
We could use delegation instead, but then some functions have isinstanceof checks that are also a hurdle.
The way I envision a solution is that we apply those functions to segments of the stream, but need to do some index translation and some "cursor management" (to not loose information between segments).
Consider these:
Now, you can't expect to be able to do this in general. Namely, if the functionality needs the
len
of the array, then the iterable needs to be "Sized
". But in the case offind_peaks
andcorrelate
, you should theoretically be able to get, as an output, an iterable of peaks and correlation scores respectively.In some cases (like find_peaks) you should be able to do this, simply feeding the data to a buffer that has enough "local visibility". But I've never managed to subclass numpy arrays, so that's already a hurdle. We could use delegation instead, but then some functions have
isinstanceof
checks that are also a hurdle.The way I envision a solution is that we apply those functions to segments of the stream, but need to do some index translation and some "cursor management" (to not loose information between segments).