generate plots: fix using wrong dataset for full period histogram
This commit is contained in:
+17
-11
@@ -51,13 +51,13 @@ if(useTESS):
|
||||
current = datetime.now()
|
||||
date = f"{current.year}-{current.month}-{current.day}"
|
||||
time = f"{current.hour}-{current.minute}-{current.second}"
|
||||
folderPath = f"../{date}-sine-poly/"
|
||||
folderPath = f"../{date}-poly-only/"
|
||||
#folderPath = f"G:/Meine Ablage/Masterthesis/{date}/"
|
||||
mkdir_p(folderPath)
|
||||
|
||||
# remove any data that has no period
|
||||
#data = data[(data["FitType"] == "sine") | (data["FitType"] == "poly")]
|
||||
data = data[((data["FitType"] == "sine") | (data["FitType"] == "poly")) & (data["isValidFold"])]
|
||||
data = data[((data["FitType"] == "poly")) & (data["isValidFold"])]
|
||||
|
||||
validStarPeriodMap = []
|
||||
starList = set(list(data["StarName"]))
|
||||
@@ -183,7 +183,8 @@ def plotFlarePeaks(plotdata, filters, labels, colors, maxY, title, filename):
|
||||
plt.close()
|
||||
|
||||
def setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak,
|
||||
PDCSAPdataList=None, dataFilter=None):
|
||||
PDCSAPdataList=None, dataFilter=None,
|
||||
PeriodModulation=False):
|
||||
xData = pd.DataFrame()
|
||||
yData = pd.DataFrame()
|
||||
for aX, aY in zip(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak):
|
||||
@@ -194,7 +195,13 @@ def setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak,
|
||||
yData = np.asarray(yData.values)[:,0]
|
||||
if(PDCSAPdataList is not None):
|
||||
if(dataFilter is not None):
|
||||
if(PeriodModulation):
|
||||
PDCSAPdataList.append(pdcsapbinningDataSpotModDiffPeriod[dataFilter]["PDCSAPNormPhasePeriod"])
|
||||
else:
|
||||
PDCSAPdataList.append(pdcsapbinningData[dataFilter]["PDCSAPNormPhase"])
|
||||
else:
|
||||
if(PeriodModulation):
|
||||
PDCSAPdataList.append(pdcsapbinningDataSpotModDiffPeriod[:]["PDCSAPNormPhasePeriod"])
|
||||
else:
|
||||
PDCSAPdataList.append(pdcsapbinningData[:]["PDCSAPNormPhase"])
|
||||
|
||||
@@ -270,7 +277,6 @@ for starName in starDB.getAllStars():
|
||||
PDCSAPcolorList = []
|
||||
PDCSAPdataList2dhistPhase = []
|
||||
PDCSAPdataList2dhistPeak = []
|
||||
|
||||
if(len(pdcsapbinningData) > 0):
|
||||
if(pdcsapbinningData["SpType"][0][0] == "M"):
|
||||
color = "red"
|
||||
@@ -297,19 +303,19 @@ for starName in starDB.getAllStars():
|
||||
foldedFits)
|
||||
|
||||
if(pdcsapbinningDataSpotModDiffPeriod is not None):
|
||||
PDCSAPdataList = []
|
||||
PDCSAPdataListPeriod = []
|
||||
PDCSAPlabelList = []
|
||||
PDCSAPcolorList = []
|
||||
PDCSAPdataList2dhistPhase = []
|
||||
PDCSAPdataList2dhistPeak = []
|
||||
|
||||
if(pdcsapbinningData["SpType"][0][0] == "M"):
|
||||
if(pdcsapbinningDataSpotModDiffPeriod["SpType"][0][0] == "M"):
|
||||
color = "red"
|
||||
elif(pdcsapbinningData["SpType"][0][0] == "K"):
|
||||
elif(pdcsapbinningDataSpotModDiffPeriod["SpType"][0][0] == "K"):
|
||||
color = "orange"
|
||||
elif(pdcsapbinningData["SpType"][0][0] == "G"):
|
||||
elif(pdcsapbinningDataSpotModDiffPeriod["SpType"][0][0] == "G"):
|
||||
color = "yellow"
|
||||
elif(pdcsapbinningData["SpType"][0][0] == "F"):
|
||||
elif(pdcsapbinningDataSpotModDiffPeriod["SpType"][0][0] == "F"):
|
||||
color = "greenyellow"
|
||||
else:
|
||||
color = "gray"
|
||||
@@ -317,12 +323,12 @@ for starName in starDB.getAllStars():
|
||||
PDCSAPdataList2dhistPhase.append(pdcsapbinningDataSpotModDiffPeriod[:]["PDCSAPNormPhasePeriod"])
|
||||
PDCSAPdataList2dhistPeak.append(pdcsapbinningDataSpotModDiffPeriod[:]["PeakPeriod"])
|
||||
|
||||
xData, yData, PDCSAPdataList = setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak, PDCSAPdataList)
|
||||
xData, yData, PDCSAPdataListPeriod = setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak, PDCSAPdataListPeriod, PeriodModulation=True)
|
||||
|
||||
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",
|
||||
generatePlots(PDCSAPdataListPeriod, 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)
|
||||
|
||||
Reference in New Issue
Block a user