skrf.util.find_nearest_index

skrf.util.find_nearest_index(array, value)[source]

find nearest value in array.

Parameters:
  • array (numpy.ndarray) – array we are searching for a value in
  • value (element of the array) – value to search for
Returns:

found_index – the index at which the numerically closest element to value was found at

Return type:

int

taken from http://stackoverflow.com/questions/2566412/find-nearest-value-in-numpy-array