Utility functions

Functor

This module provides a class that wraps data into a callable object.

class livius.util.functor.Functor(data, transform=None)

Creates a callable object from the given data. The data must be indexable by the arguments that are provided when calling the object.

Parameters:
  • data (Anything with a specified __getitem__ method) – The data which is accessed by the arguments given when this object is called.
  • transform – An additional function that transforms the indexed item (e.g turns it into a np.array)
__call__(*args)

Index the stored data.

Parameters:args – One or more indices we want to access the data with.

Note

The arguments when calling the object must be provided in order of indexing

__weakref__

list of weak references to the object (if defined)