Reputation: 53
My data set starts at xmin = 0
(s) and ends at xmax = 300
(s).
Below is the moving average calculated with counting the minimum peaks.
frame_length = 60
hr = np.zeros(len(range(xmin, xmax - frame_length)))
for x in range(xmin, xmax - frame_length):
count_in_window = np.sum(np.logical_and(mintab[:,0] >= x, mintab[:,0] < x + frame_length))
hr[x - xmin] = count_in_window * 60/frame_length
But I actually want a window that counts the minimum peaks for x(0-60)
and then x(60-120)
, x(120-180)
, x(180-240)
and x(240-300)
. So it will be the heart rate per minute. I tried something like:
for x in range(xmin,xmax):
if x != xmax:
count_peaks = np.sum(mintab[:0])
hr = count_peaks
x+=60
Im new to Python and I would be very happy to learn how to do this :) Thank you
Upvotes: 0
Views: 46