tools

tools.nearest_index(array, target_value)[source]

Finds the index of a value in array that is closest to target_value.

Parameters:
array (``numpy.array``):

Target array.

target_value (``float``):

Target value.

Returns:
index (int):

Index of the value in array that is closest to target_value.