code: def hurst_exponent(epochs):
      def hurst_1d(X):
          X = np.array(X)
          N = X.size
          T = np.arange(1, N + 1)
          Y = np.cumsum(X)
          Ave_T = Y / T
  
          S_T = np.zeros(N)
          R_T = np.zeros(N)
          for i in range(N):
              S_T[i] = np.std(X[: i + 1])
              X_T = Y - T * Ave_T[i]
              R_T[i] = np.ptp(X_T[: i + 1])
  
          for i in range(1, len(S_T)):
              if np.diff(S_T)[i - 1] != 0:
                  break
          for j in range(1, len(R_T)):
              if np.diff(R_T)[j - 1] != 0:
                  break
          k = max(i, j)
          assert k < 10, "rethink it!"
  
          R_S = R_T[k:] / S_T[k:]
          R_S = np.log(R_S)
  
          n = np.log(T)[k:]
          A = np.column_stack((n, np.ones(n.size)))
          [m, c] = np.linalg.lstsq(A, R_S, rcond=None)[0]
          H = m
          return H
  
      return np.apply_along_axis(hurst_1d, 0, epochs).ravel()[0]
  
imports: import pandas
  import numpy
  from statsmodels.tsa.stattools import acf, adfuller, pacf
  import itertools
  from statsmodels.tsa.ar_model import AR
  from scipy.signal import cwt, find_peaks_cwt, ricker, welch
  from scipy.stats import linregress
  import scipy.stats
  from scipy.stats import kurtosis
  from scipy.stats import skew
  import numpy
  from scipy import signal, integrate
  from scipy.interpolate import interp1d
  import math
  from statsmodels.tools.sm_exceptions import MissingDataError
  from numpy.linalg import LinAlgError
label_desc: Use image node_id 44 for calling a global function with example usage: hurst_exponent(epochs) and returns: np, H