find_nearest

Finding closest values in an array.

mr_utils.utils.find_nearest.find_nearest(array, value)[source]

Given straws and needle, find the closest straw to the needle.

Parameters:
  • array (array_like) – hay stack.
  • value (float) – needle.
Returns:

  • idx (int) – Flattened index where value is located (or closest value is located).
  • float – The actual value at idx.