astrodatagui: implement normalize function

This commit is contained in:
2024-03-13 09:48:44 +01:00
parent 7799836cf7
commit 956779a0a5
3 changed files with 18 additions and 5 deletions
+3 -1
View File
@@ -22,6 +22,7 @@ class AstrodataGUI(QtWidgets.QMainWindow):
self.listDownloaded.itemClicked.connect(self.starSelected) self.listDownloaded.itemClicked.connect(self.starSelected)
self.listSequences.itemClicked.connect(self.sequenceSelected) self.listSequences.itemClicked.connect(self.sequenceSelected)
self.cbEnableNormalize.stateChanged.connect(self.plotOptionsCBChecked)
self.cbEnableFlattenPlot.stateChanged.connect(self.plotOptionsCBChecked) self.cbEnableFlattenPlot.stateChanged.connect(self.plotOptionsCBChecked)
self.cbEnableRemoveOutliers.stateChanged.connect(self.plotOptionsCBChecked) self.cbEnableRemoveOutliers.stateChanged.connect(self.plotOptionsCBChecked)
self.cbEnableRemoveNans.stateChanged.connect(self.plotOptionsCBChecked) self.cbEnableRemoveNans.stateChanged.connect(self.plotOptionsCBChecked)
@@ -168,6 +169,7 @@ class AstrodataGUI(QtWidgets.QMainWindow):
self.flaredetectorPreview.plotFitsFile(filePath, mainName) self.flaredetectorPreview.plotFitsFile(filePath, mainName)
def plotOptionsCBChecked(self, state): def plotOptionsCBChecked(self, state):
normalize = self.cbEnableNormalize.isChecked()
flatten = self.cbEnableFlattenPlot.isChecked() flatten = self.cbEnableFlattenPlot.isChecked()
remOutliers = self.cbEnableRemoveOutliers.isChecked() remOutliers = self.cbEnableRemoveOutliers.isChecked()
remNans = self.cbEnableRemoveNans.isChecked() remNans = self.cbEnableRemoveNans.isChecked()
@@ -193,5 +195,5 @@ class AstrodataGUI(QtWidgets.QMainWindow):
if(binC): if(binC):
binList[1] = binSize binList[1] = binSize
self.flaredetectorPreview.updatePlot(flatten, remOutliers, self.flaredetectorPreview.updatePlot(normalize, flatten, remOutliers,
remNans, foldList, binList) remNans, foldList, binList)
+8 -1
View File
@@ -150,7 +150,7 @@
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>290</height> <height>310</height>
</size> </size>
</property> </property>
<property name="title"> <property name="title">
@@ -223,6 +223,13 @@
<string>Plot options</string> <string>Plot options</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_6"> <layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QCheckBox" name="cbEnableNormalize">
<property name="text">
<string>Normalize</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="cbEnableFlattenPlot"> <widget class="QCheckBox" name="cbEnableFlattenPlot">
<property name="text"> <property name="text">
+7 -3
View File
@@ -27,12 +27,16 @@ class FlaredetectorWidget(QtWidgets.QWidget):
self.currentLC.flux = self.currentLC['sap_flux'] self.currentLC.flux = self.currentLC['sap_flux']
self.currentMainName = mainName self.currentMainName = mainName
label = f"{mainName} - SAP Flux" label = f"{mainName} - SAP Flux"
self.currentLC.plot(column="sap_flux", label=label, ax=self.figureAxis) self.currentLC.scatter(column="sap_flux", label=label, ax=self.figureAxis)
self.figure.canvas.draw_idle() self.figure.canvas.draw_idle()
def updatePlot(self, flatten: bool, remOutliers: bool, remNans: bool, fold: list, binList: list): def updatePlot(self, normalize: bool, flatten: bool, remOutliers: bool,
remNans: bool, fold: list, binList: list):
lc = self.currentLC lc = self.currentLC
label = f"{self.currentMainName}" label = f"{self.currentMainName}"
if(normalize):
lc = lc.normalize()
label += " - normalized"
if(flatten): if(flatten):
lc = lc.flatten() lc = lc.flatten()
label += " - flattened" label += " - flattened"
@@ -53,5 +57,5 @@ class FlaredetectorWidget(QtWidgets.QWidget):
label += " - binned" label += " - binned"
self.figureAxis.clear() self.figureAxis.clear()
lc.plot(label=label, ax=self.figureAxis) lc.scatter(label=label, ax=self.figureAxis)
self.figure.canvas.draw_idle() self.figure.canvas.draw_idle()