For context, this graph represents the EAR (Eye Aspect Ratio) of my eye throughout a video, and the clear steep drops represent blinks. When I blink, the EAR rapidly decreases and increases again, since EAR measures how open my eye is. Given a 1D array of points, how would I detect the local minima that are representative of my blinks? In this example, it would detect all 5 blinks.
I tried this:
import numpy as np
from scipy.signal import find_peaks
# Invert the data to find local minima
inverted_data = -np.array(seq)
# Use find_peaks from SciPy to find the peaks in the inverted data
# Adjust the 'distance' parameter as needed for your dataset
peaks, _ = find_peaks(inverted_data, distance=5, height=-0.2)
print(peaks)
# The number of local minima is the length of the peaks array
number_of_minima = len(peaks)
print("Number of local minima:", number_of_minima)
But it didn't work very well because although the distance parameter is helpful, and potentially a good start, the height parameter is representative of the minimum EAR it takes to be considered a blink, and this varies for different eyes.

Demonstrating a very simple band-pass filter with some bogus data; comments inline: