code: def speed_of_gait(self, x, wavelet_type='db3', wavelet_level=6):
          
  
          coeffs = wavedec(x.values, wavelet=wavelet_type, level=wavelet_level)
  
          energy = [sum(coeffs[wavelet_level - i]**2) / len(coeffs[wavelet_level - i]) for i in range(wavelet_level)]
  
          WEd1 = energy[0] / (5 * np.sqrt(2))
          WEd2 = energy[1] / (4 * np.sqrt(2))
          WEd3 = energy[2] / (3 * np.sqrt(2))
          WEd4 = energy[3] / (2 * np.sqrt(2))
          WEd5 = energy[4] / np.sqrt(2)
          WEd6 = energy[5] / np.sqrt(2)
  
          gait_speed = 0.5 * np.sqrt(WEd1+(WEd2/2)+(WEd3/3)+(WEd4/4)+(WEd5/5)+(WEd6/6))
  
          return gait_speed
docs: This method assess the speed of gait following :cite:`g-MartinSB11`.
  
              It extracts the gait speed from the energies of the approximation coefficients of wavelet functions.
              Prefferably you should use the magnitude of x, y and z (mag_acc_sum) here, as the time series.
  
              :param x: The time series to assess freeze of gait on. This could be x, y, z or mag_sum_acc.
              :type x: pandas.Series
              :param wavelet_type: The type of wavelet to use. See https://pywavelets.readthedocs.io/en/latest/ref/wavelets.html for a full list ('db3' default).
              :type wavelet_type: str
              :param wavelet_level: The number of cycles the used wavelet should have. See https://pywavelets.readthedocs.io/en/latest/ref/wavelets.html for a fill list (6 default). 
              :type wavelet_level: int
              :return: The speed of gait [measured in meters/second].
              :rtype: float