I am just starting to use scipy's signal functions.
In the attached image, I am trying find the position of the co-ordinates A[n] where the curve intersects an arbitrary threshold (left and right of the detected peak). Using peak_widths
gives the points B[n] where the B's are at some relative peak position. I am looking for the A[n] where it is at a fixed threshold.
How do I solve this? I can't add inline pictures yet as I am new to Stack exchange. Image attached. Thanks in advance.
Annotated Plot from Code below
x = np.linspace(0, 6 * np.pi, 1000)
x = np.sin(x) #+ 0.6 * np.sin(2.6 * x)
peaks, _ = find_peaks(x,height=0.5)
threshold = 0.3
results_half = peak_widths(x, peaks, rel_height=0.5)
results_half[0] # widths
plt.plot(x)
plt.plot(peaks, x[peaks], "x",color='r')
plt.hlines(*results_half[1:], color="C2")
plt.axhline(threshold,color='green')