code: def detrended_fluctuation_analysis(epochs):
      def dfa_1d(X, Ave=None, L=None):
          X = np.array(X)
  
          if Ave is None:
              Ave = np.mean(X)
  
          Y = np.cumsum(X)
          Y -= Ave
  
          if L is None:
              L = np.floor(
                  len(X)
                  * 1
                  / (
                      2
                      ** np.array(
                          list(range(1, int(np.log2(len(X))) - 4))
                      )
                  )
              )
  
          F = np.zeros(len(L))  # F(n) of different given box length n
  
          for i in range(0, len(L)):
              n = int(L[i])  # for each box length L[i]
              if n == 0:
                  print(
                      "time series is too short while the box length is too big"
                  )
                  print("abort")
                  exit()
              for j in range(0, len(X), n):  # for each box
                  if j + n < len(X):
                      c = list(range(j, j + n))
                      # coordinates of time in the box
                      c = np.vstack([c, np.ones(n)]).T
                      # the value of data in the box
                      y = Y[j : j + n]
                      # add residue in this box
                      F[i] += np.linalg.lstsq(c, y, rcond=None)[1]
              F[i] /= (len(X) / n) * n
          F = np.sqrt(F)
  
          stacked = np.vstack([np.log(L), np.ones(len(L))])
          stacked_t = stacked.T
          Alpha = np.linalg.lstsq(stacked_t, np.log(F), rcond=None)
  
          return Alpha[0][0]
  
      return np.apply_along_axis(dfa_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 39 for calling a global function with example usage: detrended_fluctuation_analysis(epochs) and returns: np, Alpha