flaredetector: util: check if its a Periodogram
This commit is contained in:
@@ -196,7 +196,7 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
|||||||
lc = lc.to_periodogram(method=self.PeriodogramState["Method"])
|
lc = lc.to_periodogram(method=self.PeriodogramState["Method"])
|
||||||
label = "Periodogram"
|
label = "Periodogram"
|
||||||
|
|
||||||
maxPowers = findMaxIndices(lc.power, 4)
|
maxPowers = findMaxIndices(lc, 4)
|
||||||
print(maxPowers)
|
print(maxPowers)
|
||||||
self.lbMaxPowerPeriod1.setText(str(lc.period[maxPowers[0]]))
|
self.lbMaxPowerPeriod1.setText(str(lc.period[maxPowers[0]]))
|
||||||
self.lbMaxPowerPeriod2.setText(str(lc.period[maxPowers[1]]))
|
self.lbMaxPowerPeriod2.setText(str(lc.period[maxPowers[1]]))
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from scipy.signal import find_peaks
|
from scipy.signal import find_peaks
|
||||||
|
|
||||||
def findMaxIndices(data, num=3, distance=100):
|
from lightkurve.periodogram import Periodogram
|
||||||
peak_indices, peak_dict = find_peaks(data, height=(None, None), distance=distance)
|
|
||||||
|
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"]
|
peak_heights = peak_dict["peak_heights"]
|
||||||
maxIndices = peak_indices[np.argsort(peak_heights)[-num:][::-1]]
|
maxIndices = peak_indices[np.argsort(peak_heights)[-num:][::-1]]
|
||||||
return maxIndices
|
return maxIndices
|
||||||
Reference in New Issue
Block a user