flaredetector: move plotting functions to util

This commit is contained in:
2024-04-17 08:55:42 +02:00
parent ef455dcfbb
commit 57e454cb3b
2 changed files with 17 additions and 17 deletions
-16
View File
@@ -40,22 +40,6 @@ def calculateFlareFitsForLightcurve(lightcurve, num=100, distance=1, height=0.05
return peaks, fits return peaks, fits
def plotFlarePeaks(ax, peaks, flux = None):
if(flux is None):
for peak in peaks:
ax.plot(peak["FlarePeakTime"], peak["FlarePeak"], "x", color="red")
else:
for peak in peaks:
ax.plot(peak["FlarePeakTime"], flux[peak["StandardIndex"]], "x", color="red")
def plotFlareFits(ax, fits):
for fit in fits:
ax.plot(fit["FlareFitTime"], fit["FlareFit"], "g--")
def markFlare(ax, fits, flux):
for fit in fits:
ax.plot(fit["FlareFitTime"], flux[fit["StandardIndex"]], color="red")
def getFlareRange(flux, peakIndex): def getFlareRange(flux, peakIndex):
minInd = -np.inf minInd = -np.inf
maxInd = np.inf maxInd = np.inf
+16
View File
@@ -18,3 +18,19 @@ def findMaxIndices(lc, num=3, distance=100, height=(None, None), sortByHighest=F
return peak_indices[np.argsort(peak_heights)[-num:][::-1]] return peak_indices[np.argsort(peak_heights)[-num:][::-1]]
else: else:
return peak_indices[0:num] return peak_indices[0:num]
def plotFlarePeaks(ax, peaks, flux = None):
if(flux is None):
for peak in peaks:
ax.plot(peak["FlarePeakTime"], peak["FlarePeak"], "x", color="red")
else:
for peak in peaks:
ax.plot(peak["FlarePeakTime"], flux[peak["StandardIndex"]], "x", color="red")
def plotFlareFits(ax, fits):
for fit in fits:
ax.plot(fit["FlareFitTime"], fit["FlareFit"], "g--")
def markFlare(ax, fits, flux):
for fit in fits:
ax.plot(fit["FlareFitTime"], flux[fit["StandardIndex"]], color="red")