Installation

From PyPI

Core package (no MNE dependency):

pip install pyamica

With MNE-Python integration:

pip install "pyamica[mne]"

With uv:

uv add pyamica
uv add "pyamica[mne]"

GPU Support

Warning

Only CPU and CUDA have been tested. Other backends (ROCm, XPU) may work but are untested.

Apple Silicon (MPS): PyTorch’s MPS backend does not support 64-bit floating point. When device="mps" is used, pyamica automatically falls back to 32-bit floats (torch.float32). Results will be less numerically precise than on CPU or CUDA, and large numerical differences relative to the reference Fortran implementation are expected. This was mainly implemented for the sake of completeness and with the hope that furture Apple Silicon chips will have support.

If you need a specific CUDA version (e.g. CUDA 11.8 vs 12.x), install the matching PyTorch build before installing pyamica. See the PyTorch installation guide for the correct index URL.

Pass device="cuda" (or "mps" on Apple Silicon) when constructing AMICA or AmicaICA.

Development Install

git clone https://github.com/DerAndereJohannes/pyamica
cd pyamica
pip install -e ".[mne,dev]"

With uv:

git clone https://github.com/DerAndereJohannes/pyamica
cd pyamica
uv sync --extra mne --extra dev

Running the tests:

pytest tests/ -v -m "not slow and not gpu"
uv run pytest tests/ -v -m "not slow and not gpu"   # uv

Building the Documentation

pip install -e ".[docs]"
sphinx-build docs docs/_build/html

With uv:

uv sync --extra docs
uv run sphinx-build docs docs/_build/html

The generated HTML is at docs/_build/html/index.html.