code: def emg_tkeo(emg):
      
      emg = np.asarray(emg)
      tkeo = np.copy(emg)
      # Teager–Kaiser Energy operator
      tkeo[1:-1] = emg[1:-1]*emg[1:-1] - emg[:-2]*emg[2:]
      # correct the data in the extremities
      tkeo[0], tkeo[-1] = tkeo[1], tkeo[-2]
  
      return(tkeo)
docs: Calculates the Teager–Kaiser Energy operator.
  
      Parameters
      ----------
      emg : array
          raw EMG signal.
  
      Returns
      -------
      tkeo : 1D array_like
          signal processed by the Teager–Kaiser Energy operator.
  
      Notes
      -----
  
      *Authors*
  
      - Marcos Duarte
  
  
  
      *See Also*
  
      See this notebook [1]_.
  
      References
      ----------
      .. [1] https://github.com/demotu/BMC/blob/master/notebooks/Electromyography.ipynb