Peak detection using AMPD and ASS-AMPD algorithms
AMPD algorithm in Python
Implements a function
find_peaks based on the Automatic Multi-scale
Peak Detection algorithm proposed by Felix Scholkmann et al. in
"An Efficient Algorithm for Automatic Peak Detection in
Noisy Periodic and Quasi-Periodic Signals", Algorithms 2012,
Install from PyPI:
pip install pyampd
Or install from source:
pip install git+https://github.com/ig248/pyampd
from pyampd.ampd import find_peaks
notebooks/ampd.ipynb for usage examples.
Specifying maximum scale
To improve run-time on large time-series, it is possible to specify the maximum scale to consider:
peaks = find_peaks(x, scale=100)
will only consider windows up to +-100 point either side of peak candidates.
Adaptive Scale Selection
If the characteristic scale of the signal changes over time, a new algorithm called Adaptive Scale Selection can track the changes in optimal scales and detect peaks accordingly:
peaks = find_peaks_adaptive(x, window=200)
will select the optimal scale at each point using a 200-point running window.
find_peaks is not identical to the algorithm proposed in the original paper (especially near start and end of time series).
A performance-optimized version of the original implementation is provided in
- R: https://cran.r-project.org/web/packages/ampd/index.html
- MATLAB: https://github.com/mathouse/AMPD-algorithm
- Python: https://github.com/LucaCerina/ampdLib
This Python implementation provides significant speed-ups in two areas:
- Efficient tracking of local minima without using random numbers
- Introduction of maximum window size, reducing algorithm run-time from quadratic to linear in the number of samples.
- Better handling of peaks near start/end of the series
- Addition of new Adaptive Scale Selection
- It may be possible to avoid repeated comparisons, and reduce worst-case
find_peaks_adaptivecould benefit from specifying both
Original paper: https://doi.org/10.1109/ICRERA.2016.7884365
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size pyampd-0.0.1-py2.py3-none-any.whl (5.1 kB)||File type Wheel||Python version py2.py3||Upload date||Hashes View|
|Filename, size pyampd-0.0.1.tar.gz (4.6 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for pyampd-0.0.1-py2.py3-none-any.whl