Compare commits

...

2 Commits

Author SHA1 Message Date
SGCMarkus 9afe0993f6 generate_plots: fix flare number 2025-05-31 16:53:17 +02:00
SGCMarkus c1c58746e9 FlareSummaryPlotGUI: bring up to date 2025-05-31 16:52:41 +02:00
2 changed files with 95 additions and 192 deletions
+29 -28
View File
@@ -342,8 +342,6 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
Ffilter &= showSourceFilter Ffilter &= showSourceFilter
finalDataMaxFlarePeak = pd.concat([finalDataMaxFlarePeak, data[Ffilter]], ignore_index=True) finalDataMaxFlarePeak = pd.concat([finalDataMaxFlarePeak, data[Ffilter]], ignore_index=True)
numStars = len(set(finalDataMaxFlarePeak["StarName"]))
pdcsapbinningDataU = [] pdcsapbinningDataU = []
pdcsapbinningDataO = [] pdcsapbinningDataO = []
locFolderU = f"{folderPath}/{''.join(combo)}/maxFlarePeaks/{maxFlarePeak}/" locFolderU = f"{folderPath}/{''.join(combo)}/maxFlarePeaks/{maxFlarePeak}/"
@@ -385,6 +383,7 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
csvFileO.close() csvFileO.close()
if(len(pdcsapbinningDataU) > 0): if(len(pdcsapbinningDataU) > 0):
pdcsapbinningDataU = pd.DataFrame(pdcsapbinningDataU) pdcsapbinningDataU = pd.DataFrame(pdcsapbinningDataU)
numStarsFlarePeakU = len(set(pdcsapbinningDataU["StarName"]))
PDCSAPdataListU = [] PDCSAPdataListU = []
PDCSAPlabelListU = [] PDCSAPlabelListU = []
PDCSAPcolorListU = [] PDCSAPcolorListU = []
@@ -426,13 +425,13 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
xData, yData, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhaseU, PDCSAPdataList2dhistPeakU, xData, yData, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhaseU, PDCSAPdataList2dhistPeakU,
pdcsapbinningDataU, "PDCSAPNormPhase") pdcsapbinningDataU, "PDCSAPNormPhase")
generatePlots(PDCSAPdataListU, PDCSAPlabelListU, PDCSAPcolorListU, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins ({numStars} stars)", f"{locFolderU}/{''.join(combo)}_maxFlarePeak_{maxFlarePeak}-Flarecount-@bins_Bins.png", generatePlots(PDCSAPdataListU, PDCSAPlabelListU, PDCSAPcolorListU, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins ({numStarsFlarePeakU} stars)", f"{locFolderU}/{''.join(combo)}_maxFlarePeak_{maxFlarePeak}-Flarecount-@bins_Bins.png",
xData, yData, f"Flare peak per phase histogram of {', '.join(combo)} type stars with @bins bins ({numStars} stars)", f"{locFolderU}/{''.join(combo)}_maxFlarePeak_{maxFlarePeak}-Flarepeaks-@bins_Bins_maxY-@maxY.png", xData, yData, f"Flare peak per phase histogram of {', '.join(combo)} type stars with @bins bins ({numStarsFlarePeakU} stars)", f"{locFolderU}/{''.join(combo)}_maxFlarePeak_{maxFlarePeak}-Flarepeaks-@bins_Bins_maxY-@maxY.png",
pdcsapbinningDataU, plotFiltersU, PDCSAPlabelListU, PDCSAPcolorListU, f"Flare peaks per phase of {', '.join(combo)} type stars ({numStars} stars)", f"{locFolderU}/{''.join(combo)}_maxFlarePeak_{maxFlarePeak}-Flarepeaks_maxY-@maxY.png") pdcsapbinningDataU, plotFiltersU, PDCSAPlabelListU, PDCSAPcolorListU, f"Flare peaks per phase of {', '.join(combo)} type stars ({numStarsFlarePeakU} stars)", f"{locFolderU}/{''.join(combo)}_maxFlarePeak_{maxFlarePeak}-Flarepeaks_maxY-@maxY.png")
if(len(pdcsapbinningDataO) > 0): if(len(pdcsapbinningDataO) > 0):
pdcsapbinningDataO = pd.DataFrame(pdcsapbinningDataO) pdcsapbinningDataO = pd.DataFrame(pdcsapbinningDataO)
numStarsFlarePeakO = len(set(pdcsapbinningDataO["StarName"]))
PDCSAPdataListO = [] PDCSAPdataListO = []
PDCSAPlabelListO = [] PDCSAPlabelListO = []
PDCSAPcolorListO = [] PDCSAPcolorListO = []
@@ -474,9 +473,9 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
xData, yData, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhaseO, PDCSAPdataList2dhistPeakO, xData, yData, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhaseO, PDCSAPdataList2dhistPeakO,
pdcsapbinningDataO, "PDCSAPNormPhase") pdcsapbinningDataO, "PDCSAPNormPhase")
generatePlots(PDCSAPdataListO, PDCSAPlabelListO, PDCSAPcolorListO, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins ({numStars} stars)", f"{locFolderO}/{''.join(combo)}_minFlarePeak_{maxFlarePeak}-Flarecount-@bins_Bins.png", generatePlots(PDCSAPdataListO, PDCSAPlabelListO, PDCSAPcolorListO, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins ({numStarsFlarePeakO} stars)", f"{locFolderO}/{''.join(combo)}_minFlarePeak_{maxFlarePeak}-Flarecount-@bins_Bins.png",
xData, yData, f"Flare peak per phase histogram of {', '.join(combo)} type stars with @bins bins ({numStars} stars)", f"{locFolderO}/{''.join(combo)}_minFlarePeak_{maxFlarePeak}-Flarepeaks-@bins_Bins_maxY-@maxY.png", xData, yData, f"Flare peak per phase histogram of {', '.join(combo)} type stars with @bins bins ({numStarsFlarePeakO} stars)", f"{locFolderO}/{''.join(combo)}_minFlarePeak_{maxFlarePeak}-Flarepeaks-@bins_Bins_maxY-@maxY.png",
pdcsapbinningDataO, plotFiltersO, PDCSAPlabelListO, PDCSAPcolorListO, f"Flare peaks per phase of {', '.join(combo)} type stars ({numStars} stars)", f"{locFolderO}/{''.join(combo)}_minFlarePeak_{maxFlarePeak}-Flarepeaks_maxY-@maxY.png") pdcsapbinningDataO, plotFiltersO, PDCSAPlabelListO, PDCSAPcolorListO, f"Flare peaks per phase of {', '.join(combo)} type stars ({numStarsFlarePeakO} stars)", f"{locFolderO}/{''.join(combo)}_minFlarePeak_{maxFlarePeak}-Flarepeaks_maxY-@maxY.png")
# all flare peaks # all flare peaks
finalDataAllFlarePeaks = pd.DataFrame() finalDataAllFlarePeaks = pd.DataFrame()
if("M" in combo): if("M" in combo):
@@ -496,8 +495,6 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
Ffilter &= showSourceFilter Ffilter &= showSourceFilter
finalDataAllFlarePeaks = pd.concat([finalDataAllFlarePeaks, data[Ffilter]], ignore_index=True) finalDataAllFlarePeaks = pd.concat([finalDataAllFlarePeaks, data[Ffilter]], ignore_index=True)
numStars = len(set(finalDataAllFlarePeaks["StarName"]))
pdcsapbinningData = [] pdcsapbinningData = []
locFolder = f"{folderPath}/{''.join(combo)}/" locFolder = f"{folderPath}/{''.join(combo)}/"
mkdir_p(f"{locFolder}/") mkdir_p(f"{locFolder}/")
@@ -522,6 +519,7 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
csvFile.close() csvFile.close()
if(len(pdcsapbinningData) > 0): if(len(pdcsapbinningData) > 0):
pdcsapbinningData = pd.DataFrame(pdcsapbinningData) pdcsapbinningData = pd.DataFrame(pdcsapbinningData)
numStarsAllFLarePeaks = len(set(pdcsapbinningData["StarName"]))
PDCSAPdataList = [] PDCSAPdataList = []
PDCSAPlabelList = [] PDCSAPlabelList = []
PDCSAPcolorList = [] PDCSAPcolorList = []
@@ -567,9 +565,9 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
pdcsapbinningData, "PDCSAPNormPhase",) pdcsapbinningData, "PDCSAPNormPhase",)
plotdata = pdcsapbinningData plotdata = pdcsapbinningData
filters = plotFilters filters = plotFilters
generatePlots(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins ({numStars} stars)", f"{locFolder}/{''.join(combo)}-Flarecount-@bins_Bins.png", generatePlots(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins ({numStarsAllFLarePeaks} stars)", f"{locFolder}/{''.join(combo)}-Flarecount-@bins_Bins.png",
xData, yData, f"Flare peak per phase histogram of {', '.join(combo)} type stars with @bins bins ({numStars} stars)", f"{locFolder}/{''.join(combo)}-Flarepeaks-@bins_Bins_maxY-@maxY.png", xData, yData, f"Flare peak per phase histogram of {', '.join(combo)} type stars with @bins bins ({numStarsAllFLarePeaks} stars)", f"{locFolder}/{''.join(combo)}-Flarepeaks-@bins_Bins_maxY-@maxY.png",
plotdata, filters, PDCSAPlabelList, PDCSAPcolorList, f"Flare peaks per phase of {', '.join(combo)} type stars ({numStars} stars)", f"{locFolder}/{''.join(combo)}-Flarepeaks_maxY-@maxY.png") plotdata, filters, PDCSAPlabelList, PDCSAPcolorList, f"Flare peaks per phase of {', '.join(combo)} type stars ({numStarsAllFLarePeaks} stars)", f"{locFolder}/{''.join(combo)}-Flarepeaks_maxY-@maxY.png")
if(len(combo) == 1): if(len(combo) == 1):
mainSpType = combo[0] mainSpType = combo[0]
@@ -588,7 +586,6 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
finalDataAccSpTypes = pd.DataFrame() finalDataAccSpTypes = pd.DataFrame()
typeFilter = data["SpType"].str.startswith(spTyp) typeFilter = data["SpType"].str.startswith(spTyp)
numStars = len(set(data[typeFilter]["StarName"]))
typeFilter &= showSourceFilter typeFilter &= showSourceFilter
finalDataAccSpTypes = pd.concat([finalDataAccSpTypes, data[typeFilter]], ignore_index=True) finalDataAccSpTypes = pd.concat([finalDataAccSpTypes, data[typeFilter]], ignore_index=True)
@@ -615,6 +612,7 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
csvFile.close() csvFile.close()
if(len(pdcsapbinningData) > 0): if(len(pdcsapbinningData) > 0):
pdcsapbinningData = pd.DataFrame(pdcsapbinningData) pdcsapbinningData = pd.DataFrame(pdcsapbinningData)
numStarsAccSpType = len(set(pdcsapbinningData[typeFilter]["StarName"]))
PDCSAPdataList = [] PDCSAPdataList = []
PDCSAPlabelList = [] PDCSAPlabelList = []
PDCSAPcolorList = [] PDCSAPcolorList = []
@@ -637,9 +635,9 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
plotdata = pdcsapbinningData plotdata = pdcsapbinningData
filters = SpTypefilter filters = SpTypefilter
generatePlots(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, f"Flare count in phase of {spTyp} type stars with @bins bins ({numStars} stars)", f"{locFolder}/{''.join(spTyp)}-Flarecount-@bins_Bins.png", generatePlots(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, f"Flare count in phase of {spTyp} type stars with @bins bins ({numStarsAccSpType} stars)", f"{locFolder}/{''.join(spTyp)}-Flarecount-@bins_Bins.png",
xData, yData, f"Flare peak per phase histogram of {spTyp} type stars with @bins bins ({numStars} stars)", f"{locFolder}/{''.join(spTyp)}-Flarepeaks-@bins_Bins_maxY-@maxY.png", xData, yData, f"Flare peak per phase histogram of {spTyp} type stars with @bins bins ({numStarsAccSpType} stars)", f"{locFolder}/{''.join(spTyp)}-Flarepeaks-@bins_Bins_maxY-@maxY.png",
plotdata, filters, PDCSAPlabelList[0], PDCSAPcolorList[0], f"Flare peaks per phase of {spTyp} type stars ({numStars} stars)", f"{locFolder}/{''.join(spTyp)}-Flarepeaks_maxY-@maxY.png") plotdata, filters, PDCSAPlabelList[0], PDCSAPcolorList[0], f"Flare peaks per phase of {spTyp} type stars ({numStarsAccSpType} stars)", f"{locFolder}/{''.join(spTyp)}-Flarepeaks_maxY-@maxY.png")
# per Period # per Period
for periodCut in periodsCutList: for periodCut in periodsCutList:
@@ -707,6 +705,9 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
PDCSAPdataList2dhistPhaseO = []; PDCSAPdataList2dhistPeakO = [] PDCSAPdataList2dhistPhaseO = []; PDCSAPdataList2dhistPeakO = []
plotFiltersU = []; plotFiltersO = []; plotFiltersU = []; plotFiltersO = [];
numStarsPeriodU = len(set(pdcsapbinningDataU[typeFilter]["StarName"]))
numStarsPeriodO = len(set(pdcsapbinningDataO[typeFilter]["StarName"]))
if("M" in combo): if("M" in combo):
PDCSAPlabelList.append("M Stars") PDCSAPlabelList.append("M Stars")
PDCSAPcolorList.append("red") PDCSAPcolorList.append("red")
@@ -776,17 +777,17 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
xDataU, yDataU, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhaseU, PDCSAPdataList2dhistPeakU, xDataU, yDataU, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhaseU, PDCSAPdataList2dhistPeakU,
pdcsapbinningDataU, "PDCSAPNormPhase",) pdcsapbinningDataU, "PDCSAPNormPhase",)
if(len(PDCSAPdataListU) > 0 and len(xDataU) > 0 and len(yDataU) > 0): if(len(PDCSAPdataListU) > 0 and len(xDataU) > 0 and len(yDataU) > 0):
generatePlots(PDCSAPdataListU, PDCSAPlabelList, PDCSAPcolorList, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins (Rot. Period under {periodCut} days)", f"{locFolder}/{''.join(combo)}-Flarecount-Period_u_{periodCut}-@bins_Bins.png", generatePlots(PDCSAPdataListU, PDCSAPlabelList, PDCSAPcolorList, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins (Rot. Period under {periodCut} days, {numStarsPeriodU} stars)", f"{locFolder}/{''.join(combo)}-Flarecount-Period_u_{periodCut}-@bins_Bins.png",
xDataU, yDataU, f"Flare peak per phase histogram of {', '.join(combo)} type stars with @bins bins (Rot. Period under {periodCut} days)", f"{locFolder}/{''.join(combo)}-Flarepeaks-Period_u_{periodCut}-@bins_Bins_maxY-@maxY.png", xDataU, yDataU, f"Flare peak per phase histogram of {', '.join(combo)} type stars with @bins bins (Rot. Period under {periodCut} days, {numStarsPeriodU} stars)", f"{locFolder}/{''.join(combo)}-Flarepeaks-Period_u_{periodCut}-@bins_Bins_maxY-@maxY.png",
pdcsapbinningDataU, plotFiltersU, PDCSAPlabelList, PDCSAPcolorList, f"Flare peaks per phase of {', '.join(combo)} type stars (Rot. Period under {periodCut} days)", f"{locFolder}/{''.join(combo)}-Flarepeaks-Period_u_{periodCut}-maxY_@maxY.png") pdcsapbinningDataU, plotFiltersU, PDCSAPlabelList, PDCSAPcolorList, f"Flare peaks per phase of {', '.join(combo)} type stars (Rot. Period under {periodCut} days, {numStarsPeriodU} stars)", f"{locFolder}/{''.join(combo)}-Flarepeaks-Period_u_{periodCut}-maxY_@maxY.png")
if(len(PDCSAPdataList2dhistPhaseO) > 0 and len(PDCSAPdataList2dhistPeakO) > 0): if(len(PDCSAPdataList2dhistPhaseO) > 0 and len(PDCSAPdataList2dhistPeakO) > 0):
xDataO, yDataO, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhaseO, PDCSAPdataList2dhistPeakO, xDataO, yDataO, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhaseO, PDCSAPdataList2dhistPeakO,
pdcsapbinningDataO, "PDCSAPNormPhase",) pdcsapbinningDataO, "PDCSAPNormPhase",)
if(len(PDCSAPdataListO) > 0 and len(xDataO) > 0 and len(yDataO) > 0): if(len(PDCSAPdataListO) > 0 and len(xDataO) > 0 and len(yDataO) > 0):
generatePlots(PDCSAPdataListO, PDCSAPlabelList, PDCSAPcolorList, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins (Rot. Period over {periodCut} days)", f"{locFolder}/{''.join(combo)}-Flarecount-Period_o_{periodCut}-@bins_Bins.png", generatePlots(PDCSAPdataListO, PDCSAPlabelList, PDCSAPcolorList, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins (Rot. Period over {periodCut} days, {numStarsPeriodO} stars)", f"{locFolder}/{''.join(combo)}-Flarecount-Period_o_{periodCut}-@bins_Bins.png",
xDataO, yDataO, f"Flare peak per phase histogram of {', '.join(combo)} type stars with @bins bins (Rot. Period over {periodCut} days)", f"{locFolder}/{''.join(combo)}-Flarepeaks-Period_o_{periodCut}-@bins_Bins_maxY-@maxY.png", xDataO, yDataO, f"Flare peak per phase histogram of {', '.join(combo)} type stars with @bins bins (Rot. Period over {periodCut} days, {numStarsPeriodO} stars)", f"{locFolder}/{''.join(combo)}-Flarepeaks-Period_o_{periodCut}-@bins_Bins_maxY-@maxY.png",
pdcsapbinningDataO, plotFiltersO, PDCSAPlabelList, PDCSAPcolorList, f"Flare peaks per phase of {', '.join(combo)} type stars (Rot. Period over {periodCut} days)", f"{locFolder}/{''.join(combo)}-Flarepeaks-Period_o_{periodCut}-maxY_@maxY.png") pdcsapbinningDataO, plotFiltersO, PDCSAPlabelList, PDCSAPcolorList, f"Flare peaks per phase of {', '.join(combo)} type stars (Rot. Period over {periodCut} days, {numStarsPeriodO} stars)", f"{locFolder}/{''.join(combo)}-Flarepeaks-Period_o_{periodCut}-maxY_@maxY.png")
binList = [10, 20, 30] binList = [10, 20, 30]
spType = ["M", "K", "G", "F"] spType = ["M", "K", "G", "F"]
@@ -851,11 +852,11 @@ if __name__ == "__main__":
data = pd.merge(data, validStarPeriodMap, on="StarName") data = pd.merge(data, validStarPeriodMap, on="StarName")
starPlotFunc = partial(plotStar, data, showSourceFilter, folderPath) #starPlotFunc = partial(plotStar, data, showSourceFilter, folderPath)
list(pool.map(starPlotFunc, allStars)) # wrap in list, to force evaluation #list(pool.map(starPlotFunc, allStars)) # wrap in list, to force evaluation
starPlotPeriodFunc = partial(plotStarPeriod, dataPeriod, showSourceFilter, folderPath) #starPlotPeriodFunc = partial(plotStarPeriod, dataPeriod, showSourceFilter, folderPath)
list(pool.map(starPlotPeriodFunc, allStars)) # wrap in list, to force evaluation #list(pool.map(starPlotPeriodFunc, allStars)) # wrap in list, to force evaluation
combos = [] combos = []
for comboLength in range(1, len(spType) + 1): for comboLength in range(1, len(spType) + 1):
+66 -164
View File
@@ -120,7 +120,7 @@ class FlareSummaryPlotGUI(QWidget):
self.cbSpTypeUnknown.setChecked(False) self.cbSpTypeUnknown.setChecked(False)
self.cbShowSAP = QCheckBox("SAP") self.cbShowSAP = QCheckBox("SAP")
self.cbShowSAP.setChecked(True) self.cbShowSAP.setChecked(False)
self.cbShowPDCSAP = QCheckBox("PDCSAP") self.cbShowPDCSAP = QCheckBox("PDCSAP")
self.cbShowPDCSAP.setChecked(True) self.cbShowPDCSAP.setChecked(True)
@@ -129,12 +129,12 @@ class FlareSummaryPlotGUI(QWidget):
self.buttonGridLayout.addWidget(self.btShowFlaresPerStar, 0, 2) self.buttonGridLayout.addWidget(self.btShowFlaresPerStar, 0, 2)
self.buttonGridLayout.addWidget(self.btShowFlaresPerStarNormalized, 0, 3) self.buttonGridLayout.addWidget(self.btShowFlaresPerStarNormalized, 0, 3)
self.buttonGridLayout.addWidget(self.btShowPeriods, 0, 4) self.buttonGridLayout.addWidget(self.btShowPeriods, 0, 4)
self.buttonGridLayout.addWidget(self.btNumMinimaMaxima, 0, 5) #self.buttonGridLayout.addWidget(self.btNumMinimaMaxima, 0, 5)
self.buttonGridLayout.addWidget(self.btNumMinimaMaximaNorm, 0, 6) #self.buttonGridLayout.addWidget(self.btNumMinimaMaximaNorm, 0, 6)
self.buttonGridLayout.addWidget(self.btShowFlaresInMinimaMaxima, 0, 7) #self.buttonGridLayout.addWidget(self.btShowFlaresInMinimaMaxima, 0, 7)
self.buttonGridLayout.addWidget(self.btShowFlaresInMinimaMaximaPerMinimaMaxima, 0, 8) #self.buttonGridLayout.addWidget(self.btShowFlaresInMinimaMaximaPerMinimaMaxima, 0, 8)
self.buttonGridLayout.addWidget(self.btShowFlaresBinnedOnPhase, 0, 9) #self.buttonGridLayout.addWidget(self.btShowFlaresBinnedOnPhase, 0, 9)
self.buttonGridLayout.addWidget(self.textNumBins, 0, 10) #self.buttonGridLayout.addWidget(self.textNumBins, 0, 10)
self.buttonGridLayout.addWidget(QLabel("Sources: "), 1, 0) self.buttonGridLayout.addWidget(QLabel("Sources: "), 1, 0)
self.buttonGridLayout.addWidget(self.cbKepler, 1, 1) self.buttonGridLayout.addWidget(self.cbKepler, 1, 1)
@@ -149,7 +149,7 @@ class FlareSummaryPlotGUI(QWidget):
self.buttonGridLayout.addWidget(self.cbSpTypeF, 2, 4) self.buttonGridLayout.addWidget(self.cbSpTypeF, 2, 4)
#self.buttonGridLayout.addWidget(self.cbSpTypeUnknown, 2, 6) #self.buttonGridLayout.addWidget(self.cbSpTypeUnknown, 2, 6)
self.buttonGridLayout.addWidget(self.cbShowSAP, 3, 0) #self.buttonGridLayout.addWidget(self.cbShowSAP, 3, 0)
self.buttonGridLayout.addWidget(self.cbShowPDCSAP, 3, 1) self.buttonGridLayout.addWidget(self.cbShowPDCSAP, 3, 1)
self.mainLayout.addLayout(self.buttonGridLayout) self.mainLayout.addLayout(self.buttonGridLayout)
@@ -243,27 +243,7 @@ class FlareSummaryPlotGUI(QWidget):
self.figure.canvas.draw_idle() self.figure.canvas.draw_idle()
def btShowFlaresPerStarClicked(self): def btShowFlaresPerStarClicked(self):
data = self.starFLareDictList.drop(columns=['Distance', data = self.starFLareDictList
'DistanceUnit',
'FilePath',
'RotVel',
'RotVelUnit',
'Sequence',
'pdcsapFits',
'pdcsapPeaks',
'sapFits',
'sapPeaks',
'sapPeriod',
'sapPeriodMinima',
'sapPeriodMinimaBoundaries',
'sapPeriodMaxima',
'sapPeriodMaximaBoundaries',
'pdcsapValidTimespans',
'pdcsapPeriod',
'pdcsapPeriodMinima',
'pdcsapPeriodMinimaBoundaries',
'pdcsapPeriodMaxima',
'pdcsapPeriodMaximaBoundaries'])
showSourceFilter = np.full(len(data), False) showSourceFilter = np.full(len(data), False)
@@ -277,9 +257,14 @@ class FlareSummaryPlotGUI(QWidget):
showTESS = data["Source"] == "TESS" showTESS = data["Source"] == "TESS"
showSourceFilter |= showTESS showSourceFilter |= showTESS
aggDic = {}
if(self.cbShowSAP.isChecked()):
aggDic["sapPeaksCount"] = "sum"
if(self.cbShowPDCSAP.isChecked()):
aggDic["pdcsapPeaksCount"] = "sum"
data = data[showSourceFilter].groupby(["StarName", "SpType"], data = data[showSourceFilter].groupby(["StarName", "SpType"],
as_index=False).agg({"sapPeaksCount": "sum", as_index=False).agg(aggDic)
"pdcsapPeaksCount": "sum"})
x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int) x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int)
if(self.cbSpTypeL.isChecked()): if(self.cbSpTypeL.isChecked()):
@@ -345,28 +330,7 @@ class FlareSummaryPlotGUI(QWidget):
self.figure.canvas.draw_idle() self.figure.canvas.draw_idle()
def btShowFlaresPerStarNormalizedClicked(self): def btShowFlaresPerStarNormalizedClicked(self):
data = self.starFLareDictList.drop(columns=['Distance', data = self.starFLareDictList
'DistanceUnit',
'FilePath',
'RotVel',
'RotVelUnit',
'Sequence',
'pdcsapFits',
'pdcsapPeaks',
'sapFits',
'sapValidTimespans',
'sapPeaks',
'sapPeriod',
'sapPeriodMinima',
'sapPeriodMinimaBoundaries',
'sapPeriodMaxima',
'sapPeriodMaximaBoundaries',
'pdcsapValidTimespans',
'pdcsapPeriod',
'pdcsapPeriodMinima',
'pdcsapPeriodMinimaBoundaries',
'pdcsapPeriodMaxima',
'pdcsapPeriodMaximaBoundaries'])
showSourceFilter = np.full(len(data), False) showSourceFilter = np.full(len(data), False)
@@ -380,11 +344,16 @@ class FlareSummaryPlotGUI(QWidget):
showTESS = data["Source"] == "TESS" showTESS = data["Source"] == "TESS"
showSourceFilter |= showTESS showSourceFilter |= showTESS
aggDic = {}
if(self.cbShowSAP.isChecked()):
aggDic["sapPeaksCount"] = "sum"
aggDic["sapValidSeconds"] = "sum"
if(self.cbShowPDCSAP.isChecked()):
aggDic["pdcsapPeaksCount"] = "sum"
aggDic["pdcsapValidSeconds"] = "sum"
data = data[showSourceFilter].groupby(["StarName", "SpType"], data = data[showSourceFilter].groupby(["StarName", "SpType"],
as_index=False).agg({"sapPeaksCount": "sum", as_index=False).agg(aggDic)
"pdcsapPeaksCount": "sum",
"sapValidSeconds": "sum",
"pdcsapValidSeconds": "sum"})
x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int) x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int)
if(self.cbSpTypeL.isChecked()): if(self.cbSpTypeL.isChecked()):
@@ -462,30 +431,7 @@ class FlareSummaryPlotGUI(QWidget):
self.figure.canvas.draw_idle() self.figure.canvas.draw_idle()
def btShowPeriodsClicked(self): def btShowPeriodsClicked(self):
data = self.starFLareDictList.drop(columns=['Distance', data = self.starFLareDictList
'DistanceUnit',
'FilePath',
'RotVel',
'RotVelUnit',
'Sequence',
'pdcsapFits',
'pdcsapPeaks',
'sapFits',
'sapValidTimespans',
'sapPeaks',
'sapPeriodMinima',
'sapPeriodMinimaBoundaries',
'sapPeriodMaxima',
'sapPeriodMaximaBoundaries',
'pdcsapValidTimespans',
'pdcsapPeriodMinima',
'pdcsapPeriodMinimaBoundaries',
'pdcsapPeriodMaxima',
'pdcsapPeriodMaximaBoundaries',
'sapPeaksCount',
'pdcsapPeaksCount',
'sapValidSeconds',
'pdcsapValidSeconds'])
showSourceFilter = np.full(len(data), False) showSourceFilter = np.full(len(data), False)
@@ -499,11 +445,14 @@ class FlareSummaryPlotGUI(QWidget):
showTESS = data["Source"] == "TESS" showTESS = data["Source"] == "TESS"
showSourceFilter |= showTESS showSourceFilter |= showTESS
print(data["sapPeriod"]) aggDic = {}
if(self.cbShowSAP.isChecked()):
aggDic["sapPeriod"] = "sum"
if(self.cbShowPDCSAP.isChecked()):
aggDic["pdcsapPeriod"] = "sum"
data = data[showSourceFilter].groupby(["StarName", "SpType"], data = data[showSourceFilter].groupby(["StarName", "SpType"],
as_index=False).agg({"sapPeriod": "mean", as_index=False).agg(aggDic)
"pdcsapPeriod": "mean"})
x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int) x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int)
if(self.cbSpTypeL.isChecked()): if(self.cbSpTypeL.isChecked()):
@@ -582,20 +531,7 @@ class FlareSummaryPlotGUI(QWidget):
pass pass
def btShowNumMinimaMaximaClicked(self): def btShowNumMinimaMaximaClicked(self):
data = self.starFLareDictList.drop(columns=['Distance', data = self.starFLareDictList
'DistanceUnit',
'FilePath',
'RotVel',
'RotVelUnit',
'Sequence',
'pdcsapFits',
'sapFits',
'sapValidTimespans',
'pdcsapValidTimespans',
'sapPeaksCount',
'pdcsapPeaksCount',
'sapValidSeconds',
'pdcsapValidSeconds'])
showSourceFilter = np.full(len(data), False) showSourceFilter = np.full(len(data), False)
@@ -609,13 +545,15 @@ class FlareSummaryPlotGUI(QWidget):
showTESS = data["Source"] == "TESS" showTESS = data["Source"] == "TESS"
showSourceFilter |= showTESS showSourceFilter |= showTESS
print(data["sapPeriod"]) aggDic = {}
if(self.cbShowSAP.isChecked()):
aggDic["sapPeriodMinima"] = "sum"
aggDic["sapPeriodMaxima"] = "sum"
if(self.cbShowPDCSAP.isChecked()):
aggDic["pdcsapPeriodMinima"] = "sum"
aggDic["pdcsapPeriodMaxima"] = "sum"
data = data[showSourceFilter].groupby(["StarName", "SpType"], data = data[showSourceFilter].groupby(["StarName", "SpType"],
as_index=False).agg({"sapPeriodMinima": sumArrayLengths, as_index=False).agg(aggDic)
"sapPeriodMaxima": sumArrayLengths,
"pdcsapPeriodMinima": sumArrayLengths,
"pdcsapPeriodMaxima": sumArrayLengths})
x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int) x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int)
if(self.cbSpTypeL.isChecked()): if(self.cbSpTypeL.isChecked()):
@@ -718,20 +656,7 @@ class FlareSummaryPlotGUI(QWidget):
pass pass
def btShowNumMinimaMaximaNormalizedClicked(self): def btShowNumMinimaMaximaNormalizedClicked(self):
data = self.starFLareDictList.drop(columns=['Distance', data = self.starFLareDictList
'DistanceUnit',
'FilePath',
'RotVel',
'RotVelUnit',
'Sequence',
'pdcsapFits',
'sapFits',
'sapValidTimespans',
'pdcsapValidTimespans',
'sapPeaksCount',
'pdcsapPeaksCount',
'sapValidSeconds',
'pdcsapValidSeconds'])
showSourceFilter = np.full(len(data), False) showSourceFilter = np.full(len(data), False)
@@ -745,13 +670,15 @@ class FlareSummaryPlotGUI(QWidget):
showTESS = data["Source"] == "TESS" showTESS = data["Source"] == "TESS"
showSourceFilter |= showTESS showSourceFilter |= showTESS
print(data["sapPeriod"]) aggDic = {}
if(self.cbShowSAP.isChecked()):
aggDic["sapPeriodMinima"] = "sum"
aggDic["sapPeriodMaxima"] = "sum"
if(self.cbShowPDCSAP.isChecked()):
aggDic["pdcsapPeriodMinima"] = "sum"
aggDic["pdcsapPeriodMaxima"] = "sum"
data = data[showSourceFilter].groupby(["StarName", "SpType"], data = data[showSourceFilter].groupby(["StarName", "SpType"],
as_index=False).agg({"sapPeriodMinima": sumArrayLengthsNorm, as_index=False).agg(aggDic)
"sapPeriodMaxima": sumArrayLengthsNorm,
"pdcsapPeriodMinima": sumArrayLengthsNorm,
"pdcsapPeriodMaxima": sumArrayLengthsNorm})
x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int) x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int)
if(self.cbSpTypeL.isChecked()): if(self.cbSpTypeL.isChecked()):
@@ -854,20 +781,7 @@ class FlareSummaryPlotGUI(QWidget):
pass pass
def btShowFlaresInMinimaMaximaClicked(self): def btShowFlaresInMinimaMaximaClicked(self):
data = self.starFLareDictList.drop(columns=['Distance', data = self.starFLareDictList
'DistanceUnit',
'FilePath',
'RotVel',
'RotVelUnit',
'Sequence',
'pdcsapFits',
'sapFits',
'sapValidTimespans',
'pdcsapValidTimespans',
'sapPeaksCount',
'pdcsapPeaksCount',
'sapValidSeconds',
'pdcsapValidSeconds'])
showSourceFilter = np.full(len(data), False) showSourceFilter = np.full(len(data), False)
@@ -881,8 +795,6 @@ class FlareSummaryPlotGUI(QWidget):
showTESS = data["Source"] == "TESS" showTESS = data["Source"] == "TESS"
showSourceFilter |= showTESS showSourceFilter |= showTESS
print(data["sapPeriod"])
finalData = [] finalData = []
#data = data[showSourceFilter].groupby(["StarName", "SpType"], #data = data[showSourceFilter].groupby(["StarName", "SpType"],
# as_index=False).agg({"sapPeriod": "mean", # as_index=False).agg({"sapPeriod": "mean",
@@ -1011,20 +923,7 @@ class FlareSummaryPlotGUI(QWidget):
pass pass
def btShowFlaresInMinimaMaximaPerMinimaMaximaClicked(self): def btShowFlaresInMinimaMaximaPerMinimaMaximaClicked(self):
data = self.starFLareDictList.drop(columns=['Distance', data = self.starFLareDictList
'DistanceUnit',
'FilePath',
'RotVel',
'RotVelUnit',
'Sequence',
'pdcsapFits',
'sapFits',
'sapValidTimespans',
'pdcsapValidTimespans',
'sapPeaksCount',
'pdcsapPeaksCount',
'sapValidSeconds',
'pdcsapValidSeconds'])
showSourceFilter = np.full(len(data), False) showSourceFilter = np.full(len(data), False)
@@ -1038,8 +937,6 @@ class FlareSummaryPlotGUI(QWidget):
showTESS = data["Source"] == "TESS" showTESS = data["Source"] == "TESS"
showSourceFilter |= showTESS showSourceFilter |= showTESS
print(data["sapPeriod"])
finalData = [] finalData = []
for ind, row in data[showSourceFilter].reset_index().iterrows(): for ind, row in data[showSourceFilter].reset_index().iterrows():
minimaCountSAP = getNumFlaresInBounds(row["sapFoldedPeaksPhasePair"], minimaCountSAP = getNumFlaresInBounds(row["sapFoldedPeaksPhasePair"],
@@ -1056,15 +953,20 @@ class FlareSummaryPlotGUI(QWidget):
"minimaCountPDCSAP": minimaCountPDCSAP, "maximaCountPDCSAP": maximaCountPDCSAP, "minimaCountPDCSAP": minimaCountPDCSAP, "maximaCountPDCSAP": maximaCountPDCSAP,
"minimasPDCSAP": len(row["pdcsapPeriodMinima"]), "maximasPDCSAP": len(row["pdcsapPeriodMaxima"])}) "minimasPDCSAP": len(row["pdcsapPeriodMinima"]), "maximasPDCSAP": len(row["pdcsapPeriodMaxima"])})
aggDic = {}
if(self.cbShowSAP.isChecked()):
aggDic["minimaCountSAP"] = "sum"
aggDic["maximaCountSAP"] = "sum"
aggDic["minimasSAP"] = "sum"
aggDic["maximasSAP"] = "sum"
if(self.cbShowPDCSAP.isChecked()):
aggDic["minimaCountPDCSAP"] = "sum"
aggDic["maximaCountPDCSAP"] = "sum"
aggDic["minimasPDCSAP"] = "sum"
aggDic["maximasPDCSAP"] = "sum"
data = pd.DataFrame(finalData).groupby(["StarName", "SpType"], data = pd.DataFrame(finalData).groupby(["StarName", "SpType"],
as_index=False).agg({"minimaCountSAP": "sum", as_index=False).agg(aggDic)
"maximaCountSAP": "sum",
"minimasSAP": "sum",
"maximasSAP": "sum",
"minimaCountPDCSAP": "sum",
"maximaCountPDCSAP": "sum",
"minimasPDCSAP": "sum",
"maximasPDCSAP": "sum"})
x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int) x = np.arange(start=1, stop=len(data)+1, step=1, dtype=int)
if(self.cbSpTypeL.isChecked()): if(self.cbSpTypeL.isChecked()):