Perfect Integrate and Fire (IF) model with noisy adaptation or fractional noise

This code is companion to the manuscript "An integrate-and-fire model to generate
spike trains with long-range dependence", 
by authors Alexandre Richard, Patricio Orio and Etienne Tanré

When run, this script will generate 5 plots with different simulation conditions:
    1) Noise in voltage (V)
    2) Noise in the adaptation (Z)
    3) Noise in both
    4) Noise in adaptation with larger time constant
    5) Fractional Noise with alpha=0.7
    
Plots will contain 9 panels (from top to bottom, then left to right):
    1) Short time course of both variables (V,Z)
    2) Long (500s) inter-spike interval (ISI) plot
    3) Windowed Kolmogorov-Smirnoff test, to visually show stationarity of ISIs
    4) R/S (rescaled range) plot for the whole ISI sequence. Red line is the 
       fit of all points to a power law (straight line in loglog). The slope (H),
       r value and p-value of the fit are indicated. Colored lines are fits of
       small sets of points, in a moving window fashion.
    5) Plot of the moving slopes (colored lines in above plot) against the length
       of the sequence. Red line and blue shadow indicate the mean and 2*SD
       obtained with 100x surrogate data
    6) Autocorrelation plot of the ISI sequence, in log-linear scale
    7) Detrended fluctuation analysis (DFA) plot. Red and colored lines are the
       same as in plot 4
    8) Similar to plot 5, but with the DFA
    9) Autocorrelation plot of the ISI sequence, in log-log scale