code: def movingaverage(arr, window):
      
      m = np.ones(int(window)) / int(window)
      return scipy.ndimage.convolve1d(arr, m, axis=0, mode='reflect')
docs: Calculates the moving average ("rolling mean") of an array
      of a certain window size.