I have a signal of electromyographical data that I am supposed (scientific papers\' explicit recommendation) to smooth using RMS.
I have the following working code,
Since this is not a linear transformation, I don't believe it is possible to use np.convolve().
Here's a function which should do what you want. Note that the first element of the returned array is the rms of the first full window; i.e. for the array a in the example, the return array is the rms of the subwindows [1,2],[2,3],[3,4],[4,5] and does not include the partial windows [1] and [5].
>>> def window_rms(a, window_size=2):
>>> return np.sqrt(sum([a[window_size-i-1:len(a)-i]**2 for i in range(window_size-1)])/window_size)
>>> a = np.array([1,2,3,4,5])
>>> window_rms(a)
array([ 1.41421356, 2.44948974, 3.46410162, 4.47213595])