From f68c635545b95d065522ec752818cf1e4c818578 Mon Sep 17 00:00:00 2001 From: SGCMarkus Date: Mon, 13 May 2024 14:24:54 +0200 Subject: [PATCH] astrodatagui: add option to show Tess/Kepler Quality flag --- main/astrodatagui/AstrodataGUI.py | 5 +++ main/astrodatagui/astrodatagui.ui | 46 ++++++++++++++------- main/astrodatagui/ui/FlaredetectorWidget.py | 12 ++++++ 3 files changed, 47 insertions(+), 16 deletions(-) diff --git a/main/astrodatagui/AstrodataGUI.py b/main/astrodatagui/AstrodataGUI.py index 16a335d..3b1bf5d 100644 --- a/main/astrodatagui/AstrodataGUI.py +++ b/main/astrodatagui/AstrodataGUI.py @@ -51,6 +51,8 @@ class AstrodataGUI(QtWidgets.QMainWindow): self.edPlotFoldPeriod.textEdited.connect(self.plotOptionsLineEditTextEdited) self.edPlotFoldEpochTime.textEdited.connect(self.plotOptionsLineEditTextEdited) + self.cbPlotShowQuality.stateChanged.connect(self.plotOptionsShowQuality) + self.setupCustomSimbadQueries() self.show() self.loadDB() @@ -279,6 +281,9 @@ class AstrodataGUI(QtWidgets.QMainWindow): case (self.edPlotFoldPeriod | self.edPlotFoldEpochTime): self.updateFlaredetectionWidgetFold() + def plotOptionsShowQuality(self, state): + self.flaredetectorPreview.setShowQuality(state == QtCore.Qt.Checked) + def updateFlaredetectionWidgetFlux(self): fluxType = self.comboPlotFluxType.currentText() self.flaredetectorPreview.setFluxType(fluxType) diff --git a/main/astrodatagui/astrodatagui.ui b/main/astrodatagui/astrodatagui.ui index eaad017..1e17fe9 100644 --- a/main/astrodatagui/astrodatagui.ui +++ b/main/astrodatagui/astrodatagui.ui @@ -132,19 +132,6 @@ QLayout::SetDefaultConstraint - - - - Qt::Horizontal - - - - 40 - 20 - - - - @@ -255,8 +242,8 @@ - - + + @@ -269,7 +256,7 @@ - + @@ -289,6 +276,20 @@ + + + + + + + + + + + Show Quality: + + + @@ -1063,6 +1064,19 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + diff --git a/main/astrodatagui/ui/FlaredetectorWidget.py b/main/astrodatagui/ui/FlaredetectorWidget.py index 3494d5b..39869d1 100644 --- a/main/astrodatagui/ui/FlaredetectorWidget.py +++ b/main/astrodatagui/ui/FlaredetectorWidget.py @@ -20,6 +20,7 @@ class FlaredetectorWidget(QtWidgets.QWidget): self.figure = Figure() self.figureAxis = self.figure.add_subplot() + self.qualityAxis = self.figureAxis.twinx() fc = FigureCanvas(self.figure) toolbar = NavigationToolbar(fc, self) self.mainLayout.addWidget(toolbar) @@ -54,6 +55,7 @@ class FlaredetectorWidget(QtWidgets.QWidget): self.FlattenState = {"Enabled": False, "WindowLength": 101, "PolynomialOrder": 2} self.FoldState = {"Enabled": False, "Period": 1, "EpochTime": 0} self.PeriodogramState = {"Enabled": False, "Method": "lombscargle", "View": "frequency"} + self.ShowQualityState = {"Enabled": False} def setFitsFile(self, fitsFilePath, mainName: str): print(f"Plotting: {fitsFilePath}") @@ -165,6 +167,10 @@ class FlaredetectorWidget(QtWidgets.QWidget): self.FlattenState["Enabled"] = False self.updatePlot() + def setShowQuality(self, enabled: bool): + self.ShowQualityState["Enabled"] = enabled + self.updatePlot() + def normalizeStichedLightCurve(self, lc): lc.flux = lc[self.fluxType] return lc.normalize(unit=self.NormalizeState["Scale"]) @@ -219,6 +225,7 @@ class FlaredetectorWidget(QtWidgets.QWidget): self.periodogramInfoGroupBox.setVisible(self.PeriodogramState["Enabled"]) self.figureAxis.clear() + self.qualityAxis.clear() time_support() if(self.FoldState["Enabled"]): lc.scatter(label=label, ax=self.figureAxis) @@ -234,4 +241,9 @@ class FlaredetectorWidget(QtWidgets.QWidget): markFlare(self.figureAxis, self.fits, lc.flux) if(self.FlattenState["Enabled"]): plotFlareFits(self.figureAxis, self.fits) + if(self.ShowQualityState["Enabled"]): + qualityColor = "black" + self.qualityAxis.plot(lc.time, lc.quality, color=qualityColor) + self.qualityAxis.set_ylabel("Quality", color=qualityColor) + self.qualityAxis.tick_params(axis='y', labelcolor=qualityColor) self.figure.canvas.draw_idle() \ No newline at end of file