MCPcopy Create free account
hub / github.com/ActiveState/code / peaks

Function peaks

recipes/Python/475188_minmax_peaks_with_Numeric/recipe-475188.py:3–8  ·  view source on GitHub ↗
(data, step)

Source from the content-addressed store, hash-verified

1from Numeric import *
2
3def peaks(data, step):
4 n = len(data) - len(data)%step # ignore tail
5 slices = [ data[i:n:step] for i in range(step) ]
6 peak_max = reduce(maximum, slices)
7 peak_min = reduce(minimum, slices)
8 return transpose(array([peak_max, peak_min]))
9
10"""example of use:
11

Callers

nothing calls this directly

Calls 3

rangeFunction · 0.85
transposeFunction · 0.50
arrayClass · 0.50

Tested by

no test coverage detected