caput.util.arraytools#

Tools for working with numpy arrays and subclasses.

Classes#

LRUCache

An LRU cache for numpy arrays that will expand to a maximum size in bytes.

Functions#

listize(→ collections.abc.Callable)

Make functions that already work with np.ndarray or scalars accept lists.

partition_list(→ list)

Partition a list into n pieces. Return the i th partition.

scalarize(→ collections.abc.Callable)

Handle scalars and other iterables being passed to numpy requiring code.

split_m(→ numpy.ndarray)

Split a range of integers [0, n) into m sub-ranges of similar length.

unique_ordered(→ list)

Take unique values from an iterable with order preserved.

vectorize(→ collections.abc.Callable)

Improved vectorization decorator.