Fast, low-memory complexity measures for 1D time series (EEG, MEG, physiology).
complexeva-intro.phone.mp4
Also on YouTube, with chapters.
pip install complexeva # Python 3.14+import numpy
import complexeva
signal = numpy.random.randn(1000) # one signal, shape (time,)
complexeva.hfd(signal) # one floatPass every signal at once with time on the last axis; you get one value per signal, in the shape of the other axes. Each value is identical to calling the measure on that signal alone.
eeg = numpy.random.randn(64, 1000) # (channels, time)
complexeva.hfd(eeg) # shape (64,)
study = numpy.random.randn(20, 64, 1000) # (subjects, channels, time)
complexeva.sample_entropy(study) # shape (20, 64)
recording = numpy.random.randn(1000, 64) # time first? put time last
complexeva.dfa(recording.T) # shape (64,)
windows = numpy.lib.stride_tricks.sliding_window_view(signal, 200)[::10] # (windows, 200), no copy
complexeva.permutation_entropy(windows) # one value per windowSome measures take one signal only; see batches.
result = complexeva.surrogate_test(complexeva.hfd, signal, n=99, seed=0)
print(result.observed, result.surrogate_mean, result.delta, result.pvalue)pip install 'complexeva[gpu]'from complexeva import gpu
gpu.hfd(eeg) # one Higuchi fractal dimension per signal
gpu.spectrum_shuffle_test(eeg, n_shuffles=39, seed=0) # PyTorch surrogates, CPU entropy| Read more | Topics |
|---|---|
| CPU surrogate tests | Surrogate methods, options and p-values |
| GPU backend | Device selection, precision and shuffle test |
| measure | input | paper | |
|---|---|---|---|
sample entropysample_entropy |
(…, time) | Richman & Moorman 2000 |
|
approximate entropyapproximate_entropy |
(…, time) | Pincus 1991 |
|
correlation dimensioncorrelation_dimension |
(…, time) | Grassberger & Procaccia 1983 |
|
detrended fluctuation analysisdfa |
(…, time) | Peng 1994 |
|
permutation entropypermutation_entropy |
(…, time) | Bandt & Pompe 2002 |
|
largest Lyapunov exponentlyapunov_exponent |
1D | Rosenstein 1993 |
|
multiscale entropymultiscale_entropy |
(…, time) | Costa 2002 Wu 2013 ( method="modified") |
|
Higuchi fractal dimensionhfd, hfd_hilbert |
(…, time) | Higuchi 1988 Varley 2020 |
|
Hjorth mobility and complexityhjorth |
(…, time) | Hjorth 1970 |
|
compression complexitycompression_complexity |
1D | Cilibrasi & Vitányi 2005 |
|
fuzzy entropyfuzzy_entropy |
(…, time) | Chen 2007 |
|
Katz fractal dimensionkatz_fd |
(…, time) | Katz 1988 |
|
Lempel–Ziv complexitylempel_ziv, lempel_ziv_hilbert |
(…, time) | Kaspar & Schuster 1987 Schartner 2017 |
|
spectral entropyspectral_entropy |
(…, time) | Inouye 1991 |
|
Petrosian fractal dimensionpetrosian_fd |
(…, time) | Petrosian 1995 |
|
SVD entropysvd_entropy |
(…, time) | Roberts 1999 |
Batches, against a loop of the best other package (NUMBA_NUM_THREADS sets the thread count):
MIT




