astrodatagui: implement features of all current plot options
This commit is contained in:
@@ -22,6 +22,12 @@ class AstrodataGUI(QtWidgets.QMainWindow):
|
||||
self.listDownloaded.itemClicked.connect(self.starSelected)
|
||||
self.listSequences.itemClicked.connect(self.sequenceSelected)
|
||||
|
||||
self.cbEnableFlattenPlot.stateChanged.connect(self.plotOptionsCBChecked)
|
||||
self.cbEnableRemoveOutliers.stateChanged.connect(self.plotOptionsCBChecked)
|
||||
self.cbEnableRemoveNans.stateChanged.connect(self.plotOptionsCBChecked)
|
||||
self.cbEnableFold.stateChanged.connect(self.plotOptionsCBChecked)
|
||||
self.cbEnableBin.stateChanged.connect(self.plotOptionsCBChecked)
|
||||
|
||||
self.setupCustomSimbadQueries()
|
||||
|
||||
self.show()
|
||||
@@ -159,4 +165,33 @@ class AstrodataGUI(QtWidgets.QMainWindow):
|
||||
source = seqText[0]
|
||||
seq = seqText[1]
|
||||
filePath = self.starDB.getFilePath(mainName, source, seq)
|
||||
self.flaredetectorPreview.plotFitsFile(filePath, mainName)
|
||||
self.flaredetectorPreview.plotFitsFile(filePath, mainName)
|
||||
|
||||
def plotOptionsCBChecked(self, state):
|
||||
flatten = self.cbEnableFlattenPlot.isChecked()
|
||||
remOutliers = self.cbEnableRemoveOutliers.isChecked()
|
||||
remNans = self.cbEnableRemoveNans.isChecked()
|
||||
fold = self.cbEnableFold.isChecked()
|
||||
binC = self.cbEnableBin.isChecked()
|
||||
if(fold):
|
||||
try:
|
||||
period = float(self.edFoldPeriod.text())
|
||||
epoch = float(self.edFoldEpochTime.text())
|
||||
except:
|
||||
fold = False
|
||||
if(binC):
|
||||
try:
|
||||
binSize = float(self.edBinSize.text())
|
||||
except:
|
||||
binC = False
|
||||
foldList = [fold, 0, 0]
|
||||
if(fold):
|
||||
foldList[1] = period
|
||||
foldList[2] = epoch
|
||||
|
||||
binList = [binC, 0]
|
||||
if(binC):
|
||||
binList[1] = binSize
|
||||
|
||||
self.flaredetectorPreview.updatePlot(flatten, remOutliers,
|
||||
remNans, foldList, binList)
|
||||
@@ -23,8 +23,35 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
||||
def plotFitsFile(self, fitsFilePath, mainName: str):
|
||||
print(f"Plotting: {fitsFilePath}")
|
||||
self.figureAxis.clear()
|
||||
lc = lk.read(fitsFilePath)
|
||||
lc.flux = lc['sap_flux']
|
||||
self.currentLC = lk.read(fitsFilePath)
|
||||
self.currentLC.flux = self.currentLC['sap_flux']
|
||||
self.currentMainName = mainName
|
||||
label = f"{mainName} - SAP Flux"
|
||||
lc.plot(column="sap_flux", label=label, ax=self.figureAxis)
|
||||
self.currentLC.plot(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):
|
||||
lc = self.currentLC
|
||||
label = f"{self.currentMainName}"
|
||||
if(flatten):
|
||||
lc = lc.flatten()
|
||||
label += " - flattened"
|
||||
if(remOutliers):
|
||||
lc = lc.remove_outliers()
|
||||
label += " - no ol"
|
||||
if(remNans):
|
||||
lc = lc.remove_nans()
|
||||
label += " - no nans"
|
||||
if(len(fold) == 3 and fold[0]):
|
||||
period = float(fold[1])
|
||||
epoch = float(fold[2])
|
||||
lc = lc.fold(period=period, epoch_time=epoch)
|
||||
label += " - folded"
|
||||
if(len(binList) == 2 and binList[0]):
|
||||
binSize = float(binList[1])
|
||||
lc = lc.bin(time_bin_size=binSize)
|
||||
label += " - binned"
|
||||
|
||||
self.figureAxis.clear()
|
||||
lc.plot(label=label, ax=self.figureAxis)
|
||||
self.figure.canvas.draw_idle()
|
||||
Reference in New Issue
Block a user