update code for optimized fold
This commit is contained in:
+192
-97
@@ -27,7 +27,7 @@ def mkdir_p(mypath):
|
||||
pass
|
||||
else: raise
|
||||
|
||||
fileName = "datav4.cff"
|
||||
fileName = "datav5.cff"
|
||||
data = pd.read_pickle(fileName)
|
||||
|
||||
binList = [10, 20, 30]
|
||||
@@ -56,19 +56,8 @@ folderPath = f"../{date}/"
|
||||
mkdir_p(folderPath)
|
||||
|
||||
# remove any data that has no period
|
||||
data = data[(data["FitType"] == "sine") | (data["FitType"] == "poly")]
|
||||
|
||||
# remove data with multiple minima/maxima present
|
||||
filterArray = []
|
||||
for ind, row in data.reset_index().iterrows():
|
||||
if(len(row["pdcsapPeriodMinima"]) == len(row["pdcsapPeriodMaxima"]) and
|
||||
len(row["pdcsapPeriodMinima"]) == 1):
|
||||
filterArray.append(True)
|
||||
else:
|
||||
filterArray.append(False)
|
||||
|
||||
filterArray = np.array(filterArray)
|
||||
data = data[filterArray]
|
||||
#data = data[(data["FitType"] == "sine") | (data["FitType"] == "poly")]
|
||||
data = data[(data["FitType"] == "sine")]
|
||||
|
||||
validStarPeriodMap = []
|
||||
starList = set(list(data["StarName"]))
|
||||
@@ -95,7 +84,7 @@ periodsCutList = [0.5, 1, 1.5, 2, 5, 10, 15, 20]
|
||||
data = pd.merge(data, validStarPeriodMap, on="StarName")
|
||||
starDB: StarDB = StarDB.getInstance("stars.db")
|
||||
|
||||
def plotBinsHistogram(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, bins, title, filename):
|
||||
def plotBinsHistogram(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, bins, title, filename, foldedFits):
|
||||
figHisto, ((axHisto)) = plt.subplots(nrows=1, ncols=1)
|
||||
y, binEdges, _ = axHisto.hist(PDCSAPdataList, bins,
|
||||
label=PDCSAPlabelList,
|
||||
@@ -130,10 +119,17 @@ def plotBinsHistogram(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, bins, ti
|
||||
axHisto.legend()
|
||||
|
||||
axHistoPhase = axHisto.twinx()
|
||||
secAxisXdata = np.linspace(0, 2, num=10000)
|
||||
secAxisYdata = np.cos(secAxisXdata*np.pi) + 1
|
||||
axHistoPhase.plot(secAxisXdata, secAxisYdata)
|
||||
axHistoPhase.set_ylim(0, 7)
|
||||
if(foldedFits is None):
|
||||
secAxisXdata = np.linspace(0, 2, num=10000)
|
||||
secAxisYdata = np.cos(secAxisXdata*np.pi) + 1
|
||||
axHistoPhase.plot(secAxisXdata, secAxisYdata, color="blue")
|
||||
axHistoPhase.set_ylim(0, 7)
|
||||
else:
|
||||
for fit in foldedFits:
|
||||
axHistoPhase.plot(fit[0], fit[1], color="blue")
|
||||
fitCol = [fit[1] for fit in foldedFits]
|
||||
fitCol = np.array(list(itertools.chain.from_iterable(fitCol)))
|
||||
axHistoPhase.set_ylim(np.min(fitCol), np.max(fitCol)*1.2)
|
||||
|
||||
plt.savefig(filename)
|
||||
plt.close()
|
||||
@@ -205,11 +201,12 @@ def setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak,
|
||||
|
||||
def generatePlots(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, histogramTitleArg, histogramFilenameArg,
|
||||
xData, yData, peak2DHistogramTitleArg, peak2DfilenameArg,
|
||||
plotdata, filters, flarePlotLabels, flarePlotColors, flarePlotTitleArg, flarePlotFilenameArg):
|
||||
plotdata, filters, flarePlotLabels, flarePlotColors, flarePlotTitleArg, flarePlotFilenameArg,
|
||||
foldedFits=None):
|
||||
for bins in binList:
|
||||
histogramTitle = histogramTitleArg.replace("@bins", str(bins))
|
||||
histogramFilename = histogramFilenameArg.replace("@bins", str(bins))
|
||||
plotBinsHistogram(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, bins, histogramTitle, histogramFilename)
|
||||
plotBinsHistogram(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, bins, histogramTitle, histogramFilename, foldedFits)
|
||||
|
||||
for maxY in [1.05, 1.1, 1.2, 1.5, 2, 2.5, 3, 5, max(yData)]:
|
||||
peak2DHistogramTitle = peak2DHistogramTitleArg.replace("@bins", str(bins))
|
||||
@@ -230,10 +227,13 @@ for starName in starDB.getAllStars():
|
||||
finalData = pd.concat([finalData, data[nameFilter]], ignore_index=True)
|
||||
|
||||
pdcsapbinningData = []
|
||||
pdcsapbinningDataSpotModDiffPeriod = []
|
||||
foldedFits = []
|
||||
foldedPeriodFits = []
|
||||
locFolder = f"{folderPath}/stars/{starNameR}/"
|
||||
mkdir_p(f"{locFolder}/")
|
||||
csvFile = open(f"{locFolder}/{starNameR}.csv", "a")
|
||||
csvFile.write("Star Name,Spectral Type,Source,File,Flare Time,Flare Peak,Period,Normalized Phase of Peak,Peak in Period")
|
||||
csvFile.write("Star Name,Spectral Type,Source,File,Flare Time,Flare Peak,Period,Spot Modulation,Normalized Phase of Peak,Peak in Period")
|
||||
csvFile.write("\n")
|
||||
for ind, row in finalData.reset_index().iterrows():
|
||||
PDCSAPminOrigPhase = row["pdcsapFoldedFitPhaseStarEnd"][0]
|
||||
@@ -243,24 +243,34 @@ for starName in starDB.getAllStars():
|
||||
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(f"{row['StarName']},{row['SpType']},{row['Source']},{row['FilePath']},{pv['FlarePeakTime']},{pv['FlarePeak']},{row['pdcsapPeriod']},{row['pdcsapSpotModulation']},{normPhase},{peak['FlarePeak']}")
|
||||
csvFile.write("\n")
|
||||
pdcsapbinningData.append({"SpType": f'{row["SpType"][0:2] if len(row["SpType"]) > 1 else row["SpType"][0]}',
|
||||
"PDCSAPNormPhase": normPhase,
|
||||
"Peak": peak["FlarePeak"]})
|
||||
if(peak["FlarePeak"] > 100):
|
||||
print(row["StarName"], "has over 100 peak")
|
||||
foldedFits.append([normalizePhase(row["pdcsapFoldedFitPhase"]), row["pdcsapFoldedFit"]])
|
||||
if(row["pdcsapPeriodFoldedPhase"] is not None):
|
||||
periodPdcsapVals = pd.DataFrame(row["pdcsapPeriodFoldedPeaksPhasePair"])
|
||||
for td, peak in zip(periodPdcsapVals["Phase"], periodPdcsapVals["Peak"]):
|
||||
normPhasePeriod = normalizePhase(td.value, np.abs(row["pdcsapPeriodFoldedFitPhaseStarEnd"][0]), np.abs(row["pdcsapPeriodFoldedFitPhaseStarEnd"][1]))
|
||||
pdcsapbinningDataSpotModDiffPeriod.append({"SpType": f'{row["SpType"][0:2] if len(row["SpType"]) > 1 else row["SpType"][0]}',
|
||||
"PDCSAPNormPhasePeriod": normPhasePeriod,
|
||||
"PeakPeriod": peak["FlarePeak"]})
|
||||
if(peak["FlarePeak"] > 100):
|
||||
print(row["StarName"], "has over 100 peak")
|
||||
foldedPeriodFits.append([normalizePhase(row["pdcsapPeriodFoldedFitPhase"]), row["pdcsapPeriodFoldedFit"]])
|
||||
csvFile.close()
|
||||
pdcsapbinningData = pd.DataFrame(pdcsapbinningData)
|
||||
pdcsapbinningDataSpotModDiffPeriod = pd.DataFrame(pdcsapbinningDataSpotModDiffPeriod) if len(pdcsapbinningDataSpotModDiffPeriod) > 0 else None
|
||||
PDCSAPdataList = []
|
||||
PDCSAPlabelList = []
|
||||
PDCSAPcolorList = []
|
||||
PDCSAPdataList2dhistPhase = []
|
||||
PDCSAPdataList2dhistPeak = []
|
||||
|
||||
if(len(pdcsapbinningData) < 1):
|
||||
continue
|
||||
else:
|
||||
if(len(pdcsapbinningData) > 0):
|
||||
if(pdcsapbinningData["SpType"][0][0] == "M"):
|
||||
color = "red"
|
||||
elif(pdcsapbinningData["SpType"][0][0] == "K"):
|
||||
@@ -272,21 +282,49 @@ for starName in starDB.getAllStars():
|
||||
else:
|
||||
color = "gray"
|
||||
|
||||
PDCSAPdataList2dhistPhase.append(pdcsapbinningData[:]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeak.append(pdcsapbinningData[:]["Peak"])
|
||||
PDCSAPdataList2dhistPhase.append(pdcsapbinningData[:]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeak.append(pdcsapbinningData[:]["Peak"])
|
||||
|
||||
xData, yData, PDCSAPdataList = setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak, PDCSAPdataList)
|
||||
xData, yData, PDCSAPdataList = setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak, PDCSAPdataList)
|
||||
|
||||
PDCSAPlabelList.append(f"{starName}")
|
||||
PDCSAPcolorList.append(color)
|
||||
PDCSAPlabelList.append(f"{starName}")
|
||||
PDCSAPcolorList.append(color)
|
||||
|
||||
plotdata = pdcsapbinningData
|
||||
filters = None
|
||||
flarePlotLabels = f"{starName}"
|
||||
flarePlotColors = color
|
||||
generatePlots(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, f"Flare count in phase of {starName} with @bins bins", f"{locFolder}/{starNameR}-Flarecount-@bins_Bins.png",
|
||||
xData, yData, f"Flare peak per phase histogram of {starName} with @bins bins", f"{locFolder}/{starNameR}-Flarepeaks-@bins_Bins_maxY-@maxY.png",
|
||||
plotdata, filters, flarePlotLabels, flarePlotColors, f"Flare peaks per phase of {starName}", f"{locFolder}/{starNameR}-Flarepeaks_maxY-@maxY.png")
|
||||
generatePlots(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, f"Flare count in phase of {starName} with @bins bins", f"{locFolder}/{starNameR}-Flarecount-@bins_Bins.png",
|
||||
xData, yData, f"Flare peak per phase histogram of {starName} with @bins bins", f"{locFolder}/{starNameR}-Flarepeaks-@bins_Bins_maxY-@maxY.png",
|
||||
pdcsapbinningData, None, f"{starName}", color, f"Flare peaks per phase of {starName}", f"{locFolder}/{starNameR}-Flarepeaks_maxY-@maxY.png",
|
||||
foldedFits)
|
||||
|
||||
if(pdcsapbinningDataSpotModDiffPeriod is not None):
|
||||
PDCSAPdataList = []
|
||||
PDCSAPlabelList = []
|
||||
PDCSAPcolorList = []
|
||||
PDCSAPdataList2dhistPhase = []
|
||||
PDCSAPdataList2dhistPeak = []
|
||||
|
||||
if(pdcsapbinningData["SpType"][0][0] == "M"):
|
||||
color = "red"
|
||||
elif(pdcsapbinningData["SpType"][0][0] == "K"):
|
||||
color = "orange"
|
||||
elif(pdcsapbinningData["SpType"][0][0] == "G"):
|
||||
color = "yellow"
|
||||
elif(pdcsapbinningData["SpType"][0][0] == "F"):
|
||||
color = "greenyellow"
|
||||
else:
|
||||
color = "gray"
|
||||
|
||||
PDCSAPdataList2dhistPhase.append(pdcsapbinningDataSpotModDiffPeriod[:]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeak.append(pdcsapbinningDataSpotModDiffPeriod[:]["Peak"])
|
||||
|
||||
xData, yData, PDCSAPdataList = setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak, PDCSAPdataList)
|
||||
|
||||
PDCSAPlabelList.append(f"{starName}")
|
||||
PDCSAPcolorList.append(color)
|
||||
|
||||
generatePlots(PDCSAPdataList, PDCSAPlabelList, PDCSAPcolorList, f"Flare count in phase of {starName} with @bins bins", f"{locFolder}/{starNameR}-Flarecount-@bins_Bins_Period.png",
|
||||
xData, yData, f"Flare peak per phase histogram of {starName} with @bins bins", f"{locFolder}/{starNameR}-Flarepeaks-@bins_Bins_maxY-@maxY_Period.png",
|
||||
pdcsapbinningDataSpotModDiffPeriod, None, f"{starName}", color, f"Flare peaks per phase of {starName}", f"{locFolder}/{starNameR}-Flarepeaks_maxY-@maxY_Period.png",
|
||||
foldedPeriodFits)
|
||||
|
||||
|
||||
for comboLength in range(1, len(spType) + 1):
|
||||
@@ -313,12 +351,18 @@ for comboLength in range(1, len(spType) + 1):
|
||||
|
||||
numStars = len(set(finalDataMaxFlarePeak["StarName"]))
|
||||
|
||||
pdcsapbinningData = []
|
||||
locFolder = f"{folderPath}/{''.join(combo)}/maxFlarePeaks/{maxFlarePeak}/"
|
||||
mkdir_p(f"{locFolder}/")
|
||||
csvFile = open(f"{locFolder}/{''.join(combo)}_maxFlarePeak_{maxFlarePeak}.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")
|
||||
pdcsapbinningDataU = []
|
||||
pdcsapbinningDataO = []
|
||||
locFolderU = f"{folderPath}/{''.join(combo)}/maxFlarePeaks/{maxFlarePeak}/"
|
||||
locFolderO = f"{folderPath}/{''.join(combo)}/minFlarePeaks/{maxFlarePeak}/"
|
||||
mkdir_p(f"{locFolderU}/")
|
||||
mkdir_p(f"{locFolderO}/")
|
||||
csvFileU = open(f"{locFolderU}/{''.join(combo)}_maxFlarePeak_{maxFlarePeak}.csv", "a")
|
||||
csvFileU.write("Star Name,Spectral Type,Source,File,Flare Time,Flare Peak,Period,Normalized Phase of Peak,Peak in Period")
|
||||
csvFileU.write("\n")
|
||||
csvFileO = open(f"{locFolderO}/{''.join(combo)}_minFlarePeak_{maxFlarePeak}.csv", "a")
|
||||
csvFileO.write("Star Name,Spectral Type,Source,File,Flare Time,Flare Peak,Period,Normalized Phase of Peak,Peak in Period")
|
||||
csvFileO.write("\n")
|
||||
for ind, row in finalDataMaxFlarePeak.reset_index().iterrows():
|
||||
PDCSAPminOrigPhase = row["pdcsapFoldedFitPhaseStarEnd"][0]
|
||||
PDCSAPmaxOrigPhase = row["pdcsapFoldedFitPhaseStarEnd"][1]
|
||||
@@ -327,66 +371,117 @@ for comboLength in range(1, len(spType) + 1):
|
||||
for td, peak, pv in zip(pdcsapVals["Phase"], pdcsapVals["Peak"], row["pdcsapPeaks"]):
|
||||
if(peak["FlarePeak"] <= maxFlarePeak):
|
||||
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],
|
||||
csvFileU.write(f"{row['StarName']},{row['SpType']},{row['Source']},{row['FilePath']},{pv['FlarePeakTime']},{pv['FlarePeak']},{row['pdcsapPeriod']},{normPhase},{peak['FlarePeak']}")
|
||||
csvFileU.write("\n")
|
||||
pdcsapbinningDataU.append({"SpType": row["SpType"][0],
|
||||
"PDCSAPNormPhase": normPhase,
|
||||
"Peak": peak["FlarePeak"]})
|
||||
if(peak["FlarePeak"] > 100):
|
||||
print(row["StarName"], "has over 100 peak")
|
||||
else:
|
||||
normPhase = normalizePhase(td.value, np.abs(PDCSAPminOrigPhase), np.abs(PDCSAPmaxOrigPhase))
|
||||
csvFileO.write(f"{row['StarName']},{row['SpType']},{row['Source']},{row['FilePath']},{pv['FlarePeakTime']},{pv['FlarePeak']},{row['pdcsapPeriod']},{normPhase},{peak['FlarePeak']}")
|
||||
csvFileO.write("\n")
|
||||
pdcsapbinningDataO.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) < 1):
|
||||
continue
|
||||
pdcsapbinningData = pd.DataFrame(pdcsapbinningData)
|
||||
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)
|
||||
csvFileU.close()
|
||||
csvFileO.close()
|
||||
if(len(pdcsapbinningDataU) > 0):
|
||||
pdcsapbinningDataU = pd.DataFrame(pdcsapbinningDataU)
|
||||
PDCSAPdataListU = []
|
||||
PDCSAPlabelListU = []
|
||||
PDCSAPcolorListU = []
|
||||
PDCSAPdataList2dhistPhaseU = []
|
||||
PDCSAPdataList2dhistPeakU = []
|
||||
plotFiltersU = []
|
||||
if("M" in combo):
|
||||
Mfilter = pdcsapbinningDataU["SpType"] == "M"
|
||||
PDCSAPdataList2dhistPhaseU.append(pdcsapbinningDataU[Mfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeakU.append(pdcsapbinningDataU[Mfilter]["Peak"])
|
||||
PDCSAPdataListU.append(pdcsapbinningDataU[Mfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPlabelListU.append("M Stars")
|
||||
PDCSAPcolorListU.append("red")
|
||||
plotFiltersU.append(Mfilter)
|
||||
if("K" in combo):
|
||||
Kfilter = pdcsapbinningDataU["SpType"] == "K"
|
||||
PDCSAPdataList2dhistPhaseU.append(pdcsapbinningDataU[Kfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeakU.append(pdcsapbinningDataU[Kfilter]["Peak"])
|
||||
PDCSAPdataListU.append(pdcsapbinningDataU[Kfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPlabelListU.append("K Stars")
|
||||
PDCSAPcolorListU.append("orange")
|
||||
plotFiltersU.append(Kfilter)
|
||||
if("G" in combo):
|
||||
Gfilter = pdcsapbinningDataU["SpType"] == "G"
|
||||
PDCSAPdataList2dhistPhaseU.append(pdcsapbinningDataU[Gfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeakU.append(pdcsapbinningDataU[Gfilter]["Peak"])
|
||||
PDCSAPdataListU.append(pdcsapbinningDataU[Gfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPlabelListU.append("G Stars")
|
||||
PDCSAPcolorListU.append("yellow")
|
||||
plotFiltersU.append(Gfilter)
|
||||
if("F" in combo):
|
||||
Ffilter = pdcsapbinningDataU["SpType"] == "F"
|
||||
PDCSAPdataList2dhistPhaseU.append(pdcsapbinningDataU[Ffilter]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeakU.append(pdcsapbinningDataU[Ffilter]["Peak"])
|
||||
PDCSAPdataListU.append(pdcsapbinningDataU[Ffilter]["PDCSAPNormPhase"])
|
||||
PDCSAPlabelListU.append("F Stars")
|
||||
PDCSAPcolorListU.append("greenyellow")
|
||||
plotFiltersU.append(Ffilter)
|
||||
|
||||
xData, yData, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak)
|
||||
plotdata = pdcsapbinningData
|
||||
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)}_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"{locFolder}/{''.join(combo)}_maxFlarePeak_{maxFlarePeak}-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)}_maxFlarePeak_{maxFlarePeak}-Flarepeaks_maxY-@maxY.png")
|
||||
xData, yData, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhaseU, PDCSAPdataList2dhistPeakU)
|
||||
generatePlots(PDCSAPdataListU, PDCSAPlabelListU, PDCSAPcolorListU, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins ({numStars} stars)", f"{locFolder}/{''.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"{locFolder}/{''.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"{locFolder}/{''.join(combo)}_maxFlarePeak_{maxFlarePeak}-Flarepeaks_maxY-@maxY.png")
|
||||
|
||||
|
||||
if(len(pdcsapbinningDataO) > 0):
|
||||
pdcsapbinningDataO = pd.DataFrame(pdcsapbinningDataO)
|
||||
PDCSAPdataListO = []
|
||||
PDCSAPlabelListO = []
|
||||
PDCSAPcolorListO = []
|
||||
PDCSAPdataList2dhistPhaseO = []
|
||||
PDCSAPdataList2dhistPeakO = []
|
||||
plotFiltersO = []
|
||||
if("M" in combo):
|
||||
Mfilter = pdcsapbinningDataO["SpType"] == "M"
|
||||
PDCSAPdataList2dhistPhaseO.append(pdcsapbinningDataO[Mfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeakO.append(pdcsapbinningDataO[Mfilter]["Peak"])
|
||||
PDCSAPdataListO.append(pdcsapbinningDataO[Mfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPlabelListO.append("M Stars")
|
||||
PDCSAPcolorListO.append("red")
|
||||
plotFiltersO.append(Mfilter)
|
||||
if("K" in combo):
|
||||
Kfilter = pdcsapbinningDataO["SpType"] == "K"
|
||||
PDCSAPdataList2dhistPhaseO.append(pdcsapbinningDataO[Kfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeakO.append(pdcsapbinningDataO[Kfilter]["Peak"])
|
||||
PDCSAPdataListO.append(pdcsapbinningDataO[Kfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPlabelListO.append("K Stars")
|
||||
PDCSAPcolorListO.append("orange")
|
||||
plotFiltersO.append(Kfilter)
|
||||
if("G" in combo):
|
||||
Gfilter = pdcsapbinningDataO["SpType"] == "G"
|
||||
PDCSAPdataList2dhistPhaseO.append(pdcsapbinningDataO[Gfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeakO.append(pdcsapbinningDataO[Gfilter]["Peak"])
|
||||
PDCSAPdataListO.append(pdcsapbinningDataO[Gfilter]["PDCSAPNormPhase"])
|
||||
PDCSAPlabelListO.append("G Stars")
|
||||
PDCSAPcolorListO.append("yellow")
|
||||
plotFiltersO.append(Gfilter)
|
||||
if("F" in combo):
|
||||
Ffilter = pdcsapbinningDataO["SpType"] == "F"
|
||||
PDCSAPdataList2dhistPhaseO.append(pdcsapbinningDataO[Ffilter]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeakO.append(pdcsapbinningDataO[Ffilter]["Peak"])
|
||||
PDCSAPdataListO.append(pdcsapbinningDataO[Ffilter]["PDCSAPNormPhase"])
|
||||
PDCSAPlabelListO.append("F Stars")
|
||||
PDCSAPcolorListO.append("greenyellow")
|
||||
plotFiltersO.append(Ffilter)
|
||||
|
||||
xData, yData, _ = setupxyDataAndDataList(PDCSAPdataList2dhistPhaseO, PDCSAPdataList2dhistPeakO)
|
||||
generatePlots(PDCSAPdataListO, PDCSAPlabelListO, PDCSAPcolorListO, f"Flare count per phase of {', '.join(combo)} type stars with @bins bins ({numStars} stars)", f"{locFolder}/{''.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"{locFolder}/{''.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"{locFolder}/{''.join(combo)}_minFlarePeak_{maxFlarePeak}-Flarepeaks_maxY-@maxY.png")
|
||||
# all flare peaks
|
||||
finalDataAllFlarePeaks = pd.DataFrame()
|
||||
if("M" in combo):
|
||||
|
||||
Reference in New Issue
Block a user