nearest

simcado.utils.nearest(arr, val)[source]

Return the index of the value from ‘arr’ which is closest to ‘val’

Parameters
arrnp.ndarray, list, tuple

Array to be searched

valfloat, int

Value to find in arr

Returns
iint

index of array where the nearest value to val is