FlaredetectorWidget: signal epoch_time and support multiple minima/maxima

This commit is contained in:
2024-07-15 11:51:54 +02:00
parent 0de8071803
commit 51e0d81c28
+5 -2
View File
@@ -13,6 +13,7 @@ from ...flaredetector.flaredetector import calculateFlareFitsForLightcurve
class FlaredetectorWidget(QtWidgets.QWidget):
periodsCalculated = pyqtSignal(list)
epochCalculated = pyqtSignal(float)
def __init__(self, name):
super(FlaredetectorWidget, self).__init__()
@@ -197,7 +198,9 @@ class FlaredetectorWidget(QtWidgets.QWidget):
self.foldedLC = lc.to_periodogram(method=self.PeriodogramState["Method"])
self.peaks, self.fits = calculateFlareFitsForLightcurve(self.currentFlattenLC, num=100)
self.periods = [self.foldedLC.period[i] for i in findMaxIndices(self.foldedLC, num=4, distance=100, sortByHighest=True)]
self.epoch_time = getEpochTime(lc)
self.periodsCalculated.emit(self.periods)
self.epochCalculated.emit(self.epoch_time)
def updatePlot(self):
lc = self.currentLC
@@ -253,8 +256,8 @@ class FlaredetectorWidget(QtWidgets.QWidget):
lc.flux[lc.cycle == cycle][foldedIndex], "x", color="red")
phase, sineFit = getFoldedBestFit(lc)
self.figureAxis.plot(phase, sineFit, color="red")
minPhaseBoundsIndices, maxPhaseBoundsIndices = getPhaseRangesNearPeak(getFoldedFitPeakValley(sineFit), phase)
plotPhaseRangesNearPeak((minPhaseBoundsIndices, maxPhaseBoundsIndices), phase, ax=self.figureAxis)
minPhasesBoundsIndices, maxPhasesBoundsIndices = getPhaseRangesNearPeak(getFoldedFitPeakValley(sineFit), phase)
plotPhaseRangesNearPeak((minPhasesBoundsIndices, maxPhasesBoundsIndices), phase, ax=self.figureAxis)
elif(self.PeriodogramState["Enabled"]):
lc.plot(label=label, ax=self.figureAxis, view=self.PeriodogramState["View"])
if(self.PeriodogramState["View"] == "period"):