{"id":13571020,"url":"https://github.com/raphaelvallat/antropy","last_synced_at":"2025-05-16T19:06:32.499Z","repository":{"id":38186701,"uuid":"348535903","full_name":"raphaelvallat/antropy","owner":"raphaelvallat","description":"AntroPy: entropy and complexity of (EEG) time-series in Python","archived":false,"fork":false,"pushed_at":"2025-02-04T19:23:14.000Z","size":5823,"stargazers_count":315,"open_issues_count":1,"forks_count":58,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-12T17:46:55.866Z","etag":null,"topics":["algorithm","complexity","eeg","entropy","feature-extraction","fractal-dimension","machine-learning","neuroscience","numba","python","signal","signal-processing"],"latest_commit_sha":null,"homepage":"https://raphaelvallat.com/antropy/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raphaelvallat.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=K2FZVJGCKYPAG\u0026currency_code=USD\u0026source=url"}},"created_at":"2021-03-17T00:51:14.000Z","updated_at":"2025-04-10T05:12:44.000Z","dependencies_parsed_at":"2024-06-07T22:55:25.813Z","dependency_job_id":"17533b23-1980-4347-be57-c1e4ec845cc6","html_url":"https://github.com/raphaelvallat/antropy","commit_stats":{"total_commits":137,"total_committers":11,"mean_commits":"12.454545454545455","dds":0.1897810218978102,"last_synced_commit":"14b073499c5ccb05650c64b45ddf06a8ba6b8cee"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelvallat%2Fantropy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelvallat%2Fantropy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelvallat%2Fantropy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raphaelvallat%2Fantropy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raphaelvallat","download_url":"https://codeload.github.com/raphaelvallat/antropy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254592367,"owners_count":22097011,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","complexity","eeg","entropy","feature-extraction","fractal-dimension","machine-learning","neuroscience","numba","python","signal","signal-processing"],"created_at":"2024-08-01T14:00:57.557Z","updated_at":"2025-05-16T19:06:32.453Z","avatar_url":"https://github.com/raphaelvallat.png","language":"Python","readme":".. -*- mode: rst -*-\n\n|\n\n.. image:: https://img.shields.io/github/license/raphaelvallat/antropy.svg\n  :target: https://github.com/raphaelvallat/antropy/blob/master/LICENSE\n\n.. image:: https://github.com/raphaelvallat/antropy/actions/workflows/python_tests.yml/badge.svg\n  :target: https://github.com/raphaelvallat/antropy/actions/workflows/python_tests.yml\n\n.. image:: https://codecov.io/gh/raphaelvallat/antropy/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/raphaelvallat/antropy\n\n----------------\n\n.. figure::  https://github.com/raphaelvallat/antropy/blob/master/docs/pictures/logo.png?raw=true\n   :align:   center\n\nAntroPy is a Python 3 package providing several time-efficient algorithms for computing the complexity of time-series.\nIt can be used for example to extract features from EEG signals.\n\nDocumentation\n=============\n\n- `Link to documentation \u003chttps://raphaelvallat.com/antropy/build/html/index.html\u003e`_\n\nInstallation\n============\n\nAntroPy can be installed with pip\n\n.. code-block:: shell\n\n  pip install antropy\n\nor conda\n\n.. code-block:: shell\n\n  conda config --add channels conda-forge\n  conda config --set channel_priority strict\n  conda install antropy\n\nTo build and install from source, clone this repository or download the source archive and decompress the files\n\n.. code-block:: shell\n\n  cd antropy\n  pip install \".[test]\"     # install the package\n  pip install -e \".[test]\"  # or editable install\n  pytest\n\n**Dependencies**\n\n- `numpy \u003chttps://numpy.org/\u003e`_\n- `scipy \u003chttps://www.scipy.org/\u003e`_\n- `scikit-learn \u003chttps://scikit-learn.org/\u003e`_\n- `numba \u003chttp://numba.pydata.org/\u003e`_\n\nFunctions\n=========\n\n**Entropy**\n\n.. code-block:: python\n\n    import numpy as np\n    import antropy as ant\n    np.random.seed(1234567)\n    x = np.random.normal(size=3000)\n    # Permutation entropy\n    print(ant.perm_entropy(x, normalize=True))\n    # Spectral entropy\n    print(ant.spectral_entropy(x, sf=100, method='welch', normalize=True))\n    # Singular value decomposition entropy\n    print(ant.svd_entropy(x, normalize=True))\n    # Approximate entropy\n    print(ant.app_entropy(x))\n    # Sample entropy\n    print(ant.sample_entropy(x))\n    # Hjorth mobility and complexity\n    print(ant.hjorth_params(x))\n    # Number of zero-crossings\n    print(ant.num_zerocross(x))\n    # Lempel-Ziv complexity\n    print(ant.lziv_complexity('01111000011001', normalize=True))\n\n.. parsed-literal::\n\n    0.9995371694290871\n    0.9940882825422431\n    0.9999110978316078\n    2.015221318528564\n    2.198595813245399\n    (1.4313385010057378, 1.215335712274099)\n    1531\n    1.3597696150205727\n\n**Fractal dimension**\n\n.. code-block:: python\n\n    # Petrosian fractal dimension\n    print(ant.petrosian_fd(x))\n    # Katz fractal dimension\n    print(ant.katz_fd(x))\n    # Higuchi fractal dimension\n    print(ant.higuchi_fd(x))\n    # Detrended fluctuation analysis\n    print(ant.detrended_fluctuation(x))\n\n.. parsed-literal::\n\n    1.0310643385753608\n    5.954272156665926\n    2.005040632258251\n    0.47903505674073327\n\nExecution time\n~~~~~~~~~~~~~~\n\nHere are some benchmarks computed on a MacBook Pro (2020).\n\n.. code-block:: python\n\n    import numpy as np\n    import antropy as ant\n    np.random.seed(1234567)\n    x = np.random.rand(1000)\n    # Entropy\n    %timeit ant.perm_entropy(x)\n    %timeit ant.spectral_entropy(x, sf=100)\n    %timeit ant.svd_entropy(x)\n    %timeit ant.app_entropy(x)  # Slow\n    %timeit ant.sample_entropy(x)  # Numba\n    # Fractal dimension\n    %timeit ant.petrosian_fd(x)\n    %timeit ant.katz_fd(x)\n    %timeit ant.higuchi_fd(x) # Numba\n    %timeit ant.detrended_fluctuation(x) # Numba\n\n.. parsed-literal::\n\n    106 µs ± 5.49 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n    138 µs ± 3.53 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n    40.7 µs ± 303 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n    2.44 ms ± 134 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n    2.21 ms ± 35.4 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)\n    23.5 µs ± 695 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n    40.1 µs ± 2.09 µs per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n    13.7 µs ± 251 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n    315 µs ± 10.7 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)\n\nDevelopment\n===========\n\nAntroPy was created and is maintained by `Raphael Vallat \u003chttps://raphaelvallat.com\u003e`_. Contributions are more than welcome so feel free to contact me, open an issue or submit a pull request!\n\nTo see the code or report a bug, please visit the `GitHub repository \u003chttps://github.com/raphaelvallat/antropy\u003e`_.\n\nNote that this program is provided with **NO WARRANTY OF ANY KIND**. Always double check the results.\n\nAcknowledgement\n===============\n\nSeveral functions of AntroPy were adapted from:\n\n- MNE-features: https://github.com/mne-tools/mne-features\n- pyEntropy: https://github.com/nikdon/pyEntropy\n- pyrem: https://github.com/gilestrolab/pyrem\n- nolds: https://github.com/CSchoel/nolds\n\nAll the credit goes to the author of these excellent packages.","funding_links":["https://www.paypal.com/cgi-bin/webscr?cmd=_donations\u0026business=K2FZVJGCKYPAG\u0026currency_code=USD\u0026source=url"],"categories":["Python","📦 Packages"],"sub_categories":["Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphaelvallat%2Fantropy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraphaelvallat%2Fantropy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraphaelvallat%2Fantropy/lists"}