def decluster(peaks, index, trig_int):
utilslib = _load_cdll('<STR_LIT>')<EOL>length = np.int32(len(peaks))<EOL>utilslib.find_peaks.argtypes = [<EOL>np.ctypeslib.ndpointer(dtype=np.float32, shape=(length,),<EOL>flags=native_str('<STR_LIT>')),<EOL>np.ctypeslib.ndpointer(dtype=np.float32, shape=(length,),<EOL>flags=native_str('<STR_LIT>')),<EOL>ctypes.c_int, ctypes.c_float, ctypes.c_float,<EOL>np.ctypeslib.ndpointer(dtype=np.uint32, shape=(length,),<EOL>flags=native_str('<STR_LIT>'))]<EOL>utilslib.find_peaks.restype = ctypes.c_int<EOL>peaks_sort = sorted(zip(peaks, index),<EOL>key=lambda amplitude: abs(amplitude[<NUM_LIT:0>]),<EOL>reverse=True)<EOL>arr, inds = zip(*peaks_sort)<EOL>arr = np.ascontiguousarray(arr, dtype=np.float32)<EOL>inds = np.array(inds, dtype=np.float32) / trig_int<EOL>inds = np.ascontiguousarray(inds, dtype=np.float32)<EOL>out = np.zeros(len(arr), dtype=np.uint32)<EOL>ret = utilslib.find_peaks(<EOL>arr, inds, length, <NUM_LIT:0>, np.float32(<NUM_LIT:1>), out)<EOL>if ret != <NUM_LIT:0>:<EOL><INDENT>raise MemoryError("<STR_LIT>" % ret)<EOL><DEDENT>peaks_out = list(compress(peaks_sort, out))<EOL>return peaks_out<EOL>
Decluster peaks based on an enforced minimum separation.
:type peaks: np.array
:param peaks: array of peak values
:type index: np.ndarray
:param index: locations of peaks
:type trig_int: int
:param trig_int: Minimum trigger interval in samples

:return: list of tuples of (value, sample)