borsar.utils.find_index

borsar.utils.find_index(vec, vals)[source]

Find indices of values in vec that are closest to requested values vals.

Parameters:
vec : numpy array

Vector of values.

vals: list of values | value

Values to find closest representatives of in the vec vector.

Returns:
idx : numpy array of int | int

Indices of vec values closest to vals. If one value was passed in vals then idx will also be one value. If two or more values were passed in vals the output is a numpy array of indices.