find_nearest module
Functions to find a value and/or index in a array
- DMT.extraction.find_nearest.find_nearest(value, array)[source]
Find the index of the value in array nearest to value, and also the corresponding value in the array. Copied From : https://stackoverflow.com/questions/2566412/find-nearest-value-in-numpy-array
- Parameters:
- value
float,np.array[1] The value for which the index in the array is to be determined.
- array[],
np.array() The array for which the index of value shall be determined.
- value
- Returns:
- [value, i_value][
np.float,Index] The index and value in array that are closest to “value”.
- [value, i_value][
- DMT.extraction.find_nearest.find_nearest_index(value, array)[source]
Find the index of the value in array nearest to value. Copied From : https://stackoverflow.com/questions/2566412/find-nearest-value-in-numpy-array
- Parameters:
- value
float,np.array[1] The value for which the index in the array is to be determined.
- array[],
np.array() The array for which the index of value shall be determined.
- value
- Returns:
- i_value
Index The index that corresponds to the closest value to “value” in array.
- i_value