pulse2percept.utils.array¶
is_strictly_increasing
, sample
, unique
, radial_mask
Functions
is_strictly_increasing (arr[, tol]) |
|
radial_mask (shape[, mask, sd]) |
|
sample (sequence[, k]) |
Randomly selects k elements from a sequence |
unique (a[, tol, return_index]) |
Find the unique elements of a sorted 1D array |
-
pulse2percept.utils.array.
sample
(sequence, k=1)[source]¶ Randomly selects
k
elements from asequence
New in version 0.8.
Parameters: Returns: sample (list) – List of randomly chosen elements from the sequence
-
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
.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.