flaredetector: move plotting functions to util
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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")
|
||||||
Reference in New Issue
Block a user