Previous topic

util.cluster

Next topic

util.gimage

This Page

util.garray

Miscellaneous functions for dealing with numpy arrays.

glimpse.util.garray.ACTIVATION_DTYPE

Element type for an array of Glimpse activation values.

alias of float32

glimpse.util.garray.ArgMax(array)

Short-hand to find array indices containing the maximum value.

glimpse.util.garray.ArgMin(array)

Short-hand to find array indices containing the minimum value.

glimpse.util.garray.ArrayListToVector(arrays)

Flatten a list of numpy arrays to a single numpy vector.

Return type:ndarray
glimpse.util.garray.ArrayToGreyscaleImage(array, normalize=True)

Create a greyscale image from a 2D numpy array.

This function assumes range of input values contains 0.

glimpse.util.garray.ArrayToRGBImage(array)

Create a color image from an array.

Return type:PIL.Image
glimpse.util.garray.CropArray(data, out_shape)

Remove the border of an array.

Parameters:
  • data (ndarray) – Input array.
  • out_shape (list of int) – Shape of central region to return.
Return type:

ndarray

Returns:

View of the central region of input array.

glimpse.util.garray.PadArray(data, out_shape, cval)

Pad the border of an array with a constant value.

glimpse.util.garray.ScaleUnitNorm(x)

Scale elements of vector (in place), such that result has unit norm.