From 54629bf5cd853ff16092b9945d45d944543ad70e Mon Sep 17 00:00:00 2001 From: SGCMarkus Date: Thu, 28 Mar 2024 12:01:39 +0100 Subject: [PATCH] flaredetector: util: allow setting min height for peaks --- main/flaredetector/util.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main/flaredetector/util.py b/main/flaredetector/util.py index 65d73ce..72a730a 100644 --- a/main/flaredetector/util.py +++ b/main/flaredetector/util.py @@ -4,14 +4,15 @@ from scipy.signal import find_peaks from lightkurve.periodogram import Periodogram from lightkurve.lightcurve import LightCurve -def findMaxIndices(lc, num=3, distance=100): +def findMaxIndices(lc, num=3, distance=100, height=(None, None)): if(isinstance(lc, Periodogram)): data = lc.power elif(isinstance(lc, LightCurve)): data = lc.flux else: return np.zeros(num)-1 - peak_indices, peak_dict = find_peaks(data, height=(None, None), distance=distance) + peak_indices, peak_dict = find_peaks(data, height=height, + distance=distance) peak_heights = peak_dict["peak_heights"] maxIndices = peak_indices[np.argsort(peak_heights)[-num:][::-1]] return maxIndices \ No newline at end of file