entropy.higuchi_fd

entropy.higuchi_fd(x, kmax=10)[source]

Higuchi Fractal Dimension.

Parameters
xlist or np.array

One dimensional time series.

kmaxint

Maximum delay/offset (in number of samples).

Returns
hfdfloat

Higuchi fractal dimension.

Notes

Original code from the mne-features package by Jean-Baptiste Schiratti and Alexandre Gramfort.

This function uses Numba to speed up the computation.

References

Higuchi, Tomoyuki. “Approach to an irregular time series on the basis of the fractal theory.” Physica D: Nonlinear Phenomena 31.2 (1988): 277-283.

Examples

>>> import numpy as np
>>> import entropy as ent
>>> import stochastic.processes.noise as sn
>>> rng = np.random.default_rng(seed=42)
>>> x = sn.FractionalGaussianNoise(hurst=0.5, rng=rng).sample(10000)
>>> print(f"{ent.higuchi_fd(x):.4f}")
1.9983

Fractional Gaussian noise with H = 0.9

>>> rng = np.random.default_rng(seed=42)
>>> x = sn.FractionalGaussianNoise(hurst=0.9, rng=rng).sample(10000)
>>> print(f"{ent.higuchi_fd(x):.4f}")
1.8517

Fractional Gaussian noise with H = 0.1

>>> rng = np.random.default_rng(seed=42)
>>> x = sn.FractionalGaussianNoise(hurst=0.1, rng=rng).sample(10000)
>>> print(f"{ent.higuchi_fd(x):.4f}")
2.0581

Random

>>> rng = np.random.default_rng(seed=42)
>>> print(f"{ent.higuchi_fd(rng.random(1000)):.4f}")
2.0013

Pure sine wave

>>> x = np.sin(2 * np.pi * 1 * np.arange(3000) / 100)
>>> print(f"{ent.higuchi_fd(x):.4f}")
1.0091

Linearly-increasing time-series

>>> x = np.arange(1000)
>>> print(f"{ent.higuchi_fd(x):.4f}")
1.0040