From 956779a0a5c61ad9f599c58a765061e8bede98d5 Mon Sep 17 00:00:00 2001 From: SGCMarkus Date: Wed, 13 Mar 2024 09:48:44 +0100 Subject: [PATCH] astrodatagui: implement normalize function --- main/astrodatagui/AstrodataGUI.py | 4 +++- main/astrodatagui/astrodatagui.ui | 9 ++++++++- main/astrodatagui/ui/FlaredetectorWidget.py | 10 +++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/main/astrodatagui/AstrodataGUI.py b/main/astrodatagui/AstrodataGUI.py index 64757b7..3befcd5 100644 --- a/main/astrodatagui/AstrodataGUI.py +++ b/main/astrodatagui/AstrodataGUI.py @@ -22,6 +22,7 @@ class AstrodataGUI(QtWidgets.QMainWindow): self.listDownloaded.itemClicked.connect(self.starSelected) self.listSequences.itemClicked.connect(self.sequenceSelected) + self.cbEnableNormalize.stateChanged.connect(self.plotOptionsCBChecked) self.cbEnableFlattenPlot.stateChanged.connect(self.plotOptionsCBChecked) self.cbEnableRemoveOutliers.stateChanged.connect(self.plotOptionsCBChecked) self.cbEnableRemoveNans.stateChanged.connect(self.plotOptionsCBChecked) @@ -168,6 +169,7 @@ class AstrodataGUI(QtWidgets.QMainWindow): self.flaredetectorPreview.plotFitsFile(filePath, mainName) def plotOptionsCBChecked(self, state): + normalize = self.cbEnableNormalize.isChecked() flatten = self.cbEnableFlattenPlot.isChecked() remOutliers = self.cbEnableRemoveOutliers.isChecked() remNans = self.cbEnableRemoveNans.isChecked() @@ -193,5 +195,5 @@ class AstrodataGUI(QtWidgets.QMainWindow): if(binC): binList[1] = binSize - self.flaredetectorPreview.updatePlot(flatten, remOutliers, + self.flaredetectorPreview.updatePlot(normalize, flatten, remOutliers, remNans, foldList, binList) \ No newline at end of file diff --git a/main/astrodatagui/astrodatagui.ui b/main/astrodatagui/astrodatagui.ui index ea57433..a17aca0 100644 --- a/main/astrodatagui/astrodatagui.ui +++ b/main/astrodatagui/astrodatagui.ui @@ -150,7 +150,7 @@ 16777215 - 290 + 310 @@ -223,6 +223,13 @@ Plot options + + + + Normalize + + + diff --git a/main/astrodatagui/ui/FlaredetectorWidget.py b/main/astrodatagui/ui/FlaredetectorWidget.py index 301182f..8a18fea 100644 --- a/main/astrodatagui/ui/FlaredetectorWidget.py +++ b/main/astrodatagui/ui/FlaredetectorWidget.py @@ -27,12 +27,16 @@ class FlaredetectorWidget(QtWidgets.QWidget): self.currentLC.flux = self.currentLC['sap_flux'] self.currentMainName = mainName 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() - 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 label = f"{self.currentMainName}" + if(normalize): + lc = lc.normalize() + label += " - normalized" if(flatten): lc = lc.flatten() label += " - flattened" @@ -53,5 +57,5 @@ class FlaredetectorWidget(QtWidgets.QWidget): label += " - binned" self.figureAxis.clear() - lc.plot(label=label, ax=self.figureAxis) + lc.scatter(label=label, ax=self.figureAxis) self.figure.canvas.draw_idle() \ No newline at end of file