Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesscipy.signal.find_peaks locates local maxima in a one-dimensional sampled signal and can filter them by amplitude, spacing, prominence, width, or flat-top size. Its output locations are sample indices—not timestamps—so choose conditions in the right units and map the results to your signal’s time axis when needed.
What SciPy’s find_peaks returns
The function compares neighboring samples to identify local maxima. A sample qualifies when its two direct neighbors have lower values. For a flat-topped peak, SciPy returns the middle sample; if the plateau has an even number of samples, it returns the middle position rounded down. See the SciPy 1.17.0 find_peaks documentation.
As an Amazon Associate I earn from qualifying purchases.
The function returns two objects: an array of integer indices and a dictionary of property arrays. The indices point into the original input, so you can retrieve the peak amplitudes with signal[peaks]. Properties appear when their corresponding conditions are evaluated; they are not all necessarily calculated for every call.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →How to use scipy.signal.find_peaks
Pass a one-dimensional signal and conditions that reflect what counts as a meaningful peak for your data:
#1 Best Overall
from scipy.signal import find_peaks
peaks, properties = find_peaks(
signal,
prominence=minimum_prominence,
distance=minimum_spacing_samples,
width=minimum_width_samples,
)
peak_values = signal[peaks]
The names ending in _samples are reminders: distance and width are measured in samples, not seconds. If the sampling rate is fs samples per second, convert a time interval t to a sample count using t * fs, then choose an integer condition value as appropriate. The function does not take a sampling-rate argument. To get peak times, index your own time coordinate with peaks; with a uniform sampling interval, derive times from the sample indices and that interval.
Choose the right peak condition
height, threshold, and prominence express different ideas. Treating them as interchangeable is a common cause of confusing results.
Rank #2
| Condition | What it measures | When it helps |
|---|---|---|
height |
Peak amplitude in the original signal’s units. | Use when an absolute amplitude cutoff has meaning, such as excluding peaks below a known level. |
threshold |
Vertical difference between the peak and its immediate neighboring samples. | Use to require local contrast. It is not a baseline-relative measure. |
distance |
Minimum horizontal separation between retained peak indices, in samples. | Use to enforce spacing. If peaks are too close, smaller peaks are removed first. |
prominence |
Vertical distance from a peak down to its lowest surrounding contour line. | Useful when a peak should stand out from its surroundings despite a changing baseline. |
width |
Peak width in samples at a level determined by rel_height. |
Use to select peaks by breadth. State rel_height when interpreting or reporting widths; do not assume this is always full width at half maximum. |
plateau_size |
Flat-top extent in samples. | Use when the duration of a flat maximum matters. This condition was introduced in SciPy 1.2.0. |
Except for distance, conditions can take lower and upper bounds. Several also accept arrays shaped like the signal, allowing position-dependent limits. For applicable properties, the open interval (None, None) requests property calculation without excluding peaks. SciPy evaluates conditions in this order: plateau_size, height, threshold, distance, prominence, and width.
Recommended Free Tools
Understand find_peaks prominence and wlen
Prominence describes how far a peak rises above its surrounding contour, rather than how high it is in absolute terms. For each peak, SciPy extends a horizontal line outward until it reaches the window boundary or the slope of a higher peak. It finds the minimum on each side; the higher of those two minima defines the contour line. The prominence is the vertical distance from that line to the peak. The SciPy 1.18.0 peak_prominences documentation describes this calculation.
wlen limits the region searched for prominence, and can also affect width calculations. A shorter window may reduce work on long or periodic signals, but it can prevent the search from reaching the contour that would be found over a wider region. The resulting prominence can therefore be smaller and more local. Choose wlen based on whether you want local or broader-context prominence, not solely as a speed setting.
Interpret example settings in context
SciPy’s manuals show ECG examples using height=0 and distance=150, and a separate ECG segment using prominence=1 and width=20. These are settings for the manual’s example data, not recommended defaults for other recordings. In particular, a sample spacing of 150 corresponds to different time intervals at different sampling rates. See the SciPy 1.15.3 find_peaks examples.
Prepare noisy or incomplete signals deliberately
- Noise: Noise can shift the locations of local maxima. If you smooth or otherwise preprocess a signal, choose a method that preserves the feature you want to detect and document that processing. SciPy also points to alternatives such as
find_peaks_cwt; neither preprocessing nor an alternative is automatically appropriate for every signal. - NaNs: NaNs can lead to unexpected prominence results. Remove them, replace them under a justified rule, or process valid segments separately before interpreting peaks. The handling choice can affect the result.
- Flat peaks and spacing:
distanceconstrains the returned peak indices. The edges of flat plateaus can still be closer than that spacing. - Boundary context: A peak near a signal boundary or a restricted
wlenhas less surrounding data available for contextual prominence calculations. Interpret the resulting value in light of that limited search region.
When to consider another SciPy method
find_peaks fits one-dimensional sampled data when its neighboring-sample definition and optional filters match the task. SciPy also lists argrelmax, argrelextrema, find_peaks_cwt, peak_prominences, and peak_widths in its signal-processing function index. Consider the expected peak shape and width, noise level, boundary behavior, missing values, and whether you need local maxima, prominence, or wavelet-scale detection before switching methods; no single method is universally best.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

