|
|
|
@@ -85,7 +85,7 @@ def plotBinsHistogram(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, bins, ti
|
|
|
|
|
axHisto.set_title(title, wrap=True)
|
|
|
|
|
axHisto.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
|
|
|
|
|
axHisto.xaxis.set_major_locator(MaxNLocator(5))
|
|
|
|
|
axHisto.legend()
|
|
|
|
|
axHisto.legend(loc="lower right")
|
|
|
|
|
|
|
|
|
|
axHistoPhase = axHisto.twinx()
|
|
|
|
|
if(foldedFits is None):
|
|
|
|
@@ -149,7 +149,7 @@ def plotFlarePeaks(plotdata, filters, labels, colors, maxY, title, filename):
|
|
|
|
|
axFlarePeaks.set_title(title, wrap=True)
|
|
|
|
|
axFlarePeaks.xaxis.set_major_formatter(tck.FormatStrFormatter('%g $\pi$'))
|
|
|
|
|
axFlarePeaks.xaxis.set_major_locator(MaxNLocator(5))
|
|
|
|
|
axFlarePeaks.legend()
|
|
|
|
|
axFlarePeaks.legend(loc="lower right")
|
|
|
|
|
plt.savefig(filename, bbox_inches="tight")
|
|
|
|
|
plt.close()
|
|
|
|
|
|
|
|
|
@@ -322,6 +322,101 @@ def plotStarPeriod(data, showSourceFilter, folderPath, starName):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def plotCombo(data, showSourceFilter, folderPath, combo):
|
|
|
|
|
# all flare peaks
|
|
|
|
|
finalDataAllFlarePeaks = pd.DataFrame()
|
|
|
|
|
if("M" in combo):
|
|
|
|
|
Mfilter = data["SpType"].str.startswith("M")
|
|
|
|
|
Mfilter &= showSourceFilter
|
|
|
|
|
finalDataAllFlarePeaks = pd.concat([finalDataAllFlarePeaks, data[Mfilter]], ignore_index=True)
|
|
|
|
|
if("K" in combo):
|
|
|
|
|
Kfilter = data["SpType"].str.startswith("K")
|
|
|
|
|
Kfilter &= showSourceFilter
|
|
|
|
|
finalDataAllFlarePeaks = pd.concat([finalDataAllFlarePeaks, data[Kfilter]], ignore_index=True)
|
|
|
|
|
if("G" in combo):
|
|
|
|
|
Gfilter = data["SpType"].str.startswith("G")
|
|
|
|
|
Gfilter &= showSourceFilter
|
|
|
|
|
finalDataAllFlarePeaks = pd.concat([finalDataAllFlarePeaks, data[Gfilter]], ignore_index=True)
|
|
|
|
|
if("F" in combo):
|
|
|
|
|
Ffilter = data["SpType"].str.startswith("F")
|
|
|
|
|
Ffilter &= showSourceFilter
|
|
|
|
|
finalDataAllFlarePeaks = pd.concat([finalDataAllFlarePeaks, data[Ffilter]], ignore_index=True)
|
|
|
|
|
|
|
|
|
|
pdcsapbinningDataAllFlarePeaks = []
|
|
|
|
|
locFolder = f"{folderPath}/{''.join(combo)}/"
|
|
|
|
|
mkdir_p(f"{locFolder}/")
|
|
|
|
|
csvFile = open(f"{locFolder}/{''.join(combo)}.csv", "a")
|
|
|
|
|
csvFile.write("Star Name,Spectral Type,Source,File,Flare Time,Flare Peak,Period,Normalized Phase of Peak,Peak in Period")
|
|
|
|
|
csvFile.write("\n")
|
|
|
|
|
for ind, row in finalDataAllFlarePeaks.reset_index().iterrows():
|
|
|
|
|
PDCSAPminOrigPhase = row["pdcsapFoldedFitPhaseStarEnd"][0]
|
|
|
|
|
PDCSAPmaxOrigPhase = row["pdcsapFoldedFitPhaseStarEnd"][1]
|
|
|
|
|
if(len(row["pdcsapFoldedPeaksPhasePair"]) > 0):
|
|
|
|
|
pdcsapVals = pd.DataFrame(row["pdcsapFoldedPeaksPhasePair"])
|
|
|
|
|
for td, peak, pv in zip(pdcsapVals["Phase"], pdcsapVals["Peak"], row["pdcsapPeaks"]):
|
|
|
|
|
normPhase = normalizePhase(td.value, np.abs(PDCSAPminOrigPhase), np.abs(PDCSAPmaxOrigPhase))
|
|
|
|
|
csvFile.write(f"{row['StarName']},{row['SpType']},{row['Source']},{row['FilePath']},{pv['FlarePeakTime']},{pv['FlarePeak']},{row['pdcsapPeriod']},{normPhase},{peak['FlarePeak']}")
|
|
|
|
|
csvFile.write("\n")
|
|
|
|
|
pdcsapbinningDataAllFlarePeaks.append({"SpType": row["SpType"][0],
|
|
|
|
|
"PDCSAPNormPhase": normPhase,
|
|
|
|
|
"Peak": peak["FlarePeak"],
|
|
|
|
|
"StarName": row['StarName']})
|
|
|
|
|
if(peak["FlarePeak"] > 100):
|
|
|
|
|
print(row["StarName"], "has over 100 peak")
|
|
|
|
|
|
|
|
|
|
csvFile.close()
|
|
|
|
|
if(len(pdcsapbinningDataAllFlarePeaks) > 0):
|
|
|
|
|
pdcsapbinningDataAllFlarePeaks = pd.DataFrame(pdcsapbinningDataAllFlarePeaks)
|
|
|
|
|
numStarsAllFLarePeaks = len(set(pdcsapbinningDataAllFlarePeaks["StarName"]))
|
|
|
|
|
pd.DataFrame(set(pdcsapbinningDataAllFlarePeaks["StarName"])).to_csv(f"{locFolder}/{''.join(combo)}_starlist.csv")
|
|
|
|
|
PDCSAPdataListDataAllFlarePeaks = []
|
|
|
|
|
PDCSAPlabelListDataAllFlarePeaks = []
|
|
|
|
|
PDCSAPcolorListDataAllFlarePeaks = []
|
|
|
|
|
PDCSAPdataList2dhistPhaseDataAllFlarePeaks = []
|
|
|
|
|
PDCSAPdataList2dhistPeakDataAllFlarePeaks = []
|
|
|
|
|
PDCSAPlabelList2dhistDataAllFlarePeaks = []
|
|
|
|
|
PDCSAPcolorList2dhistDataAllFlarePeaks = []
|
|
|
|
|
plotFiltersDataAllFlarePeaks = []
|
|
|
|
|
if("M" in combo):
|
|
|
|
|
MfilterDataAllFlarePeaks = pdcsapbinningDataAllFlarePeaks["SpType"] == "M"
|
|
|
|
|
PDCSAPdataList2dhistPhaseDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[MfilterDataAllFlarePeaks]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPdataList2dhistPeakDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[MfilterDataAllFlarePeaks]["Peak"])
|
|
|
|
|
PDCSAPdataListDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[MfilterDataAllFlarePeaks]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPlabelListDataAllFlarePeaks.append("M Stars")
|
|
|
|
|
PDCSAPcolorListDataAllFlarePeaks.append("red")
|
|
|
|
|
plotFiltersDataAllFlarePeaks.append(MfilterDataAllFlarePeaks)
|
|
|
|
|
if("K" in combo):
|
|
|
|
|
KfilterDataAllFlarePeaks = pdcsapbinningDataAllFlarePeaks["SpType"] == "K"
|
|
|
|
|
PDCSAPdataList2dhistPhaseDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[KfilterDataAllFlarePeaks]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPdataList2dhistPeakDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[KfilterDataAllFlarePeaks]["Peak"])
|
|
|
|
|
PDCSAPdataListDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[KfilterDataAllFlarePeaks]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPlabelListDataAllFlarePeaks.append("K Stars")
|
|
|
|
|
PDCSAPcolorListDataAllFlarePeaks.append("orange")
|
|
|
|
|
plotFiltersDataAllFlarePeaks.append(KfilterDataAllFlarePeaks)
|
|
|
|
|
if("G" in combo):
|
|
|
|
|
GfilterDataAllFlarePeaks = pdcsapbinningDataAllFlarePeaks["SpType"] == "G"
|
|
|
|
|
PDCSAPdataList2dhistPhaseDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[GfilterDataAllFlarePeaks]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPdataList2dhistPeakDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[GfilterDataAllFlarePeaks]["Peak"])
|
|
|
|
|
PDCSAPdataListDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[GfilterDataAllFlarePeaks]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPlabelListDataAllFlarePeaks.append("G Stars")
|
|
|
|
|
PDCSAPcolorListDataAllFlarePeaks.append("yellow")
|
|
|
|
|
plotFiltersDataAllFlarePeaks.append(GfilterDataAllFlarePeaks)
|
|
|
|
|
if("F" in combo):
|
|
|
|
|
FfilterDataAllFlarePeaks = pdcsapbinningDataAllFlarePeaks["SpType"] == "F"
|
|
|
|
|
PDCSAPdataList2dhistPhaseDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[FfilterDataAllFlarePeaks]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPdataList2dhistPeakDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[FfilterDataAllFlarePeaks]["Peak"])
|
|
|
|
|
PDCSAPdataListDataAllFlarePeaks.append(pdcsapbinningDataAllFlarePeaks[FfilterDataAllFlarePeaks]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPlabelListDataAllFlarePeaks.append("F Stars")
|
|
|
|
|
PDCSAPcolorListDataAllFlarePeaks.append("greenyellow")
|
|
|
|
|
plotFiltersDataAllFlarePeaks.append(FfilterDataAllFlarePeaks)
|
|
|
|
|
|
|
|
|
|
xDataDataAllFlarePeaks, yDataDataAllFlarePeaks, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhaseDataAllFlarePeaks, PDCSAPdataList2dhistPeakDataAllFlarePeaks,
|
|
|
|
|
pdcsapbinningDataAllFlarePeaks, "PDCSAPNormPhase")
|
|
|
|
|
|
|
|
|
|
generatePlots(PDCSAPdataListDataAllFlarePeaks, PDCSAPlabelListDataAllFlarePeaks, PDCSAPcolorListDataAllFlarePeaks, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins ({numStarsAllFLarePeaks} stars)", f"{locFolder}/{''.join(combo)}-Flarecount-@bins_Bins.png",
|
|
|
|
|
xDataDataAllFlarePeaks, yDataDataAllFlarePeaks, 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",
|
|
|
|
|
pdcsapbinningDataAllFlarePeaks, plotFiltersDataAllFlarePeaks, PDCSAPlabelListDataAllFlarePeaks, PDCSAPcolorListDataAllFlarePeaks, f"Flare peaks per phase of {', '.join(combo)} type stars ({numStarsAllFLarePeaks} stars)", f"{locFolder}/{''.join(combo)}-Flarepeaks_maxY-@maxY.png")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for maxFlarePeak in [1.01, 1.05, 1.1, 1.25, 1.5]:
|
|
|
|
|
# max Flare Peak cut
|
|
|
|
|
finalDataMaxFlarePeak = pd.DataFrame()
|
|
|
|
@@ -366,7 +461,8 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
|
|
|
|
|
csvFileU.write("\n")
|
|
|
|
|
pdcsapbinningDataU.append({"SpType": row["SpType"][0],
|
|
|
|
|
"PDCSAPNormPhase": normPhase,
|
|
|
|
|
"Peak": peak["FlarePeak"]})
|
|
|
|
|
"Peak": peak["FlarePeak"],
|
|
|
|
|
"StarName": row['StarName']})
|
|
|
|
|
if(peak["FlarePeak"] > 100):
|
|
|
|
|
print(row["StarName"], "has over 100 peak")
|
|
|
|
|
else:
|
|
|
|
@@ -375,7 +471,8 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
|
|
|
|
|
csvFileO.write("\n")
|
|
|
|
|
pdcsapbinningDataO.append({"SpType": row["SpType"][0],
|
|
|
|
|
"PDCSAPNormPhase": normPhase,
|
|
|
|
|
"Peak": peak["FlarePeak"]})
|
|
|
|
|
"Peak": peak["FlarePeak"],
|
|
|
|
|
"StarName": row['StarName']})
|
|
|
|
|
if(peak["FlarePeak"] > 100):
|
|
|
|
|
print(row["StarName"], "has over 100 peak")
|
|
|
|
|
|
|
|
|
@@ -384,6 +481,7 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
|
|
|
|
|
if(len(pdcsapbinningDataU) > 0):
|
|
|
|
|
pdcsapbinningDataU = pd.DataFrame(pdcsapbinningDataU)
|
|
|
|
|
numStarsFlarePeakU = len(set(pdcsapbinningDataU["StarName"]))
|
|
|
|
|
pd.DataFrame(set(pdcsapbinningDataU["StarName"])).to_csv(f"{locFolderU}/{''.join(combo)}_starlist.csv")
|
|
|
|
|
PDCSAPdataListU = []
|
|
|
|
|
PDCSAPlabelListU = []
|
|
|
|
|
PDCSAPcolorListU = []
|
|
|
|
@@ -432,6 +530,7 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
|
|
|
|
|
if(len(pdcsapbinningDataO) > 0):
|
|
|
|
|
pdcsapbinningDataO = pd.DataFrame(pdcsapbinningDataO)
|
|
|
|
|
numStarsFlarePeakO = len(set(pdcsapbinningDataO["StarName"]))
|
|
|
|
|
pd.DataFrame(set(pdcsapbinningDataO["StarName"])).to_csv(f"{locFolderO}/{''.join(combo)}_starlist.csv")
|
|
|
|
|
PDCSAPdataListO = []
|
|
|
|
|
PDCSAPlabelListO = []
|
|
|
|
|
PDCSAPcolorListO = []
|
|
|
|
@@ -476,99 +575,7 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
|
|
|
|
|
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 ({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 ({numStarsFlarePeakO} stars)", f"{locFolderO}/{''.join(combo)}_minFlarePeak_{maxFlarePeak}-Flarepeaks_maxY-@maxY.png")
|
|
|
|
|
# all flare peaks
|
|
|
|
|
finalDataAllFlarePeaks = pd.DataFrame()
|
|
|
|
|
if("M" in combo):
|
|
|
|
|
Mfilter = data["SpType"].str.startswith("M")
|
|
|
|
|
Mfilter &= showSourceFilter
|
|
|
|
|
finalDataAllFlarePeaks = pd.concat([finalDataAllFlarePeaks, data[Mfilter]], ignore_index=True)
|
|
|
|
|
if("K" in combo):
|
|
|
|
|
Kfilter = data["SpType"].str.startswith("K")
|
|
|
|
|
Kfilter &= showSourceFilter
|
|
|
|
|
finalDataAllFlarePeaks = pd.concat([finalDataAllFlarePeaks, data[Kfilter]], ignore_index=True)
|
|
|
|
|
if("G" in combo):
|
|
|
|
|
Gfilter = data["SpType"].str.startswith("G")
|
|
|
|
|
Gfilter &= showSourceFilter
|
|
|
|
|
finalDataAllFlarePeaks = pd.concat([finalDataAllFlarePeaks, data[Gfilter]], ignore_index=True)
|
|
|
|
|
if("F" in combo):
|
|
|
|
|
Ffilter = data["SpType"].str.startswith("F")
|
|
|
|
|
Ffilter &= showSourceFilter
|
|
|
|
|
finalDataAllFlarePeaks = pd.concat([finalDataAllFlarePeaks, data[Ffilter]], ignore_index=True)
|
|
|
|
|
|
|
|
|
|
pdcsapbinningData = []
|
|
|
|
|
locFolder = f"{folderPath}/{''.join(combo)}/"
|
|
|
|
|
mkdir_p(f"{locFolder}/")
|
|
|
|
|
csvFile = open(f"{locFolder}/{''.join(combo)}.csv", "a")
|
|
|
|
|
csvFile.write("Star Name,Spectral Type,Source,File,Flare Time,Flare Peak,Period,Normalized Phase of Peak,Peak in Period")
|
|
|
|
|
csvFile.write("\n")
|
|
|
|
|
for ind, row in finalDataAllFlarePeaks.reset_index().iterrows():
|
|
|
|
|
PDCSAPminOrigPhase = row["pdcsapFoldedFitPhaseStarEnd"][0]
|
|
|
|
|
PDCSAPmaxOrigPhase = row["pdcsapFoldedFitPhaseStarEnd"][1]
|
|
|
|
|
if(len(row["pdcsapFoldedPeaksPhasePair"]) > 0):
|
|
|
|
|
pdcsapVals = pd.DataFrame(row["pdcsapFoldedPeaksPhasePair"])
|
|
|
|
|
for td, peak, pv in zip(pdcsapVals["Phase"], pdcsapVals["Peak"], row["pdcsapPeaks"]):
|
|
|
|
|
normPhase = normalizePhase(td.value, np.abs(PDCSAPminOrigPhase), np.abs(PDCSAPmaxOrigPhase))
|
|
|
|
|
csvFile.write(f"{row['StarName']},{row['SpType']},{row['Source']},{row['FilePath']},{pv['FlarePeakTime']},{pv['FlarePeak']},{row['pdcsapPeriod']},{normPhase},{peak['FlarePeak']}")
|
|
|
|
|
csvFile.write("\n")
|
|
|
|
|
pdcsapbinningData.append({"SpType": row["SpType"][0],
|
|
|
|
|
"PDCSAPNormPhase": normPhase,
|
|
|
|
|
"Peak": peak["FlarePeak"]})
|
|
|
|
|
if(peak["FlarePeak"] > 100):
|
|
|
|
|
print(row["StarName"], "has over 100 peak")
|
|
|
|
|
|
|
|
|
|
csvFile.close()
|
|
|
|
|
if(len(pdcsapbinningData) > 0):
|
|
|
|
|
pdcsapbinningData = pd.DataFrame(pdcsapbinningData)
|
|
|
|
|
numStarsAllFLarePeaks = len(set(pdcsapbinningData["StarName"]))
|
|
|
|
|
PDCSAPdataList = []
|
|
|
|
|
PDCSAPlabelList = []
|
|
|
|
|
PDCSAPcolorList = []
|
|
|
|
|
PDCSAPdataList2dhistPhase = []
|
|
|
|
|
PDCSAPdataList2dhistPeak = []
|
|
|
|
|
PDCSAPlabelList2dhist = []
|
|
|
|
|
PDCSAPcolorList2dhist = []
|
|
|
|
|
plotFilters = []
|
|
|
|
|
if("M" in combo):
|
|
|
|
|
Mfilter = pdcsapbinningData["SpType"] == "M"
|
|
|
|
|
PDCSAPdataList2dhistPhase.append(pdcsapbinningData[Mfilter]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPdataList2dhistPeak.append(pdcsapbinningData[Mfilter]["Peak"])
|
|
|
|
|
PDCSAPdataList.append(pdcsapbinningData[Mfilter]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPlabelList.append("M Stars")
|
|
|
|
|
PDCSAPcolorList.append("red")
|
|
|
|
|
plotFilters.append(Mfilter)
|
|
|
|
|
if("K" in combo):
|
|
|
|
|
Kfilter = pdcsapbinningData["SpType"] == "K"
|
|
|
|
|
PDCSAPdataList2dhistPhase.append(pdcsapbinningData[Kfilter]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPdataList2dhistPeak.append(pdcsapbinningData[Kfilter]["Peak"])
|
|
|
|
|
PDCSAPdataList.append(pdcsapbinningData[Kfilter]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPlabelList.append("K Stars")
|
|
|
|
|
PDCSAPcolorList.append("orange")
|
|
|
|
|
plotFilters.append(Kfilter)
|
|
|
|
|
if("G" in combo):
|
|
|
|
|
Gfilter = pdcsapbinningData["SpType"] == "G"
|
|
|
|
|
PDCSAPdataList2dhistPhase.append(pdcsapbinningData[Gfilter]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPdataList2dhistPeak.append(pdcsapbinningData[Gfilter]["Peak"])
|
|
|
|
|
PDCSAPdataList.append(pdcsapbinningData[Gfilter]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPlabelList.append("G Stars")
|
|
|
|
|
PDCSAPcolorList.append("yellow")
|
|
|
|
|
plotFilters.append(Gfilter)
|
|
|
|
|
if("F" in combo):
|
|
|
|
|
Ffilter = pdcsapbinningData["SpType"] == "F"
|
|
|
|
|
PDCSAPdataList2dhistPhase.append(pdcsapbinningData[Ffilter]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPdataList2dhistPeak.append(pdcsapbinningData[Ffilter]["Peak"])
|
|
|
|
|
PDCSAPdataList.append(pdcsapbinningData[Ffilter]["PDCSAPNormPhase"])
|
|
|
|
|
PDCSAPlabelList.append("F Stars")
|
|
|
|
|
PDCSAPcolorList.append("greenyellow")
|
|
|
|
|
plotFilters.append(Ffilter)
|
|
|
|
|
|
|
|
|
|
xData, yData, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak,
|
|
|
|
|
pdcsapbinningData, "PDCSAPNormPhase",)
|
|
|
|
|
plotdata = pdcsapbinningData
|
|
|
|
|
filters = plotFilters
|
|
|
|
|
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 ({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 ({numStarsAllFLarePeaks} stars)", f"{locFolder}/{''.join(combo)}-Flarepeaks_maxY-@maxY.png")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(len(combo) == 1):
|
|
|
|
|
mainSpType = combo[0]
|
|
|
|
|
spTypes = [f"{mainSpType}0", f"{mainSpType}1", f"{mainSpType}2", f"{mainSpType}3", f"{mainSpType}4", f"{mainSpType}5", f"{mainSpType}6", f"{mainSpType}7", f"{mainSpType}8", f"{mainSpType}9"]
|
|
|
|
@@ -606,13 +613,15 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
|
|
|
|
|
csvFile.write("\n")
|
|
|
|
|
pdcsapbinningData.append({"SpType": f'{row["SpType"][0]}{row["SpType"][1]}',
|
|
|
|
|
"PDCSAPNormPhase": normPhase,
|
|
|
|
|
"Peak": peak["FlarePeak"]})
|
|
|
|
|
"Peak": peak["FlarePeak"],
|
|
|
|
|
"StarName": row['StarName']})
|
|
|
|
|
if(peak["FlarePeak"] > 100):
|
|
|
|
|
print(row["StarName"], "has over 100 peak")
|
|
|
|
|
csvFile.close()
|
|
|
|
|
if(len(pdcsapbinningData) > 0):
|
|
|
|
|
pdcsapbinningData = pd.DataFrame(pdcsapbinningData)
|
|
|
|
|
numStarsAccSpType = len(set(pdcsapbinningData[typeFilter]["StarName"]))
|
|
|
|
|
numStarsAccSpType = len(set(pdcsapbinningData["StarName"]))
|
|
|
|
|
pd.DataFrame(set(pdcsapbinningData["StarName"])).to_csv(f"{locFolder}/{spTyp}_starlist.csv")
|
|
|
|
|
PDCSAPdataList = []
|
|
|
|
|
PDCSAPlabelList = []
|
|
|
|
|
PDCSAPcolorList = []
|
|
|
|
@@ -685,13 +694,15 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
|
|
|
|
|
csvFileU.write("\n")
|
|
|
|
|
pdcsapbinningDataU.append({"SpType": f'{row["SpType"][0]}',
|
|
|
|
|
"PDCSAPNormPhase": normPhase,
|
|
|
|
|
"Peak": peak["FlarePeak"]})
|
|
|
|
|
"Peak": peak["FlarePeak"],
|
|
|
|
|
"StarName": row['StarName']})
|
|
|
|
|
else:
|
|
|
|
|
csvFileO.write(f"{row['StarName']},{row['SpType']},{row['Source']},{row['FilePath']},{pv['FlarePeakTime']},{pv['FlarePeak']},{row['pdcsapPeriod']},{row['MeanPeriod']},{normPhase},{peak['FlarePeak']}")
|
|
|
|
|
csvFileO.write("\n")
|
|
|
|
|
pdcsapbinningDataO.append({"SpType": f'{row["SpType"][0]}',
|
|
|
|
|
"PDCSAPNormPhase": normPhase,
|
|
|
|
|
"Peak": peak["FlarePeak"]})
|
|
|
|
|
"Peak": peak["FlarePeak"],
|
|
|
|
|
"StarName": row['StarName']})
|
|
|
|
|
if(peak["FlarePeak"] > 100):
|
|
|
|
|
print(row["StarName"], "has over 100 peak")
|
|
|
|
|
csvFileU.close()
|
|
|
|
@@ -705,9 +716,6 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
|
|
|
|
|
PDCSAPdataList2dhistPhaseO = []; PDCSAPdataList2dhistPeakO = []
|
|
|
|
|
plotFiltersU = []; plotFiltersO = [];
|
|
|
|
|
|
|
|
|
|
numStarsPeriodU = len(set(pdcsapbinningDataU[typeFilter]["StarName"]))
|
|
|
|
|
numStarsPeriodO = len(set(pdcsapbinningDataO[typeFilter]["StarName"]))
|
|
|
|
|
|
|
|
|
|
if("M" in combo):
|
|
|
|
|
PDCSAPlabelList.append("M Stars")
|
|
|
|
|
PDCSAPcolorList.append("red")
|
|
|
|
@@ -722,6 +730,8 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
|
|
|
|
|
PDCSAPcolorList.append("greenyellow")
|
|
|
|
|
|
|
|
|
|
if(len(pdcsapbinningDataU) > 0):
|
|
|
|
|
numStarsPeriodU = len(set(pdcsapbinningDataU["StarName"]))
|
|
|
|
|
pd.DataFrame(set(pdcsapbinningDataU["StarName"])).to_csv(f"{locFolder}/under_{periodCut}_starlist.csv")
|
|
|
|
|
if("M" in combo):
|
|
|
|
|
MfilterU = pdcsapbinningDataU["SpType"] == "M"
|
|
|
|
|
PDCSAPdataList2dhistPhaseU.append(pdcsapbinningDataU[MfilterU]["PDCSAPNormPhase"])
|
|
|
|
@@ -748,6 +758,8 @@ def plotCombo(data, showSourceFilter, folderPath, combo):
|
|
|
|
|
plotFiltersU.append(FfilterU)
|
|
|
|
|
|
|
|
|
|
if(len(pdcsapbinningDataO) > 0):
|
|
|
|
|
numStarsPeriodO = len(set(pdcsapbinningDataO["StarName"]))
|
|
|
|
|
pd.DataFrame(set(pdcsapbinningDataO["StarName"])).to_csv(f"{locFolder}/over_{periodCut}_starlist.csv")
|
|
|
|
|
if("M" in combo):
|
|
|
|
|
MfilterO = pdcsapbinningDataO["SpType"] == "M"
|
|
|
|
|
PDCSAPdataList2dhistPhaseO.append(pdcsapbinningDataO[MfilterO]["PDCSAPNormPhase"])
|
|
|
|
@@ -851,7 +863,7 @@ if __name__ == "__main__":
|
|
|
|
|
validStarPeriodMap = pd.DataFrame(validStarPeriodMap)
|
|
|
|
|
|
|
|
|
|
data = pd.merge(data, validStarPeriodMap, on="StarName")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#starPlotFunc = partial(plotStar, data, showSourceFilter, folderPath)
|
|
|
|
|
#list(pool.map(starPlotFunc, allStars)) # wrap in list, to force evaluation
|
|
|
|
|
|
|
|
|
|