npstreams.array_stream

npstreams.array_stream(func)

Decorates streaming functions to make sure that the stream is a stream of ndarrays. Objects that are not arrays are transformed into arrays. If the stream is in fact a single ndarray, this ndarray is repackaged into a sequence of length 1.

The first argument of the decorated function is assumed to be an iterable of arrays, or an iterable of objects that can be casted to arrays.

Note that using this decorator also ensures that the stream is only wrapped once by the conversion function.