What’s new#
v0.2.3 (October 2026)#
Bug fixes
antropy.perm_entropy()with several delays on a 2-D array now returns one value per row (averaged across delays) instead of a single value for the whole array. Invaliddelayinputs, such as an empty list, now raise a clear error.antropy.perm_entropy()(order3 or 4) now compares the original values directly, so very large integers or very close floats are no longer mixed up. Rows containing NaN now return NaN without affecting the other rows.
Tests
Made tests that compare 2-D and 1-D results robust to tiny floating-point differences across platforms.
v0.2.2 (April 2026)#
Performance
antropy.perm_entropy()gains a fast path fororder∈ {3, 4}: ordinal patterns are encoded via pairwise comparison bit-keys and counted withnp.bincountrather thanargsort+np.unique, giving a major speed-up compared to the previous implementation.The general path (
order> 4) is also improved: the embedded matrix is now built as a zero-copyas_stridedview and the hash is computed via a single BLAS@product instead of an element-wise multiply + sum.
New features
antropy.perm_entropy()now accepts 2-D arrays of shape(n_channels, n_times)fororder∈ {3, 4}, computing entropy for every row in a single vectorised call.
Bug fixes
antropy.perm_entropy()now always applies a small positional epsilon jitter before sorting, making results fully deterministic across platforms and dtypes. Previously, integer-typed signals (and some float signals with exact ties) could produce different outputs depending on the platform’s unstable-sort tie-breaking behaviour.Normalized
antropy.perm_entropy()output is now clipped to[0, 1]to prevent returning-0.0for perfectly regular signals (IEEE 754 artefact from-(1.0 * log2(1.0))).
Docs
Fixed doctest failures in
antropy.spectral_entropy(),antropy.num_zerocross(), andantropy.hjorth_params()caused by NumPy’s new scalarrepr(np.float64(x)/np.int64(x)instead of bare literals in newer NumPy).Added a Big O complexity column to the performance tables in
README.rstanddocs/index.rst.Performance tables now show timings at both 1000 and 10000 samples.
Added
benchmarks/benchmark_all.pyscript to reproduce all table timings.Rewrote
docs/index.rstto matchREADME.rstin content and style.
Maintenance
Clean up
docs/conf.py(remove redundantsys.pathmanipulation) and tightenpyproject.toml(remove stale extras, fix editable-install metadata).
v0.2.1 (March 2026)#
Bug fixes
Fix off-by-one in
antropy.higuchi_fd(): the inner loop summed \(N_m - 1\) differences per sub-series instead of the correct \(N_m\), causing a systematic underestimate of curve length. Verified against the NeuroKit2 reference implementation.antropy.sample_entropy()now returnsnp.nan(instead of0) when no template of length m matches within the tolerance, since the entropy is mathematically undefined in that case.Fix silent
epsilon = 10e-9(= 1e-8) typo inutils.py; corrected to1e-9. This constant guards against division-by-zero in the Numba linear regression used byantropy.detrended_fluctuation().Fix
all = [...]→__all__ = [...]in all three source modules, which previously leaked imported names (np,jit,KDTree, …) into the public namespace onfrom antropy import *.
New features
antropy.hjorth_params()gains an optionalsfparameter. When provided, mobility is returned in Hz instead of samples⁻¹ (multiplied bysf); complexity is unaffected.
Validation
User-facing
assertstatements replaced with properValueError/TypeErrorraises throughout (asserts are silently stripped bypython -O):perm_entropy(delay=0),spectral_entropy(method=…),app_entropy/sample_entropy(tolerance=…), andlziv_complexity(sequence=…, normalize=…).
Docs
Docstring formula for
antropy.higuchi_fd()corrected to match the fix above (\(\sum_{j=1}^{N_m}\) not \(\sum_{j=1}^{N_m-1}\)).Added notes to
antropy.lziv_complexity()(float arrays are truncated touint32, not discretised — binarise continuous signals first),antropy.num_zerocross()(signbit(0) == Falsebehaviour),antropy.spectral_entropy()(DC component included),antropy.detrended_fluctuation()(\(\alpha \approx 1\) is ambiguous), andantropy.hjorth_params()(mobility units).
v0.2.0 (March 2026)#
Build & CI
Drop Python 3.9 (EOL), add Python 3.13 support. Minimum is now Python 3.10.
Switch from
piptouvin all GitHub Actions workflows.Add explicit minimum versions for core dependencies:
numpy>=1.22.4,scipy>=1.8.0,scikit-learn>=1.2.0.Migrate
[project.optional-dependencies]to PEP 735[dependency-groups].Bump
setuptools>=80.0.Split CI into three jobs:
test-core(3 platforms × 4 Python versions),test-dependency-combinations(4 dep combos from minimum to latest), andcoverage.Fix
test-dependency-combinationsjob: separate antropy install (--no-deps) from test-dependency install so that pytest’s own dependencies (e.g.pluggy) are always resolved.Fix Codecov upload to use
${{ secrets.CODECOV_TOKEN }}instead of a hardcoded token.Switch Ruff workflow from
astral-sh/ruff-action@v1touvx ruffviaastral-sh/setup-uv@v7.Extend Ruff rules: add
W(pycodestyle warnings) andNPY(NumPy rules).
Tests
Increase test coverage from ~54 % to 100 %.
Add
tests/test_utils.pycovering all branches of the_embedhelper (1-D and 2-D paths, all error conditions).Add edge-case tests:
sample_entropyreturninginf(m-length matches exist but no (m+1)-length matches);detrended_fluctuationreturningNaNfor a constant signal;spectral_entropyraising on an invalid method string.Set
NUMBA_DISABLE_JIT=1in thecoverageCI job so coverage.py can instrument Numba JIT function bodies; other CI jobs still exercise real compiled code.
Bug fixes
Fix
antropy.higuchi_fd()returning aValueError(math domain error) on constant or integer-typed input arrays:log(0)is now guarded to return-inf, matching Numba’s IEEE 754 behaviour.
Docs
Switch documentation theme from
sphinx_bootstrap_themetopydata-sphinx-theme(dark/light toggle, GitHub icon, improved layout).Fix three broken
intersphinxURLs: NumPy, SciPy, and MNE-Python.Add
sphinx.ext.mathjaxfor LaTeX math rendering in docstrings.Add
contributing.rstguide.Fix stale
:py:func:cross-references in changelog entries v0.1.1–v0.1.3 (entropy.XXX→antropy.XXX).Fix typo in v0.1.6 changelog (“Fox for KDTree” → “Fix for KDTree”).
Modernize
README.rstanddocs/index.rst: add PyPI, conda-forge, downloads, and Ruff badges; adduvinstallation instructions; fix broken links.
v0.1.9 (February 2025)#
Remove stochastic package from dependency to enable support for Numpy 2.x
v0.1.8 (December 2024)#
Switch to modern python packaging
Use ruff instead of black/flake8
v0.1.7 (December 2024)#
Simplify Katz FD implementation. raphaelvallat/antropy#30
Add tolerance parameter to the approximate and sample entropy. raphaelvallat/antropy#32
Fix for scikit-learn ≥ 1.3 in approximate and sample entropy. raphaelvallat/antropy#36
v0.1.6 (July 2023)#
This version requires numba >= 0.57.
Allow readonly arrays in numba jit signature. raphaelvallat/antropy#23
Improved sample entropy kernel. raphaelvallat/antropy#25
Fix for KDTree.valid_metrics which is method since sklearn 1.3. raphaelvallat/antropy#30
v0.1.5 (December 2022)#
antropy.perm_entropy()will now return the average entropy across all delays if a list or range of delays is provided.Handle the limit of p = 0 in functions that evaluate the product p * log2(p), to give 0 instead of nan (see PR3).
antropy.detrended_fluctuation()will now return alpha = 0 when the correlation coefficient of the fluctuations of an input signal is 0 (see PR21).
v0.1.4 (April 2021)#
Important
The package has now been renamed AntroPy (previously EntroPy)!
Faster implementation of
antropy.lziv_complexity()(see PR1). Among other improvements, strings are now mapped to UTF-8 integer representations.
v0.1.3 (March 2021)#
Added the
antropy.num_zerocross()function to calculate the (normalized) number of zero-crossings on N-D data.Added the
antropy.hjorth_params()function to calculate the mobility and complexity Hjorth parameters on N-D data.Add support for N-D data in
antropy.spectral_entropy(),antropy.petrosian_fd()andantropy.katz_fd().Use the stochastic package to generate stochastic time-series.
v0.1.2 (May 2020)#
antropy.lziv_complexity()now works with non-binary sequence (e.g. “12345” or “Hello World!”)The average fluctuations in
antropy.detrended_fluctuation()is now calculated using the root mean square instead of a simple arithmetic. For more details, please refer to this GitHub issue.Updated flake8
v0.1.1 (November 2019)#
Added Lempel-Ziv complexity (
antropy.lziv_complexity()) for binary sequence.
v0.1.0 (October 2018)#
Initial release.
Permutation entropy
Spectral entropy
Singular value decomposition entropy
Approximate entropy
Sample entropy
Petrosian Fractal Dimension
Katz Fractal Dimension
Higuchi Fractal Dimension
Detrended fluctuation analysis