From fffe94916e7ec6c013f3297dc4ed99671a96bb6a Mon Sep 17 00:00:00 2001 From: SGCMarkus Date: Tue, 26 Mar 2024 13:40:04 +0100 Subject: [PATCH] flaredetector: util: findMaxIndices: return a -1 array of size num if no valid lc type was given --- main/flaredetector/util.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/flaredetector/util.py b/main/flaredetector/util.py index e97f8f5..65d73ce 100644 --- a/main/flaredetector/util.py +++ b/main/flaredetector/util.py @@ -9,6 +9,8 @@ def findMaxIndices(lc, num=3, distance=100): 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_heights = peak_dict["peak_heights"] maxIndices = peak_indices[np.argsort(peak_heights)[-num:][::-1]]