Sliding Window Peak Detector
Detect peaks in a noisy sensor stream using a sliding window: a sample is a peak if it is the maximum in its window and exceeds a threshold above the window mean.
Constraints
- Window size is odd; the sample under test is the centre.
- Edges where a full window is unavailable are skipped.
- Return the list of peak indices.
- Threshold is expressed in absolute units above the window mean.
- Adjacent peaks within half a window must be collapsed to the largest.
1def find_peaks(signal, window=5, threshold=1.0):2 # TODO3 return []