find_nearest

fiducia.misc.find_nearest(array, value)[source]

Find nearest value in array and return index, and value as a tuple.

Parameters
  • array (list, numpy.ndarray) – Array of values to be searched.

  • value (int, float) – Value for which this function will find the nearest value in the array.

Returns

  • idx (int) – Index at which nearest value to input value occurs in the array.

  • array[idx] (int, float) – The nearest value to the input value.

Notes

Examples