Base
round_any(x, base, round_type='round')
Rounds x to the nearest multiple of base with the rounding done according to round_type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x |
Union[float, np.ndarray]
|
Number or array to round. |
required |
base |
float
|
Rounds |
required |
round_type |
str
|
One of the following, indicating how to round
|
'round'
|
Returns:
| Type | Description |
|---|---|
Union[float, np.ndarray]
|
Rounded version of |
Example
round_any(3, 5) = 5
round_any(3, 5, 'floor') = 0
Source code in coppafish/utils/base.py
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | |
setdiff2d(array1, array2)
Finds all elements in array1 that are not in array2.
Returned array will only contain unique elements E.g.
If array1 has [4,0] twice, array2 has [4,0] once, returned array will not have [4,0].
If array1 has [4,0] twice, array2 does not have [4,0], returned array will have [4,0] once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array1 |
np.ndarray
|
|
required |
array2 |
np.ndarray
|
|
required |
Returns:
| Type | Description |
|---|---|
np.ndarray
|
|
Source code in coppafish/utils/base.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |