flaredetector: util: add function to find indices of peaks
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
import numpy as np
|
||||||
|
from scipy.signal import find_peaks
|
||||||
|
|
||||||
|
def findMaxIndices(data, num=3, distance=100):
|
||||||
|
peak_indices, peak_dict = find_peaks(data, height=(None, None), distance=distance)
|
||||||
|
peak_heights = peak_dict["peak_heights"]
|
||||||
|
maxIndices = peak_indices[np.argsort(peak_heights)[-num:][::-1]]
|
||||||
|
return maxIndices
|
||||||
Reference in New Issue
Block a user