Peak detection in signal using Python

Usually people use scipy.signal to detect peak in signal.

scipy.signal.find_peaks_cwt( vec )

which returns list of index where vec has maximas. However this does not work all
the time, especially when vector is noisy. I could not get it working very well to compute the modality of distributions.

This is the most sophisticated library (AFAIK): https://gist.github.com/sixtenbe/1178136

Its can be installed via pip:

$ pip install analytic_wfm

To use,

>>> import analytic_wfm
>>> vec # this is the 1d array in which I want to detect peaks.
>>> maxPeaks, minPeaks = analytic_wfm.peakdetect( vec, lookahead = 10 )

This returns maximum peaks and minimum peaks. There are various other functions
described in readme.txt file.

Here is an example where I used this library to compute modality of a distribution:

coupled_bis

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s