Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 060cae2264 | |||
| 54bd2e4bff | |||
| a7a816a892 | |||
| 4ad7974bb1 |
Binary file not shown.
+15
-12
@@ -27,7 +27,7 @@ def mkdir_p(mypath):
|
||||
pass
|
||||
else: raise
|
||||
|
||||
fileName = "datav5.cff"
|
||||
fileName = "datav5.1.cff"
|
||||
data = pd.read_pickle(fileName)
|
||||
|
||||
binList = [10, 20, 30]
|
||||
@@ -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}/"
|
||||
folderPath = f"../{date}-sine-poly/"
|
||||
#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 = data[((data["FitType"] == "sine") | (data["FitType"] == "poly")) & (data["isValidFold"])]
|
||||
|
||||
validStarPeriodMap = []
|
||||
starList = set(list(data["StarName"]))
|
||||
@@ -155,18 +155,19 @@ def plotFlarePeaks(plotdata, filters, labels, colors, maxY, title, filename):
|
||||
if(isinstance(labels, list) and isinstance(colors, list)):
|
||||
_, ((axFlarePeaks)) = plt.subplots(nrows=1, ncols=1)
|
||||
for f, l, c in zip(filters, labels, colors):
|
||||
axFlarePeaks.scatter(plotdata[f]["PDCSAPNormPhase"],
|
||||
plotdata[f]["Peak"],
|
||||
axFlarePeaks.scatter(plotdata[f]["PDCSAPNormPhase"] if "PDCSAPNormPhase" in plotdata[f].columns else plotdata[f]["PDCSAPNormPhasePeriod"],
|
||||
plotdata[f]["Peak"] if "Peak" in plotdata[f].columns else plotdata[f]["PeakPeriod"],
|
||||
label=l, color=c)
|
||||
elif(isinstance(labels, str) and isinstance(colors, str)):
|
||||
_, ((axFlarePeaks)) = plt.subplots(nrows=1, ncols=1)
|
||||
if(filters is None):
|
||||
axFlarePeaks.scatter(plotdata[:]["PDCSAPNormPhase"],
|
||||
plotdata[:]["Peak"],
|
||||
axFlarePeaks.scatter(plotdata[:]["PDCSAPNormPhase"] if "PDCSAPNormPhase" in plotdata[:].columns else plotdata[:]["PDCSAPNormPhasePeriod"],
|
||||
|
||||
plotdata[:]["Peak"] if "Peak" in plotdata[:].columns else plotdata[:]["PeakPeriod"],
|
||||
label=labels, color=colors)
|
||||
else:
|
||||
axFlarePeaks.scatter(plotdata[filters]["PDCSAPNormPhase"],
|
||||
plotdata[filters]["Peak"],
|
||||
axFlarePeaks.scatter(plotdata[filters]["PDCSAPNormPhase"] if "PDCSAPNormPhase" in plotdata[filters].columns else plotdata[filters]["PDCSAPNormPhasePeriod"],
|
||||
plotdata[filters]["Peak"] if "Peak" in plotdata[filters].columns else plotdata[filters]["PeakPeriod"],
|
||||
label=labels, color=colors)
|
||||
else:
|
||||
return
|
||||
@@ -313,8 +314,8 @@ for starName in starDB.getAllStars():
|
||||
else:
|
||||
color = "gray"
|
||||
|
||||
PDCSAPdataList2dhistPhase.append(pdcsapbinningDataSpotModDiffPeriod[:]["PDCSAPNormPhase"])
|
||||
PDCSAPdataList2dhistPeak.append(pdcsapbinningDataSpotModDiffPeriod[:]["Peak"])
|
||||
PDCSAPdataList2dhistPhase.append(pdcsapbinningDataSpotModDiffPeriod[:]["PDCSAPNormPhasePeriod"])
|
||||
PDCSAPdataList2dhistPeak.append(pdcsapbinningDataSpotModDiffPeriod[:]["PeakPeriod"])
|
||||
|
||||
xData, yData, PDCSAPdataList = setupxyDataAndDataList(PDCSAPdataList2dhistPhase, PDCSAPdataList2dhistPeak, PDCSAPdataList)
|
||||
|
||||
@@ -525,6 +526,7 @@ for comboLength in range(1, len(spType) + 1):
|
||||
print(row["StarName"], "has over 100 peak")
|
||||
|
||||
csvFile.close()
|
||||
if(len(pdcsapbinningData) > 0):
|
||||
pdcsapbinningData = pd.DataFrame(pdcsapbinningData)
|
||||
PDCSAPdataList = []
|
||||
PDCSAPlabelList = []
|
||||
@@ -576,7 +578,7 @@ for comboLength in range(1, len(spType) + 1):
|
||||
|
||||
if(comboLength == 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"]
|
||||
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"]
|
||||
match mainSpType:
|
||||
case "M":
|
||||
color = "red"
|
||||
@@ -616,6 +618,7 @@ for comboLength in range(1, len(spType) + 1):
|
||||
if(peak["FlarePeak"] > 100):
|
||||
print(row["StarName"], "has over 100 peak")
|
||||
csvFile.close()
|
||||
if(len(pdcsapbinningData) > 0):
|
||||
pdcsapbinningData = pd.DataFrame(pdcsapbinningData)
|
||||
PDCSAPdataList = []
|
||||
PDCSAPlabelList = []
|
||||
|
||||
@@ -150,6 +150,8 @@ def getFlareCount(filesDict):
|
||||
filesDict["pdcsapPeriodFoldedPeaksPhasePair"] = pdcsapPeriodFoldedPeaksPhasePair
|
||||
filesDict['periodFitType'] = optimizedFit["periodFitType"]
|
||||
|
||||
filesDict["isValidFold"] = optimizedFit["isValid"]
|
||||
|
||||
csvFile = open(f"{starFolder}/{starNameR}_{source}-{sequence}.csv", "a")
|
||||
csvFile.write("StarName,Spectral Type,Rotational Velocity,Rotenional Velocity Unit,Distance,Distance Unit,Source,Sequence,File Path,Initial folded Fit Type,Used folded Fit Type")
|
||||
csvFile.write(f"{filesDict['StarName']},{filesDict['SpType']},{filesDict['RotVel']},{filesDict['RotVelUnit']},{filesDict['Distance']},{filesDict['DistanceUnit']},{filesDict['Source']},{filesDict['Sequence']},{filesDict['FilePath']},{filesDict['FitType']},{optimizedFit['fitType']}")
|
||||
|
||||
@@ -429,7 +429,9 @@ def getOptimizedFold(normalizedLC, preferedFoldedFitType):
|
||||
spotModulationBefore = spotModulation
|
||||
if(len(fitMaximaArgs) > 1):
|
||||
print("fitMaximaArgs > 1: ", fitMaximaArgs)
|
||||
if(len(fitMaximaArgs) == 2 and fitMaximaArgs[0] > len(phase)*0.1 and fitMaximaArgs[1] < len(phase)*0.1):
|
||||
print(fitMaximaArgs[0], len(phase)*0.1, fitMaximaArgs[1], len(phase)*0.9)
|
||||
print(fitMaximaArgs[0] > len(phase)*0.1, fitMaximaArgs[1] < len(phase)*0.9)
|
||||
if(len(fitMaximaArgs) == 2 and fitMaximaArgs[0] > len(phase)*0.1 and fitMaximaArgs[1] < len(phase)*0.9):
|
||||
halfPeriod = period/2
|
||||
for lsP, blsP in zip(lsPeriods, blsPeriods):
|
||||
if(abs(lsP.value - halfPeriod) < period*0.05):
|
||||
@@ -454,9 +456,23 @@ def getOptimizedFold(normalizedLC, preferedFoldedFitType):
|
||||
|
||||
fitMinimaArgs = argrelextrema(np.asarray(fit), np.less)[0]
|
||||
fitMinima = phase[0]
|
||||
fitMinimaArg = 0
|
||||
|
||||
newFitMinimaArgs = []
|
||||
for args in fitMinimaArgs:
|
||||
if(abs(phase[args]) < abs(fitMinima)):
|
||||
print("Phases: ", fit[0], fit[len(phase)-1], fit[args])
|
||||
if(fit[0] < fit[args] and fit[len(fit)-1] < fit[args]):
|
||||
print("Found new minima")
|
||||
newFitMinimaArgs.append(0)
|
||||
newFitMinimaArgs.append(args)
|
||||
|
||||
newFitMinimaArgs = set(newFitMinimaArgs)
|
||||
print(newFitMinimaArgs)
|
||||
|
||||
for args in newFitMinimaArgs:
|
||||
if(abs(phase[args]) < abs(fitMinima) and fit[args] < fit[fitMinimaArg]):
|
||||
fitMinima = phase[args]
|
||||
fitMinimaArg = args
|
||||
|
||||
if(abs(fitMinima) < phaseLength*0.01):
|
||||
isValid = True
|
||||
|
||||
Reference in New Issue
Block a user