(value, arr: np.ndarray, return_idx: bool = True)
| 5 | |
| 6 | |
| 7 | def find_nearest_value(value, arr: np.ndarray, return_idx: bool = True): |
| 8 | idx = np.argmin(np.abs(arr - value)) |
| 9 | if return_idx: |
| 10 | return idx |
| 11 | return arr[idx] |
| 12 | |
| 13 | |
| 14 | def find_nearest_equal_or_smaller_value(value, |
no outgoing calls
no test coverage detected