pulse2percept.utils.array
is_strictly_increasing,
sample,
unique,
radial_mask
Functions
|
|
|
|
|
Randomly selects |
|
Find the unique elements of a sorted 1D array |
- pulse2percept.utils.array.sample(sequence, k=1)[source]
Randomly selects
kelements from asequenceAdded in version 0.8.
- Parameters:
- Returns:
sample – List of randomly chosen elements from the sequence
- Return type:
- 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 leveltol.Added 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
athat 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.