Moving average in python

Below is the code for computing a moving average in python:

def movingaverage(data, window_size):
    window= numpy.ones(int(window_size))/float(window_size)
    return numpy.convolve(data, window, 'same')

plot(-logE, '-', color='gray', alpha=.25)
plot(movingaverage(-logE, 500), 'r', linewidth=3.)

moving_average

If you want to ask me a question or leave me a message add @bougui505 in your comment.