Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/FUNDING.yml

This file was deleted.

147 changes: 123 additions & 24 deletions .github/workflows/python_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,141 @@ name: Python tests
on:
push:
branches: [master]
paths: ['src/**', 'tests/**', 'pyproject.toml']
pull_request:
branches: [master]
paths: ['src/**', 'tests/**', 'pyproject.toml']

jobs:
build:
test-core:
name: ${{ matrix.platform }} / Python ${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]
python-version: ["3.10", "3.11", "3.12", "3.13"]

runs-on: ${{ matrix.platform }}

env:
FORCE_COLOR: true

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[test]"

- name: Test with pytest
run: |
pytest --cov --cov-report=xml --verbose

- name: Upload coverage report
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.python-version == 3.9 }}
uses: codecov/codecov-action@v4
with:
token: d5ef1de8-d1c4-4d89-b304-4d8fffdf9906
file: ./coverage.xml
- uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Set up uv
uses: astral-sh/setup-uv@v7

- name: Install dependencies
run: uv pip install --group=test . --system

- name: Test with pytest
run: pytest --verbose --no-cov

test-dependency-combinations:
name: Dep combo / ${{ matrix.platform }} / ${{ matrix.label }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, windows-latest]
include:
- label: minimum-versions
python-version: "3.10"
numpy: "1.22.4"
scipy: "1.8.0"
scikit-learn: "1.2.0"
numba: "0.57.0"
- label: old-versions
python-version: "3.11"
numpy: "1.25.2"
scipy: "1.11.4"
scikit-learn: "1.4.2"
numba: "0.59.0"
- label: mid-versions
python-version: "3.12"
numpy: "2.0.2"
scipy: "1.14.1"
scikit-learn: "1.5.2"
numba: "0.60.0"

runs-on: ${{ matrix.platform }}

env:
FORCE_COLOR: true

steps:
- uses: actions/checkout@v6

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}

- name: Set up uv
uses: astral-sh/setup-uv@v7

- name: Install numpy (pinned)
if: matrix.numpy != ''
run: uv pip install "numpy==${{ matrix.numpy }}" --system

- name: Install numpy (latest)
if: matrix.numpy == ''
run: uv pip install numpy --system

- name: Install pinned dependencies
if: matrix.label != 'latest-versions'
run: uv pip install "scipy==${{ matrix.scipy }}" "scikit-learn==${{ matrix.scikit-learn }}" "numba==${{ matrix.numba }}" --system

- name: Install latest dependencies
if: matrix.label == 'latest-versions'
run: uv pip install scipy scikit-learn numba --system

- name: Install antropy (no deps, already pinned above)
run: uv pip install . --no-deps --system

- name: Install test dependencies
run: uv pip install --group=test --system

- name: Print installed versions
run: |
python -c "import numpy, scipy, sklearn, numba; print(f'numpy={numpy.__version__}, scipy={scipy.__version__}, sklearn={sklearn.__version__}, numba={numba.__version__}')"

- name: Test with pytest
run: pytest --verbose --no-cov

coverage:
name: Coverage (Ubuntu)
runs-on: ubuntu-latest

env:
FORCE_COLOR: true
NUMBA_DISABLE_JIT: "1"

steps:
- uses: actions/checkout@v6

- name: Set up Python
uses: actions/setup-python@v6
with:
python-version-file: "pyproject.toml"

- name: Set up uv
uses: astral-sh/setup-uv@v7

- name: Install dependencies
run: uv pip install --group=test . --system

- name: Test with pytest and coverage
run: pytest --cov --cov-report=xml --verbose

- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
9 changes: 4 additions & 5 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- uses: astral-sh/setup-uv@v7
- name: "Linting"
uses: astral-sh/ruff-action@v1
run: uvx ruff check
- name: "Formatting"
uses: astral-sh/ruff-action@v1
with:
args: "format --check"
run: uvx ruff format --check
83 changes: 55 additions & 28 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

|

.. image:: https://badge.fury.io/py/antropy.svg
:target: https://badge.fury.io/py/antropy

.. image:: https://img.shields.io/conda/vn/conda-forge/antropy.svg
:target: https://anaconda.org/conda-forge/antropy

.. image:: https://img.shields.io/github/license/raphaelvallat/antropy.svg
:target: https://github.com/raphaelvallat/antropy/blob/master/LICENSE

Expand All @@ -11,23 +17,48 @@
.. image:: https://codecov.io/gh/raphaelvallat/antropy/branch/master/graph/badge.svg
:target: https://codecov.io/gh/raphaelvallat/antropy

----------------
.. image:: https://static.pepy.tech/badge/antropy
:target: https://pepy.tech/projects/antropy

.. figure:: https://github.com/raphaelvallat/antropy/blob/master/docs/pictures/logo.png?raw=true
:align: center
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Ruff

----------------

AntroPy is a Python 3 package providing several time-efficient algorithms for computing the complexity of time-series.
It can be used for example to extract features from EEG signals.
.. figure:: https://raw.githubusercontent.com/raphaelvallat/antropy/master/docs/pictures/logo.png
:align: center

Documentation
=============
**AntroPy** is a Python 3 package providing several time-efficient algorithms for computing
the complexity of time-series. It can be used for example to extract features from EEG signals.

- `Link to documentation <https://raphaelvallat.com/antropy/build/html/index.html>`_
- `Link to documentation <https://raphaelvallat.com/antropy/>`_

Installation
============

AntroPy can be installed with pip
Dependencies
------------

AntroPy is a Python 3 package and is currently tested for Python 3.10+.

The main dependencies of AntroPy are:

* `NumPy <https://numpy.org/>`_ >= 1.22.4
* `SciPy <https://scipy.org/>`_ >= 1.8.0
* `scikit-learn <https://scikit-learn.org/>`_ >= 1.2.0
* `Numba <https://numba.readthedocs.io/>`_ >= 0.57

User installation
-----------------

AntroPy can be easily installed using `uv <https://docs.astral.sh/uv/>`_

.. code-block:: shell

uv pip install antropy

pip

.. code-block:: shell

Expand All @@ -37,25 +68,21 @@ or conda

.. code-block:: shell

conda config --add channels conda-forge
conda config --set channel_priority strict
conda install antropy
conda install -c conda-forge antropy

Development
-----------

To build and install from source, clone this repository or download the source archive and decompress the files
To build and install from source, clone this repository and install in editable mode with `uv <https://docs.astral.sh/uv/>`_

.. code-block:: shell

git clone https://github.com/raphaelvallat/antropy.git
cd antropy
pip install ".[test]" # install the package
pip install -e ".[test]" # or editable install
pytest

**Dependencies**
uv pip install --group=test --editable .

- `numpy <https://numpy.org/>`_
- `scipy <https://www.scipy.org/>`_
- `scikit-learn <https://scikit-learn.org/>`_
- `numba <http://numba.pydata.org/>`_
# test the package
pytest --verbose

Functions
=========
Expand Down Expand Up @@ -117,7 +144,7 @@ Functions
0.47903505674073327

Execution time
~~~~~~~~~~~~~~
--------------

Here are some benchmarks computed on a MacBook Pro (2020).

Expand Down Expand Up @@ -165,9 +192,9 @@ Acknowledgement

Several functions of AntroPy were adapted from:

- MNE-features: https://github.com/mne-tools/mne-features
- pyEntropy: https://github.com/nikdon/pyEntropy
- pyrem: https://github.com/gilestrolab/pyrem
- nolds: https://github.com/CSchoel/nolds
- `MNE-features <https://github.com/mne-tools/mne-features>`_
- `pyEntropy <https://github.com/nikdon/pyEntropy>`_
- `pyrem <https://github.com/gilestrolab/pyrem>`_
- `nolds <https://github.com/CSchoel/nolds>`_

All the credit goes to the author of these excellent packages.
All the credit goes to the authors of these excellent packages.
Binary file added docs/_static/antropy.ico
Binary file not shown.
Binary file added docs/_static/antropy_128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
API reference
=============

Full list of available functions in AntroPy. Click on any function name to see its detailed documentation.

Entropy
-------

Expand Down
4 changes: 2 additions & 2 deletions docs/build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 7b2edb81324a2cee77846b2cbbcd2de8
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
config: b957fa437c4655d4207b5c46f99d8ce5
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added docs/build/html/_images/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading