I am trying to apply a formula I have found in a journal to my dataset.
To give a quick background/context of the formula, it is applied to a time series of heart rate data. Each data point in the heart rate time series represents an average of 30 collected measurements. The values of R(k) is used in hypnograms and is calculated as:
where the discrete time for every 1 min (starting from the first minute of the record and ending at the last one) is defined as k, 'Hk+i former' and 'Hk+i latter' are the heart rate values from the former and latter 30 seconds of the time interval (k+i) and i represents the movement inside the window (moving average) with the size 2q. q is an experimental value, lets say q=5.
I understand what is going on in the formula but am struggling to apply these maths to a numpy array.