Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

find positive splike-like peaks, using Delta_raise and Delta_fall thresholds.

Project Description

Find positive spike-like peaks from 1-D array.

example

from peakdetect_delta import peakdetect, peakdetect_simpleedge

# peak are represented as a tuple ((pvalue, pidx), (sidx, eidx))
#   pvalue: value at pidx
#   pidx: index of the peak
#   sidx: index where y[sidx+1] - y[sidx] > rdelta
#   eidx: index where y[eidx] - y[eidx-1] < fdelta
#   so, y[sidx:eidx] takes the detected peak

# examples of peakdetect_simpleedge
# case 1.1
s = [0, 0, 1.5, 2, 0, 0]
assert peakdetect_simpleedge(s, rdelta=1, fdelta=-1) == [((2, 3), (1, 5))]

# case 1.2
s = [0, 2, 0, -2, 0, -2]
assert peakdetect_simpleedge(s, rdelta=1, fdelta=1) == [((2, 1), (0, 3)),
                                                        ((0, 4), (3, 6))]

# example of peakdetect
s= [0, 3, 0, 2, 0, 0, -1, 1, -2, -1]
# same as peakdetect_simpleedge
assert peakdetect(s, rdelta=1, fdelta=-1, minimumspace=-1)
           == [((3, 1), (0, 3)), ((2, 3), (2, 5)), ((1, 7), (6, 9))]
# first 2 peaks are merged
assert peakdetect(s, rdelta=1, fdelta=-1, minimumspace=0)
           == [((3, 1), (0, 5)), ((1, 7), (6, 9))]
peakdetect(s, rdelta=1, fdelta=-1, minimumspace=2)
           == [((3, 1), (0, 9))]
Release History

Release History

This version
History Node

0.1.0

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting