scopesim.utils.nearest

Contents

scopesim.utils.nearest#

scopesim.utils.nearest(arr, val)#

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

Parameters:
  • arr (np.ndarray, list, tuple) – Array to be searched

  • val (float, int) – Value to find in arr

Returns:

i – index of array where the nearest value to val is

Return type:

int