Avatar ·

Finding positive peaks of a function

📁 Advanced Python Topics, AI, work

It is required to programmatically find the number and location of positive peaks on the graph.
It is known that the number of peaks is odd. Usually 3, 5 or 7. In this case, 3. It is also known that each positive peak is followed by a negative one.
What is the best way to solve this problem in Python? Preferably without coefficient tuning
Addition: The data always starts with a positive peak and ends with a negative one.
The data is a vertical projection of an image processed by the function np.gradient(projection)/projection. That is, the ratio of the second derivative of the function to its height.