pulse2percept.utils.array

unique, radial_mask

Functions

radial_mask(shape[, mask, sd])
unique(a[, tol, return_index]) Find the unique elements of a sorted 1D array
pulse2percept.utils.array.unique(a, tol=1e-06, return_index=False)[source]

Find the unique elements of a sorted 1D array

Special case of numpy.unique (array is flat, sortened) with a tolerance level tol.

New in version 0.7.

Parameters:
  • a (array_like) – Input array: must be sorted, and will be flattened if it is not already 1-D.
  • tol (float, optional) – If the difference between two elements in the array is smaller than tol, the two elements are considered equal.
  • return_index (bool, optional) – If True, also return the indices of a that result in the unique array.
Returns:

  • unique (ndarray) – The sorted unique values
  • unique_indices (ndarray, optional) – The indices of the first occurrences of the unique values in the original array. Only provided if return_index is True.