From 53fcdc541e70b10634f4a5575f0e37e9b6f8afae Mon Sep 17 00:00:00 2001 From: SGCMarkus Date: Thu, 28 Nov 2024 10:00:56 +0100 Subject: [PATCH] CalcAllFlaresThread: add source to filename --- main/astrodatagui/CalcAllFlaresThread.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/main/astrodatagui/CalcAllFlaresThread.py b/main/astrodatagui/CalcAllFlaresThread.py index 02850c2..4ea054b 100644 --- a/main/astrodatagui/CalcAllFlaresThread.py +++ b/main/astrodatagui/CalcAllFlaresThread.py @@ -36,6 +36,7 @@ def getFlareCount(filesDict): print(f"Starting {filesDict['StarName']}, {filesDict['Sequence']}") starName = filesDict['StarName'] starNameR = filesDict['StarName'].replace("*", "_star_") + source = filesDict['Source'] sequence = filesDict['Sequence'] starFolder = f"{folderPath}/stars/{starNameR}/" mkdir_p(starFolder) @@ -66,13 +67,13 @@ def getFlareCount(filesDict): lc.plot() plt.title(f"{starName} - normalized lightcurve") - plt.savefig(f"{starFolder}/{starNameR}_{sequence}-lc.png") + plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-lc.png") plt.close() flattenedLc = lc.flatten() flattenedLc.plot() plt.title(f"{starName} - flattened lightcurve") - plt.savefig(f"{starFolder}/{starNameR}_{sequence}-flattened_lc.png") + plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-flattened_lc.png") plt.close() pdcsapPeaks, pdcsapFits = calculateFlareFitsForLightcurve(flattenedLc, normalizedLC=lc) @@ -82,7 +83,7 @@ def getFlareCount(filesDict): plt.plot(p["FlarePeakTime"].value, lc.flux[p["StandardIndex"]], "x", color="red") plt.plot([], [], "x", color="red", label="Flare peaks") plt.legend() - plt.savefig(f"{starFolder}/{starNameR}_{sequence}-lc-marked_flares.png") + plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-lc-marked_flares.png") plt.close() flattenedLc.plot() @@ -94,7 +95,7 @@ def getFlareCount(filesDict): plt.plot(p["FlarePeakTime"].value, p["FlarePeak"], "x", color="red") plt.plot([], [], "x", color="red", label="Flare peaks") plt.legend() - plt.savefig(f"{starFolder}/{starNameR}_{sequence}-flattened_lc-marked_flares.png") + plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-flattened_lc-marked_flares.png") plt.close() pdcsapValSec, pdcsapTds = getTotalValidDataInSeconds(lc, "pdcsap_flux") @@ -104,7 +105,7 @@ def getFlareCount(filesDict): pdcsapPeriodogram.plot(view="period") plt.plot(pdcsapPeakPeriod, pdcsapPeriodogram.power[maxPeriodIndex], "x", color="red") - plt.savefig(f"{starFolder}/{starNameR}_{sequence}-periodogram-marked_max.png") + plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-periodogram-marked_max.png") plt.close() pdcsapEpochTime = getEpochTime(lc) @@ -126,7 +127,7 @@ def getFlareCount(filesDict): pdcsapFoldedLC.flux[pdcsapFoldedLC.cycle == cycle][foldedIndex], "x", color="red") plt.plot([], [], "x", color="red", label="Flare peaks") plt.legend() - plt.savefig(f"{starFolder}/{starNameR}_{sequence}-foldedLC-marked_fit_flares.png") + plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-foldedLC-marked_fit_flares.png") plt.close() @@ -161,7 +162,7 @@ def getFlareCount(filesDict): filesDict["pdcsapPeriodMaxima"] = pdcsapMaxima filesDict["pdcsapPeriodMaximaBoundaries"] = pdcsapmaxPhasesBounds - csvFile = open(f"{starFolder}/{starNameR}_{sequence}.csv", "a") + 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']},{pdcsapFitType}") csvFile.close()