Registry / ai-ml / antropy

antropy

JSON →
library0.2.2pypypi✓ verified 85d ago

AntroPy is a Python library for estimating entropy and complexity of time-series data, including sample entropy, approximate entropy, permutation entropy, spectral entropy, and fractal dimensions (Petrosian, Katz, Higuchi). Current version is 0.2.2, with regular releases on a roughly annual cadence. Requires Python >= 3.10.

pip install antropy
INSTALL
IMPORT
SIG · ANTROPY
A
antropy
ai-mlpythonv0.2.2
Install
13.1s avg
Import
16216ms
Disk
466MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.2.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
installs and imports cleanly · install 13.1s · import 16.216s · 458MB
466MB installed
● package 466MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

app_entropy
from antropy import app_entropy
sample_entropy
from antropy import sample_entropy
perm_entropy
from antropy import perm_entropy
spectral_entropy
from antropy import spectral_entropy
detrended_fluctuation
from antropy import detrended_fluctuation
katz_fd
from antropy import katz_fd
petrosian_fd
from antropy import petrosian_fd
higuchi_fd
from antropy import higuchi_fd
lz_complexity
from antropy import lz_complexity

Compute sample entropy, permutation entropy, and Higuchi fractal dimension on a random 1D array.

import numpy as np from antropy import sample_entropy, perm_entropy, higuchi_fd # Generate a random time series np.random.seed(42) x = np.random.rand(100) # Sample entropy se = sample_entropy(x) print(f"Sample entropy: {se:.4f}") # Permutation entropy with order 3 pe = perm_entropy(x, order=3) print(f"Permutation entropy: {pe:.4f}") # Higuchi fractal dimension hfd = higuchi_fd(x) print(f"Higuchi fractal dimension: {hfd:.4f}")
Debug
Known issues
breakingPython 3.9 is no longer supported as of v0.2.0. Minimum required Python version is 3.10.
fix
Upgrade Python to 3.10 or newer.
affects: >=0.2.0
breakingPermutation entropy for order 3 and 4 now returns a 1-D array when input is 2-D, one value per row. Previous behavior returned a scalar or raised an error.
fix
For 2D input, access individual row entropies via indexing. For 1D input, behavior unchanged.
affects: >=0.2.2
gotchaSample entropy uses a default tolerance (r) of 0.2 * std(x). For very short or noisy signals, this may be inappropriate and lead to undefined entropy (nan).
fix
Explicitly set r parameter or check signal length is sufficient (typically > 10*(m+1) for embedding dimension m).
affects: all
deprecatedThe optional dependency 'stochastic' was removed in v0.1.9. Any code using antropy with that package is unaffected, but imports of 'stochastic' directly will fail if not installed separately.
fix
Install 'stochastic' separately if needed: pip install stochastic
affects: >=0.1.9
Errors
Common errors & fixes
ValueError: md must be an integer >=2
Passing a fractional or too small embedding dimension to sample_entropy or app_entropy.
fix
Ensure the 'dim' parameter (often 'm') is an integer >= 2, e.g., m=2.
ValueError: tolerance (r) must be positive
Passing a non-positive tolerance to sample_entropy or app_entropy.
fix
Set r to a positive float, typically 0.2 * standard deviation of the signal.
RuntimeError: Numba jit compilation failed. Falling back to pure Python.
Numba version incompatibility or missing LLVM. Antropy uses numba for acceleration, but falls back gracefully.
fix
Install compatible numba version: pip install 'numba>=0.57' or ignore if performance is acceptable.
AttributeError: module 'antropy' has no attribute 'petrosian_fd'
Older version of antropy (<0.1.5) did not include petrosian_fd, or function was renamed.
fix
Upgrade to latest version: pip install --upgrade antropy
Upgrade
Version history
0.2.2latest on PyPI · released Apr 1, 2026
Audit
Dependencies
numpyrequiredCore numerical operations
scipyrequiredSignal processing and statistical functions
scikit-learnrequiredUsed for KDTree in sample entropy
numbaoptionalOptional JIT acceleration for sample entropy and LZ complexity
Agent activity
63 hits · last 30 days
node
52
OpenAI (training)
1
Resources
antropy — pip install antropy · libregistry