Skip to main content

Build Status Coverage Status

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, 5, 588-603

Peak finding

Usage

Install from PyPI:

pip install pyampd

Or install from source:

pip install git+https://github.com/ig248/pyampd

Import function:

from pyampd.ampd import find_peaks

See 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.

Original implementation

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 find_peaks_original.

Tests

Run

pytest

Other implementations

Improvements

This Python implementation provides significant speed-ups in two areas:

  1. Efficient tracking of local minima without using random numbers
  2. Introduction of maximum window size, reducing algorithm run-time from quadratic to linear in the number of samples.
  3. Better handling of peaks near start/end of the series
  4. Addition of new Adaptive Scale Selection

ToDo

  • It may be possible to avoid repeated comparisons, and reduce worst-case runtime from O(n^2) to O(n log(n)).
  • find_peaks_adaptive could benefit from specifying both window and max_scale

References

Original paper: https://doi.org/10.1109/ICRERA.2016.7884365

Metadata

Release files for pyampd 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyampd 0.0.1
File Size Uploaded Provenance
pyampd-0.0.1.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pyampd 0.0.1
File Interpreter ABI Platform
pyampd-0.0.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 9.7 kB

Release files / pyampd-0.0.1.tar.gz

Download URL pyampd-0.0.1.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e333d00b61d2844b0ed0383b010394e0a0cb384a036dd83960cdc647cf71a755
BLAKE2b-256 checksum
How to use checksums
51976a56d7ed7d1ed5cb25c4643cb327a1903438587991fe364ac6042c2b837d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15

Release files / pyampd-0.0.1-py2.py3-none-any.whl

Download URL pyampd-0.0.1-py2.py3-none-any.whl
Size 5.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d923a4372308d447b98cd80f935a059e29323777dd26c0ac131945ad84f5f89c
BLAKE2b-256 checksum
How to use checksums
53b5587d52d43aa803c20743fd23e2bcbb454a06694c5645de741311678c8750
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/2.7.15

Security for pyampd 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page