This project has been archived by its maintainers, and is no longer receiving any updates.
amica
amica is a native Python implementation of AMICA (Adaptive Mixture Independent Component Analysis), one of the highest-performing ICA algorithms for EEG source separation.
The canonical implementation is a Fortran program from UCSD, typically driven through MATLAB- or EEGLAB-based workflows. amica provides an open, extensible Python implementation with optional JAX acceleration, seamless MNE-Python integration, and a modern Python API for reproducible neuroimaging workflows.
Status: amica reproduces the Fortran AMICA 1.7 reference on the tested single-model configurations. Validation scope, the exact reference build used, and known limitations are described under Validation.
Highlights
- Native Python implementation of the AMICA algorithm
- Numerical agreement with the Fortran AMICA 1.7 reference on the tested configurations
- Optional JAX backend for CPU and GPU acceleration
- Native integration with MNE-Python
- Support for multi-model AMICA
- Modern scientific Python API
- Extensive testing and continuous integration
- Fully open source (BSD-3-Clause)
Installation
pip install amica
The core install depends only on NumPy and SciPy. Everything else is an optional extra, so a CPU-only NumPy install stays small:
pip install "amica[jax]" # JAX backend, JIT-compiled CPU
pip install "amica[gpu]" # JAX with CUDA 12 (Linux only)
pip install "amica[mne]" # MNE-Python integration, fit_ica()
pip install "amica[icalabel]" # ICLabel component classification
pip install "amica[viz]" # plotting and density diagnostics
pip install "amica[all]" # everything above
From source
For development, or to run the test suite:
git clone https://github.com/snesmaeili/amica.git
cd amica
pip install -e ".[dev]"
With uv:
git clone https://github.com/snesmaeili/amica.git
cd amica
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"
Quick Start
from amica import Amica, AmicaConfig
config = AmicaConfig(
max_iter=2000,
num_mix_comps=3,
)
model = Amica(config, random_state=42)
result = model.fit(data)
sources = model.transform(data)
For MNE-Python:
from amica import fit_ica
ica = fit_ica(raw)
ica.plot_components()
ica.apply(raw)
Examples
Example scripts are available in the examples/ directory, including:
- MNE-Python integration
- Native AMICA API
- JAX acceleration
- Multi-model AMICA
- HPC / SLURM execution
Documentation
Full documentation, API reference, validation experiments, and tutorials are available at
https://snesmaeili.github.io/amica/
Validation
amica has been validated against the Fortran AMICA 1.7 reference implementation.
Scope of that validation, stated precisely so it is not over-read:
- Single-model fits. Six-channel Laplacian fixtures with
K=1andK=3adaptive-density terms, under Newton and natural-gradient updates, plus a 100-iteration audit on real EEG. Final log-likelihoods, unmixing matrices and adaptive-density parameters agree closely. - The reference was a locally patched build. Stock AMICA 1.7 does not converge on these fixtures; three corrections were required, including a generalized-Gaussian score exponent fix. The patched source and build recipe are included in the validation archive accompanying the manuscript; that archive is not yet deposited, so the patch is not currently redistributable from this repository. Comparisons against an unpatched upstream build will not reproduce these numbers.
- Not covered by the parity fixtures: multi-model agreement with Fortran, long high-dimensional optimisation runs, and likelihood-based sample rejection. Rejection follows the reference procedure but its equivalence was not measured against the reference build.
Backend agreement (JAX-GPU / JAX-CPU / NumPy-CPU) is close in aggregate, but component-level agreement is not guaranteed on every recording: fits that reach the same likelihood can still differ in individual component subspaces. Check component identity if you switch backends mid-analysis.
The documentation contains:
- validation experiments
- numerical parity analyses
- performance benchmarks
- reproducibility instructions
Contributing
Contributions are welcome!
Please read CONTRIBUTING.md before opening a pull request.
Citation
If amica contributes to your research, please cite the original AMICA publications.
Citation metadata is available in CITATION.cff.
License
amica is distributed under the terms of the BSD 3-Clause License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file amica-0.1.0.tar.gz.
File metadata
- Download URL: amica-0.1.0.tar.gz
- Upload date:
- Size: 98.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0cb407c9e74328322125002d4673bc51c0d69b79b2d584233a266d0c00f015c
|
|
| MD5 |
e6a6962f22b31053f2a8c37cfaec0b1e
|
|
| BLAKE2b-256 |
b9fdf57504a339c66a9a9f2afefb6f85028a6c113633444a138e6cf786d371a5
|
Provenance
The following attestation bundles were made for amica-0.1.0.tar.gz:
Publisher:
release.yml on snesmaeili/amica
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
amica-0.1.0.tar.gz -
Subject digest:
c0cb407c9e74328322125002d4673bc51c0d69b79b2d584233a266d0c00f015c - Sigstore transparency entry: 2354839820
- Sigstore integration time:
-
Permalink:
snesmaeili/amica@d74775ac4e4bb6145c5a3bb922a68eac8e86eb1b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/snesmaeili
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d74775ac4e4bb6145c5a3bb922a68eac8e86eb1b -
Trigger Event:
release
-
Statement type:
File details
Details for the file amica-0.1.0-py3-none-any.whl.
File metadata
- Download URL: amica-0.1.0-py3-none-any.whl
- Upload date:
- Size: 69.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c28fd8d0b68fbc204a050be0b62a306c1f579c2cdb38e88c45c4932fee3fb21
|
|
| MD5 |
4d30cb7a81ee3730ca882817ceb5baff
|
|
| BLAKE2b-256 |
6aeead2e16a40203ce8685be9e644af4e40b845720e216cdfb27cd37c1904d35
|
Provenance
The following attestation bundles were made for amica-0.1.0-py3-none-any.whl:
Publisher:
release.yml on snesmaeili/amica
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
amica-0.1.0-py3-none-any.whl -
Subject digest:
2c28fd8d0b68fbc204a050be0b62a306c1f579c2cdb38e88c45c4932fee3fb21 - Sigstore transparency entry: 2354839902
- Sigstore integration time:
-
Permalink:
snesmaeili/amica@d74775ac4e4bb6145c5a3bb922a68eac8e86eb1b -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/snesmaeili
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d74775ac4e4bb6145c5a3bb922a68eac8e86eb1b -
Trigger Event:
release
-
Statement type: