From cbfbd7e9767c3f53fef231c5c2dfb8ecfbbf3432 Mon Sep 17 00:00:00 2001 From: SGCMarkus Date: Tue, 26 Mar 2024 12:40:12 +0100 Subject: [PATCH] flaredetector: util: set data per different instance specific to not duplicate code --- main/flaredetector/util.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main/flaredetector/util.py b/main/flaredetector/util.py index c0dfcc6..49eb329 100644 --- a/main/flaredetector/util.py +++ b/main/flaredetector/util.py @@ -5,7 +5,8 @@ from lightkurve.periodogram import Periodogram def findMaxIndices(lc, num=3, distance=100): if(isinstance(lc, Periodogram)): - peak_indices, peak_dict = find_peaks(lc.power, height=(None, None), 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 + data = lc.power + 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 \ No newline at end of file