code: def smooth(x,window_len,window='bartlett'):
      
  
      if x.ndim != 1:
          raise ValueError("smooth only accepts 1 dimension arrays.")
  
      if x.size < window_len:
          raise ValueError("Input vector needs to be bigger than window size.")
  
      if window_len<3:
          return x
  
      # numpy available windows
      if not window in ['flat', 'hanning', 'hamming', 'bartlett', 'blackman']:
          raise ValueError("Window is on of 'flat', 'hanning', 'hamming', 'bartlett', 'blackman'")
  
      # padding the beggining and the end of the signal with an average value to evoid edge effect
      start=[average(x[0:10])]*window_len
      end=[average(x[-10:])]*window_len
      s=start+list(x)+end
  
  
      #s=numpy.r_[2*x[0]-x[window_len:1:-1],x,2*x[-1]-x[-1:-window_len:-1]]
      if window == 'flat': #moving average
          w=ones(window_len,'d')
      else:
          w=eval('numpy.'+window+'(window_len)')
      y=numpy.convolve(old_div(w,w.sum()),s,mode='same')
      return array(y[window_len:-window_len])
docs: smooth the data using a sliding window with requested size.
  
      This method is based on the convolution of a scaled window with the signal.
      The signal is prepared by padding the beginning and the end of the signal
      with average of the first (last) ten values of the signal, to evoid jumps
      at the beggining/end
  
      input:
          x: the input signal, equaly spaced!
          window_len: the dimension of the smoothing window
          window:  type of window from numpy library ['flat','hanning','hamming','bartlett','blackman']
              -flat window will produce a moving average smoothing.
              -Bartlett window is very similar to triangular window,
                  but always ends with zeros at points 1 and n,
              -hanning,hamming,blackman are used for smoothing the Fourier transfrom
  
              for curie temperature calculation the default is Bartlett
  
      output:
          aray of the smoothed signal