Compare commits
3 Commits
447c353844
...
557ae476e5
| Author | SHA1 | Date | |
|---|---|---|---|
| 557ae476e5 | |||
| 208e619ce7 | |||
| 53fcdc541e |
Binary file not shown.
@@ -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()
|
||||
|
||||
@@ -66,7 +66,10 @@ class FlaredetectorWidget(QtWidgets.QWidget):
|
||||
print(f"Plotting: {fitsFilePath}")
|
||||
self.currentLC = lk.read(fitsFilePath)
|
||||
if(isinstance(self.currentLC, lk.lightcurve.KeplerLightCurve)):
|
||||
print(f"Kepler Quarter: {self.currentLC.hdu[0].header['QUARTER']}")
|
||||
try:
|
||||
print(f"Kepler Quarter: {self.currentLC.hdu[0].header['QUARTER']}")
|
||||
except:
|
||||
print("K2 Data, no QUARTER in header")
|
||||
self.currentLCCollection = None
|
||||
self.currentMainName = mainName
|
||||
self.updateFit()
|
||||
|
||||
Reference in New Issue
Block a user