PeakUtils

raw JSON →
1.3.5 verified Fri May 01 auth: no python maintenance

Peak detection and analysis utilities for 1D data. Provides functions to find peaks, estimate parameters, and filter peaks. Current version 1.3.5; no recent releases, appears to be in maintenance mode.

pip install peakutils
error ImportError: No module named 'peakutils'
cause Package not installed or Python environment mismatch.
fix
Run 'pip install peakutils' and ensure you're using the correct Python interpreter.
error AttributeError: module 'peakutils' has no attribute 'indexes'
cause Importing the wrong module or outdated version.
fix
Install/upgrade peakutils: 'pip install --upgrade peakutils'. Then use 'peakutils.indexes()'.
error peakutils.peak.indexes() got an unexpected keyword argument 'thres'
cause Mistakenly using 'peakutils.peak.indexes' instead of 'peakutils.indexes'.
fix
Use 'peakutils.indexes(y, thres=0.5)' directly, not via peak submodule.
gotcha The default interpolation method for peak coordinates is deprecated. Use centroid or parabolic methods explicitly.
fix peakutils.peak.interpolate(x, y, ind=None, width=5, method='centroid')
gotcha The 'thres' parameter is a relative threshold, not absolute. It multiplies the range of the data (max - min).
fix Set thres=0.5 to require peaks to be at least 50% of the data range above baseline.
breaking Removed 'peakutils.envelope' function in version 1.3 (previously available).
fix Use scipy.signal.hilbert or custom code; no direct replacement in peakutils.

Basic peak detection in 1D data using threshold and minimum distance.

import numpy as np
import peakutils

# Generate sample data
data = np.random.randn(100).cumsum()
# Peak detection
indices = peakutils.indexes(data, thres=0.5, min_dist=10)
print('Peak indices:', indices)