CalcAllFlaresThread: set proper plot description sizes
This commit is contained in:
@@ -15,6 +15,18 @@ from errno import EEXIST
|
||||
from os import makedirs, path
|
||||
from datetime import datetime
|
||||
|
||||
SMALL_SIZE = 16
|
||||
MEDIUM_SIZE = 18
|
||||
BIGGER_SIZE = 20
|
||||
|
||||
plt.rc('font', size=SMALL_SIZE) # controls default text sizes
|
||||
plt.rc('axes', titlesize=MEDIUM_SIZE) # fontsize of the axes title
|
||||
plt.rc('axes', labelsize=MEDIUM_SIZE) # fontsize of the x and y labels
|
||||
plt.rc('xtick', labelsize=SMALL_SIZE) # fontsize of the tick labels
|
||||
plt.rc('ytick', labelsize=SMALL_SIZE) # fontsize of the tick labels
|
||||
plt.rc('legend', fontsize=SMALL_SIZE) # legend fontsize
|
||||
plt.rc('figure', titlesize=BIGGER_SIZE) # fontsize of the figure title
|
||||
|
||||
def mkdir_p(mypath):
|
||||
'''Creates a directory. equivalent to using mkdir -p on the command line'''
|
||||
|
||||
@@ -48,13 +60,13 @@ def getFlareCount(filesDict):
|
||||
|
||||
lc.plot()
|
||||
plt.title(f"{starName} - normalized lightcurve")
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-lc.png")
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-lc.png", bbox_inches="tight")
|
||||
plt.close()
|
||||
|
||||
flattenedLc = lc.flatten()
|
||||
flattenedLc.plot()
|
||||
plt.title(f"{starName} - flattened lightcurve")
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-flattened_lc.png")
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-flattened_lc.png", bbox_inches="tight")
|
||||
plt.close()
|
||||
|
||||
pdcsapPeaks, pdcsapFits = calculateFlareFitsForLightcurve(flattenedLc, normalizedLC=lc)
|
||||
@@ -64,7 +76,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}_{source}-{sequence}-lc-marked_flares.png")
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-lc-marked_flares.png", bbox_inches="tight")
|
||||
plt.close()
|
||||
|
||||
flattenedLc.plot()
|
||||
@@ -76,7 +88,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}_{source}-{sequence}-flattened_lc-marked_flares.png")
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-flattened_lc-marked_flares.png", bbox_inches="tight")
|
||||
plt.close()
|
||||
|
||||
pdcsapValSec, pdcsapTds = getTotalValidDataInSeconds(lc, "pdcsap_flux")
|
||||
@@ -86,7 +98,7 @@ def getFlareCount(filesDict):
|
||||
|
||||
pdcsapPeriodogram.plot(view="period")
|
||||
plt.plot(pdcsapPeakPeriod, pdcsapPeriodogram.power[maxPeriodIndex], "x", color="red")
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-periodogram-marked_max.png")
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-periodogram-marked_max.png", bbox_inches="tight")
|
||||
plt.close()
|
||||
|
||||
#pdcsapEpochTime = getEpochTime(lc)
|
||||
@@ -108,7 +120,7 @@ def getFlareCount(filesDict):
|
||||
optimizedFit["foldedLC"].flux[optimizedFit["foldedLC"].cycle == cycle][foldedIndex], "x", color="red")
|
||||
plt.plot([], [], "x", color="red", label="Flare peaks")
|
||||
plt.legend()
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-foldedLC-marked_fit_flares.png")
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-foldedLC-marked_fit_flares.png", bbox_inches="tight")
|
||||
plt.close()
|
||||
|
||||
if(optimizedFit["periodFoldedLC"] is not None):
|
||||
@@ -123,7 +135,7 @@ def getFlareCount(filesDict):
|
||||
optimizedFit["periodFoldedLC"].flux[optimizedFit["periodFoldedLC"].cycle == cycle][foldedIndex], "x", color="red")
|
||||
plt.plot([], [], "x", color="red", label="Flare peaks")
|
||||
plt.legend()
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-periodFoldedLC-marked_fit_flares.png")
|
||||
plt.savefig(f"{starFolder}/{starNameR}_{source}-{sequence}-periodFoldedLC-marked_fit_flares.png", bbox_inches="tight")
|
||||
plt.close()
|
||||
|
||||
filesDict["pdcsapPeaks"] = pdcsapPeaks
|
||||
|
||||
@@ -301,8 +301,8 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
||||
phase, sineFit, _ = getFoldedBestFit(lc, fitType=self.foldedFitType)
|
||||
self.figureAxis.plot(phase, sineFit, color="red")
|
||||
print(phase, sineFit)
|
||||
minPhasesBoundsIndices, maxPhasesBoundsIndices = getPhaseRangesNearPeak(getFoldedFitPeakValley(sineFit), phase)
|
||||
plotPhaseRangesNearPeak((minPhasesBoundsIndices, maxPhasesBoundsIndices), phase, ax=self.figureAxis)
|
||||
#minPhasesBoundsIndices, maxPhasesBoundsIndices = getPhaseRangesNearPeak(getFoldedFitPeakValley(sineFit), phase)
|
||||
#plotPhaseRangesNearPeak((minPhasesBoundsIndices, maxPhasesBoundsIndices), phase, ax=self.figureAxis)
|
||||
except Exception as e:
|
||||
print("Failed to get fit")
|
||||
print(e)
|
||||
|
||||
Reference in New Issue
Block a user