Most (all?) functions in
npstreams are designed to work on streams, or
iterables of NumPy arrays. These iterables can be infinite.
The quintessential example is a stream of images progressively read from disk.
These streams of arrays must contain arrays that all have the same shape and data-type,
unless specified otherwise.
An example of a function that operates on a stream of arrays of different shapes is
A single NumPy array can be passed where a stream is expected; the array will be repackaged into a stream of a single array.
In order to facilitate documentation, functions in
npstreams follow the following conventions:
Routines are named after their closest equivalent in
Routines with names starting with ‘i’ (e.g.
iprod()) are generator functions; they yield running results as they are being computer. Usually, these functions have a non-generator equivalent that consumes the entire stream (e.g.
Routines with names starting with ‘c’ (e.g.
csum()) are CUDA-enabled (requires
The convention for specification of the
axis parameter is as follows:
axis = None, arrays are flattened before being combined. The result will be a scalar of a 0d array.
The default (
axis = -1) always corresponds to combining arrays along a new axis. For example, summing images together along
axis = -1is equivalent to stacking images along a new axis, then averaging along this new axis
int, then arrays are reduced according to this axis, and then combined.
Some functions are implemented using CUDA