SkillAgentSearch skills...

Findpeaks

The detection of peaks and valleys in a 1d-vector or 2d-array (image)

Install / Use

/learn @erdogant/Findpeaks

README

findpeaks

Python Pypi Docs LOC Downloads Downloads License Forks Issues Project Status DOI Colab Medium Donate

<div> <a href="https://erdogant.github.io/findpeaks/"><img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/logo.png" width="125" align="left" /></a> findpeaks is a comprehensive Python library for robust detection and analysis of peaks and valleys in both 1D vectors and 2D arrays (images). The library provides multiple detection algorithms including topology-based persistent homology (most robust), mask-based local maximum filtering, and traditional peakdetect approaches. It can be used for time series analysis, signal processing, image analysis, and spatial data. ⭐️Star it if you like it⭐️ </div>

Star History

Star History Chart


Key Features

| Feature | Description | Medium | Gumroad & Podcast | |--------|-------------| - | - | | Topology Detection | Mathematically grounded peak detection using persistent homology. | - | - | | Peakdetect Method | Peak detection algorithm for noisy signals. | link | link | | Mask Detection | Local maximum filtering for 2D image analysis. | - | - | | Caerus Method | Specialized algorithm for financial time series analysis. | - | - | | Preprocessing | Denoising, scaling, interpolation, and image preprocessing. | - | - | | Visualization | Rich plotting capabilities including persistence diagrams and 3D mesh plots. | - | - |


Resources and Links


Background

  • Topology Method: The most robust detection method based on persistent homology from topological data analysis. It quantifies peak significance through persistence scores and provides mathematically stable results even in noisy data.

  • Peakdetect Method: Traditional algorithm that excels at finding local maxima and minima in noisy signals without requiring extensive preprocessing. Uses a lookahead approach to distinguish between true peaks and noise-induced fluctuations.

  • Mask Method: Local maximum filtering approach specifically designed for 2D data (images). Employs 8-connected neighborhood analysis and background removal for spatial peak detection.

  • Preprocessing Pipeline: Comprehensive preprocessing capabilities including interpolation, denoising (Lee, Frost, Kuan filters), scaling, and image resizing to improve detection accuracy.


Installation

Install findpeaks from PyPI
pip install findpeaks
Install from Github source
pip install git+https://github.com/erdogant/findpeaks
Import Library
import findpeaks
print(findpeaks.__version__)

# Import library
from findpeaks import findpeaks

Quick Start

# Import library
from findpeaks import findpeaks

# Initialize with topology method (most robust)
fp = findpeaks(method='topology')

# Example data
X = fp.import_example('1dpeaks')

# Peak detection
results = fp.fit(X)

# Plot results
fp.plot()

# Plot persistence diagram
fp.plot_persistence()

Examples

1D Signal Analysis

<p align="left"> <a href="https://erdogant.github.io/findpeaks/pages/html/Examples.html#find-peaks-in-low-sampled-dataset"> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/fig1_raw.png" width="400" /> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/fig1_interpol.png" width="400" /> </a> </p> <p align="left"> <a href="https://erdogant.github.io/findpeaks/pages/html/Examples.html#comparison-methods-1"> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/fig2_peakdetect_int.png" width="400" /> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/fig2_topology_int.png" width="400" /> </a> </p> <p align="left"> <a href="https://erdogant.github.io/findpeaks/pages/html/Examples.html#find-peaks-in-high-sampled-dataset"> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/fig3.png" width="600" /> </a> </p> <p align="left"> <a href="https://erdogant.github.io/findpeaks/pages/html/Examples.html#find-peaks-in-high-sampled-dataset"> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/fig3_persistence_limit.png" width="600" /> </a> </p>

2D Image Analysis

<p align="left"> <a href="https://erdogant.github.io/findpeaks/pages/html/Examples.html#d-array-image"> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/2dpeaks_raw.png" width="115" /> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/2dpeaks_mask.png" width="500" /> </a> </p> <p align="left"> <a href="https://erdogant.github.io/findpeaks/pages/html/Plots.html#d-mesh"> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/2dpeaks_mesh1.png" width="400" /> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/2dpeaks_mesh2.png" width="400" /> </a> </p>

Financial Time Series

<p align="left"> <a href="https://erdogant.github.io/findpeaks/pages/html/Use-cases.html#facebook-stocks"> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/fig_facebook_minperc5.png" width="600" /> </a> </p>

SAR/SONAR Image Processing

<p align="left"> <a href="https://erdogant.github.io/findpeaks/pages/html/Use-cases.html#sonar"> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/sonar_plot.png" width="600" /> </a> </p> <p align="left"> <a href="https://erdogant.github.io/findpeaks/pages/html/Use-cases.html#sonar"> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/sonar_mesh1.png" width="300" /> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/sonar_mesh2.png" width="300" /> </a> </p> <p align="left"> <a href="https://erdogant.github.io/findpeaks/pages/html/Use-cases.html#sonar"> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/sonar_mesh3.png" width="300" /> <img src="https://github.com/erdogant/findpeaks/blob/master/docs/figs/sonar_mesh4.png" width="300" /> </a> </p>

Image Denoising

<p
View on GitHub
GitHub Stars286
CategoryProduct
Updated15d ago
Forks38

Languages

Jupyter Notebook

Security Score

85/100

Audited on Mar 17, 2026

No findings