Skip to main content

lzcomplexity

Randomness, structure and similarity in symbolic sequences.

CI Documentation PyPI DOI Python MIT

Documentation · Python API · Command line · Playground

Explore how a sequence balances unpredictability and organization, or compare the patterns shared by different sequences. lzcomplexity brings Lempel–Ziv analysis to Python and standalone command-line tools, powered by a Rust core.

Binary LZ76 factorization: 1·0·001·1001·1101. Curved arrows span each factor; the highlighted prefix 100 crosses earlier factor boundaries.

Measure What you can explore
Entropy density h Unpredictability, the production of new information and freedom of choice within a sequence.
Effective measure complexity E Organization and correlations across different ranges of a sequence.
Information distance d Similarity between sequences through the patterns they share.

Use h and E together to distinguish changes in randomness from changes in organization. Use d to compare recordings, texts or symbolic trajectories.

Start in Python

pip install lzcomplexity
import lzcomplexity as lz

sequence = "00010111" * 256
other = "01010101" * 256

h = lz.h(sequence, log_base=2)                       # Randomness
E, increments = lz.emc(sequence, max_block_size=16)  # Structure across ranges
d = lz.nid(sequence, other)                         # Distance between sequences

E defaults to Chao–Shen block entropy estimation. Use lz.emc(sequence, method="shuffle") or lz.lz76(sequence, method="shuffle") for the earlier random-shuffle estimator. The standalone accepts --emc-method shuffle; -e 8:f still chooses the range and profile output.

Pass text or bytes directly. For categorical data, assign one byte to each symbol; for continuous signals, first choose a symbolic representation. The Python reference documents each function. The separate usage cheatsheet collects the common calls.

From the terminal

Download the standalone tools from GitHub Releases.

lzcomplexity recording.txt -F text -l 2  # Analyze a sequence; write a JSON report
lzdistance sequences.txt -I TXT        # Compare one sequence per line

The command-line guide covers file formats, batch analysis and distance matrices, with a separate usage cheatsheet.

Research applications

These studies show the kinds of scientific questions that entropy, structure and distance can help investigate:

Application Explore
Nonlinear dynamics Transitions between collective patterns and chaos in coupled Adler-type oscillators (Physical Review E, 2023).
Brain activity Patterns and connectivity across brain regions during cognitive tasks in task-based fMRI (arXiv preprint, 2025).
Written language The balance between innovation and context at different levels of text organization (PLOS ONE, 2019).

See the worked examples and research references to develop an analysis for your own data.

Authors & citation

  • Efrén Aragón Pérez — creator and principal author.
  • Daniel Estévez Moya — Rust implementation.
  • Ernesto Estévez Rams — scientific foundations.

Aragón-Pérez, E., & Estevez-Rams, E. (2025). Lzcomplexity: Entropy Measurement Library. Revista Cubana de Física, 42(2), 80–86. Article · Software DOI · BibTeX

Released under the MIT license.

Metadata

Release files for lzcomplexity 3.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lzcomplexity 3.0.0
File Size Uploaded Provenance Actions
lzcomplexity-3.0.0.tar.gz 39.2 kB With provenance Details for lzcomplexity-3.0.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for lzcomplexity 3.0.0
File Actions
lzcomplexity-3.0.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for lzcomplexity-3.0.0-cp39-abi3-win_amd64.whl
lzcomplexity-3.0.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for lzcomplexity-3.0.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
lzcomplexity-3.0.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for lzcomplexity-3.0.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
lzcomplexity-3.0.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for lzcomplexity-3.0.0-cp39-abi3-macosx_11_0_arm64.whl
lzcomplexity-3.0.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for lzcomplexity-3.0.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 1.4 MB

Release files / lzcomplexity-3.0.0.tar.gz

Download URL lzcomplexity-3.0.0.tar.gz
Size 39.2 kB
Tags Source
SHA-256 checksum
How to use checksums
eb7d1f70616396a684d608965c30bff572ca3124cf8dc40d2cf5ee2d5d5fb400
BLAKE2b-256 checksum
How to use checksums
3b378c29cfca29a5b1eed2092f812bdbcba01f4cab5f28edaa380d8022ce7212
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / lzcomplexity-3.0.0-cp39-abi3-win_amd64.whl

Download URL lzcomplexity-3.0.0-cp39-abi3-win_amd64.whl
Size 217.7 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
3b99208d30bb9eee4426ed865426632903d59d44eaac2e86efb8b09add91f8c2
BLAKE2b-256 checksum
How to use checksums
f7b06ce45694e3da9ea526615ecd049932b52afe622444ba9e753eb11e4557c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / lzcomplexity-3.0.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL lzcomplexity-3.0.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 314.2 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
dac85ebb7b2c31bb3fabf4bc37dc3afae0a39e2f4a2dceebd43170db1b751689
BLAKE2b-256 checksum
How to use checksums
1fb45a8e5b55c7f6c873ce9aecdc7a744392a9dc498ce5db2a61044000c6aade
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / lzcomplexity-3.0.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL lzcomplexity-3.0.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 301.2 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
4961f61704cb9fd37b15f77d2fec525e0338680c3dc1a44355c7a81f7187f6d0
BLAKE2b-256 checksum
How to use checksums
b605d9c56769ddf1c5d40a1b94f69428abc75a10a2552f7f2053845abf2a7f25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / lzcomplexity-3.0.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL lzcomplexity-3.0.0-cp39-abi3-macosx_11_0_arm64.whl
Size 276.8 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
beba2896d79d9b5a9ba8266efaae27ab01fb678a1f1ce06c47d4b2eb3d5f0b50
BLAKE2b-256 checksum
How to use checksums
26d57ce28a06571282f94b6444488160ba9603b3cbdee9a8449166477f5d7211
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Release files / lzcomplexity-3.0.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL lzcomplexity-3.0.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 287.7 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
d30c2945825296a84e66d5c40c955d826a04e82442c9ad05902b7281db50d1dc
BLAKE2b-256 checksum
How to use checksums
0acfdfbb979f27a651a6b0a6a8d94e619993c9fe92cd3e86e3d65e201a2539e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

Security for lzcomplexity 3.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for lzcomplexity-3.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page