Get peak point [up and bottom] from accelerometer data using python -
i newbie in signal processing, in here, want ask how peak point accelerometer data. visualization of data one:
if have data set of coordinates or data points above visualization, simple using built-in min
, max
functions:
if data simple array of numbers, e.g. arr = [12, 33, -17, ...]
:
peak = max(arr) trough = min(arr) print peak, trough
will print 33, -17
if list of coordinates, e.g. coords = [(0, 12), (1, 33), (2, -17), ...]
:
peak = max(coords, key=lambda x: x[1]) trough = min(coords, key=lambda x: x[1]) print peak, trough
will print (1, 33), (2, -17)
these functions take key
argument function apply elements of list compare them. in example, extract 2nd element of tuple.
reference: https://docs.python.org/2/library/functions.html#max
Comments
Post a Comment