diff --git a/.gitignore b/.gitignore
index 8dc0421..21ea7ea 100755
--- a/.gitignore
+++ b/.gitignore
@@ -56,4 +56,6 @@ docs/_build/
# PyBuilder
target/
-venv/
\ No newline at end of file
+venv/
+
+tests/mlpy-code
diff --git a/README.md b/README.md
index 4826fb8..7554e91 100755
--- a/README.md
+++ b/README.md
@@ -13,6 +13,8 @@ This is an overview of all the ready-to-use algorithms I've found to perform pea
| [Octave-Forge findpeaks](#octave-forge-findpeaks) | Requires an Octave-Forge distribution
+ PyPI package oct2py
Depends on Scipy | Minimum distance
Minimum height
Minimum peak width | ✘ |
| [Janko Slavic findpeaks](#janko-slavic-findpeaks) | Single function
Depends on Numpy | Minimum distance
Minimum height | ✘ |
| [Tony Beltramelli detect_peaks](#tony-beltramelli-detect_peaks) | Single function
Depends on Numpy | Amplitude threshold | ✘ |
+| [mlpy.findpeaks_dist](#mlpyfindpeaks_dist) | Included in mlpy
Depends on Scipy and GSL | Minimum distance | ✘ |
+| [mlpy.findpeaks_win](#mlpyfindpeaks_win) | Single function
Depends on Scipy and GSL | Sliding window width | ✘ |
## How to make your choice?
@@ -251,6 +253,44 @@ Straightforward, simple and lightweight peak detection algorithm, with minimum d
No minimum peak height filtering support.
+## mlpy.findpeaks_dist
+
+![](/images/mlpy_findpeaks_dist.png?raw=true "mlpy.findpeaks_dist")
+
+```python
+import numpy as np
+import scipy.signal
+vector = [0, 6, 25, 20, 15, 8, 15, 6, 0, 6, 0, -5, -15, -3, 4, 10, 8,
+ 13, 8, 10, 3, 1, 20, 7, 3, 0]
+print('Detect peaks with minimum distance filter.')
+indexes = mlpy.findpeaks_dist(vector, mindist=2.1)
+print('Peaks are: %s' % (indexes))
+```
+
+[Documentation](http://mlpy.sourceforge.net/docs/3.5/findpeaks.html#mlpy.findpeaks_dist).
+[Sample code](/tests/mlpy_findpeaks_dist.py).
+
+Find peaks, with a minimum distance filter between peaks. Code written by Davide Albanese.
+
+## mlpy.findpeaks_win
+
+![](/images/mlpy_findpeaks_win.png?raw=true "mlpy.findpeaks_win")
+
+```python
+import numpy as np
+import scipy.signal
+vector = [0, 6, 25, 20, 15, 8, 15, 6, 0, 6, 0, -5, -15, -3, 4, 10, 8,
+ 13, 8, 10, 3, 1, 20, 7, 3, 0]
+print('Detect peaks with sliding window of 5.')
+indexes = mlpy.findpeaks_win(vector, span=5)
+print('Peaks are: %s' % (indexes))
+```
+
+[Documentation](http://mlpy.sourceforge.net/docs/3.5/findpeaks.html#mlpy.findpeaks_win).
+[Sample code](/tests/mlpy_findpeaks_win.py).
+
+Find peaks, with a sliding window of specified width. Code written by Davide Albanese.
+
----------------------------------
# How to find both lows and highs?
diff --git a/images/mlpy_findpeaks_dist.png b/images/mlpy_findpeaks_dist.png
new file mode 100644
index 0000000..2bbcab3
Binary files /dev/null and b/images/mlpy_findpeaks_dist.png differ
diff --git a/images/mlpy_findpeaks_win.png b/images/mlpy_findpeaks_win.png
new file mode 100644
index 0000000..f7214b0
Binary files /dev/null and b/images/mlpy_findpeaks_win.png differ
diff --git a/tests/install_mlpy.sh b/tests/install_mlpy.sh
new file mode 100755
index 0000000..78c67cf
--- /dev/null
+++ b/tests/install_mlpy.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+set -e
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+MLPY_DIR="$DIR/mlpy-code"
+
+# Pulling code.
+if [ -d "$MLPY_DIR" ]; then
+ cd $MLPY_DIR && hg pull
+else
+ hg clone http://hg.code.sf.net/p/mlpy/code $MLPY_DIR
+fi
+
+# We try to install mlpy on Python 2, as the install is not compatible with Python 3.7+.
+# (CPython must be updated to support Python 3.7+. See https://github.com/cython/cython/issues/1978)
+
+# Installating dependencies.
+# We also install matplotlib for our tests.
+pip2 install -U --user numpy scipy matplotlib
+
+# Also requires http://www.gnu.org/software/gsl/ to be installed.
+
+# Installing.
+# http://mlpy.sourceforge.net/docs/3.5/install.html
+cd $MLPY_DIR
+python2 setup.py build_ext --include-dirs=/usr/include/ --rpath=/usr/lib/
+python2 setup.py install --user
diff --git a/tests/mlpy_findpeaks_dist.py b/tests/mlpy_findpeaks_dist.py
new file mode 100644
index 0000000..4fe4602
--- /dev/null
+++ b/tests/mlpy_findpeaks_dist.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+To install the mlpy, you may read (and run) /tests/install_mlpy.sh
+"""
+import numpy as np
+from vector import vector, plot_peaks
+import mlpy
+
+print('Detect peaks without any filters.')
+indexes = mlpy.findpeaks_dist(vector)
+print('Peaks are: {}'.format(indexes))
+plot_peaks(
+ np.array(vector),
+ indexes,
+ algorithm='mlpy.findpeaks_dist'
+)
+
+print('Detect peaks with minimum distance filter.')
+mdp = 2.1
+indexes = mlpy.findpeaks_dist(vector, mindist=mdp)
+print('Peaks are: {}'.format(indexes))
+plot_peaks(
+ np.array(vector),
+ indexes,
+ mpd=mdp, algorithm='mlpy.findpeaks_dist'
+)
diff --git a/tests/mlpy_findpeaks_win.py b/tests/mlpy_findpeaks_win.py
new file mode 100644
index 0000000..203eeca
--- /dev/null
+++ b/tests/mlpy_findpeaks_win.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+"""
+To install the mlpy, you may read (and run) /tests/install_mlpy.sh
+"""
+import numpy as np
+from vector import vector, plot_peaks
+import mlpy
+
+span = 3
+print('Detect peaks with a sliding window of {} (minimum possible).'.format(span))
+indexes = mlpy.findpeaks_win(vector, span=span)
+print('Peaks are: {}'.format(indexes))
+plot_peaks(
+ np.array(vector),
+ indexes,
+ mpd=span, algorithm='mlpy.findpeaks_win'
+)
+
+span = 5
+print('Detect peaks with a sliding window of {}.'.format(span))
+indexes = mlpy.findpeaks_win(vector, span=span)
+print('Peaks are: {}'.format(indexes))
+plot_peaks(
+ np.array(vector),
+ indexes,
+ mpd=span, algorithm='mlpy.findpeaks_win'
+)