astrodatagui: add option to show Tess/Kepler Quality flag
This commit is contained in:
@@ -51,6 +51,8 @@ class AstrodataGUI(QtWidgets.QMainWindow):
|
|||||||
self.edPlotFoldPeriod.textEdited.connect(self.plotOptionsLineEditTextEdited)
|
self.edPlotFoldPeriod.textEdited.connect(self.plotOptionsLineEditTextEdited)
|
||||||
self.edPlotFoldEpochTime.textEdited.connect(self.plotOptionsLineEditTextEdited)
|
self.edPlotFoldEpochTime.textEdited.connect(self.plotOptionsLineEditTextEdited)
|
||||||
|
|
||||||
|
self.cbPlotShowQuality.stateChanged.connect(self.plotOptionsShowQuality)
|
||||||
|
|
||||||
self.setupCustomSimbadQueries()
|
self.setupCustomSimbadQueries()
|
||||||
self.show()
|
self.show()
|
||||||
self.loadDB()
|
self.loadDB()
|
||||||
@@ -279,6 +281,9 @@ class AstrodataGUI(QtWidgets.QMainWindow):
|
|||||||
case (self.edPlotFoldPeriod | self.edPlotFoldEpochTime):
|
case (self.edPlotFoldPeriod | self.edPlotFoldEpochTime):
|
||||||
self.updateFlaredetectionWidgetFold()
|
self.updateFlaredetectionWidgetFold()
|
||||||
|
|
||||||
|
def plotOptionsShowQuality(self, state):
|
||||||
|
self.flaredetectorPreview.setShowQuality(state == QtCore.Qt.Checked)
|
||||||
|
|
||||||
def updateFlaredetectionWidgetFlux(self):
|
def updateFlaredetectionWidgetFlux(self):
|
||||||
fluxType = self.comboPlotFluxType.currentText()
|
fluxType = self.comboPlotFluxType.currentText()
|
||||||
self.flaredetectorPreview.setFluxType(fluxType)
|
self.flaredetectorPreview.setFluxType(fluxType)
|
||||||
|
|||||||
@@ -132,19 +132,6 @@
|
|||||||
<property name="sizeConstraint">
|
<property name="sizeConstraint">
|
||||||
<enum>QLayout::SetDefaultConstraint</enum>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="4">
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
<item row="0" column="1">
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -255,8 +242,8 @@
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
<layout class="QGridLayout" name="gridLayout_11">
|
||||||
<item>
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_19">
|
<widget class="QLabel" name="label_19">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
@@ -269,7 +256,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="comboPlotFluxType">
|
<widget class="QComboBox" name="comboPlotFluxType">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
|
||||||
@@ -289,6 +276,20 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QCheckBox" name="cbPlotShowQuality">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_25">
|
||||||
|
<property name="text">
|
||||||
|
<string>Show Quality:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@@ -1063,6 +1064,19 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
|||||||
|
|
||||||
self.figure = Figure()
|
self.figure = Figure()
|
||||||
self.figureAxis = self.figure.add_subplot()
|
self.figureAxis = self.figure.add_subplot()
|
||||||
|
self.qualityAxis = self.figureAxis.twinx()
|
||||||
fc = FigureCanvas(self.figure)
|
fc = FigureCanvas(self.figure)
|
||||||
toolbar = NavigationToolbar(fc, self)
|
toolbar = NavigationToolbar(fc, self)
|
||||||
self.mainLayout.addWidget(toolbar)
|
self.mainLayout.addWidget(toolbar)
|
||||||
@@ -54,6 +55,7 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
|||||||
self.FlattenState = {"Enabled": False, "WindowLength": 101, "PolynomialOrder": 2}
|
self.FlattenState = {"Enabled": False, "WindowLength": 101, "PolynomialOrder": 2}
|
||||||
self.FoldState = {"Enabled": False, "Period": 1, "EpochTime": 0}
|
self.FoldState = {"Enabled": False, "Period": 1, "EpochTime": 0}
|
||||||
self.PeriodogramState = {"Enabled": False, "Method": "lombscargle", "View": "frequency"}
|
self.PeriodogramState = {"Enabled": False, "Method": "lombscargle", "View": "frequency"}
|
||||||
|
self.ShowQualityState = {"Enabled": False}
|
||||||
|
|
||||||
def setFitsFile(self, fitsFilePath, mainName: str):
|
def setFitsFile(self, fitsFilePath, mainName: str):
|
||||||
print(f"Plotting: {fitsFilePath}")
|
print(f"Plotting: {fitsFilePath}")
|
||||||
@@ -165,6 +167,10 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
|||||||
self.FlattenState["Enabled"] = False
|
self.FlattenState["Enabled"] = False
|
||||||
self.updatePlot()
|
self.updatePlot()
|
||||||
|
|
||||||
|
def setShowQuality(self, enabled: bool):
|
||||||
|
self.ShowQualityState["Enabled"] = enabled
|
||||||
|
self.updatePlot()
|
||||||
|
|
||||||
def normalizeStichedLightCurve(self, lc):
|
def normalizeStichedLightCurve(self, lc):
|
||||||
lc.flux = lc[self.fluxType]
|
lc.flux = lc[self.fluxType]
|
||||||
return lc.normalize(unit=self.NormalizeState["Scale"])
|
return lc.normalize(unit=self.NormalizeState["Scale"])
|
||||||
@@ -219,6 +225,7 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
|||||||
self.periodogramInfoGroupBox.setVisible(self.PeriodogramState["Enabled"])
|
self.periodogramInfoGroupBox.setVisible(self.PeriodogramState["Enabled"])
|
||||||
|
|
||||||
self.figureAxis.clear()
|
self.figureAxis.clear()
|
||||||
|
self.qualityAxis.clear()
|
||||||
time_support()
|
time_support()
|
||||||
if(self.FoldState["Enabled"]):
|
if(self.FoldState["Enabled"]):
|
||||||
lc.scatter(label=label, ax=self.figureAxis)
|
lc.scatter(label=label, ax=self.figureAxis)
|
||||||
@@ -234,4 +241,9 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
|||||||
markFlare(self.figureAxis, self.fits, lc.flux)
|
markFlare(self.figureAxis, self.fits, lc.flux)
|
||||||
if(self.FlattenState["Enabled"]):
|
if(self.FlattenState["Enabled"]):
|
||||||
plotFlareFits(self.figureAxis, self.fits)
|
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()
|
self.figure.canvas.draw_idle()
|
||||||
Reference in New Issue
Block a user