flaredetector: util: add function to plot peak/valley areas

This commit is contained in:
2024-07-02 12:01:40 +02:00
parent 29e7e3e847
commit 1b33052c34
+20
View File
@@ -139,3 +139,23 @@ def getPhaseRangesNearPeak(maxArgs, phase):
maxPhaseBoundsIndices.append([findNearestIndexOfValue(phase, lv) for lv in l]) maxPhaseBoundsIndices.append([findNearestIndexOfValue(phase, lv) for lv in l])
return minPhaseBoundsIndices, maxPhaseBoundsIndices return minPhaseBoundsIndices, maxPhaseBoundsIndices
def plotPhaseRangesNearPeak(indices, phase, ax=None):
minPhaseBoundsIndices = indices[0]
maxPhaseBoundsIndices = indices[1]
if(ax is None):
import matplotlib.pyplot as plt
for pair in minPhaseBoundsIndices:
for l in pair:
plt.axes.axvline(phase[l], color="violet")
for pair in maxPhaseBoundsIndices:
for l in pair:
plt.axes.axvline(phase[l], color="orange")
else:
for pair in minPhaseBoundsIndices:
for l in pair:
ax.axvline(phase[l], color="violet")
for pair in maxPhaseBoundsIndices:
for l in pair:
ax.axvline(phase[l], color="orange")