Detrended Fluctuation Analysis
Jupyter Notebook Python
Failed to load latest commit information.
notebook some typos fixed May 10, 2016 example code in readme fixed Jul 7, 2016 author note added Jul 15, 2016 author note added Jul 15, 2016

Detrended Fluctuation Analysis

Simple python implementation of DFA algorithm. It bases on these two articles:

  • Hardstone, R. et al. Detrended fluctuation analysis: A scale-free view on neuronal oscillations. Front. Physiol. 3 NOV, 1–13 (2012).
  • Ihlen, E. a F. Introduction to multifractal detrended fluctuation analysis in Matlab. Front. Physiol. 3 JUN, 1–18 (2012).

You may test it using power law data generator from, or using code below:

from dfa import dfa
from generate import power_law_noise

x = power_law_noise(2**12, 0.8)
scales, fluct, alpha = dfa(x)
print("DFA exponent {}: {}".format(e+1, alpha))


  • numpy
  • matplotlib