i can't find easy way to get minima related to a density curve. With this kind of data :
import matplotlib.pyplot as plt
from scipy.misc import electrocardiogram
from scipy.signal import find_peaks
import seaborn as sns
test = [7, 7, 7, 7, 8, 7, 7, 7, 7, 7, 7, 8, 8, 8, 7, 7, 7, 8, 7, 7, 8, 7, 7, 8, 7, 7, 8, 7, 8, 7, 7, 8, 7, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 8, 7, 4, 4, 7, 8, 7]
sns.kdeplot(test)
i would like to get the last inflection point related to the last "peak", in this situation it would be a minima around x=8. I tried function like get_peaks but this is not doing the job because i need to get all the values after this last inflection point and in some situation, like this one :
test2 = [8, 7, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 7, 7, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 7, 7, 7, 7, 7, 8, 12]
get_peaks didn't give me the last number.
My idea would be to get the x position of the last minima and after being able to get all the number higher than the minima.