thorwhalen / umpyre

Materials for python coaching
MIT License
1 stars 0 forks source link

Applying numpy functions to unbounded streams #13

Open thorwhalen opened 3 years ago

thorwhalen commented 3 years ago

Consider these: image

image

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).