Skip to main content

jamica

CI Docs Codecov PyPI - Version conda-forge Python Versions License DOI

jamica 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. jamica provides an open, extensible Python implementation with optional JAX acceleration, seamless MNE-Python integration, and a modern Python API for reproducible neuroimaging workflows.

Status: jamica 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 jamica

or, from conda-forge:

conda install -c conda-forge jamica

Renamed from amica. Releases up to 0.1.0 were published as amica. That name installed a top-level amica module, which collided with amica-python — an independent implementation of the same algorithm by another author — so the two could not coexist in one environment. Since 0.2.0 this project installs as jamica, and the two can be installed side by side.

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 "jamica[jax]"        # JAX backend, JIT-compiled CPU
pip install "jamica[gpu]"        # JAX with CUDA 12 (Linux only)
pip install "jamica[mne]"        # MNE-Python integration, fit_ica()
pip install "jamica[icalabel]"   # ICLabel component classification
pip install "jamica[viz]"        # plotting and density diagnostics
pip install "jamica[all]"        # everything above

From source

For development, or to run the test suite:

git clone https://github.com/snesmaeili/jamica.git
cd jamica
pip install -e ".[dev]"

With uv:

git clone https://github.com/snesmaeili/jamica.git
cd jamica
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]"

Quick Start

from jamica 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 jamica 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/jamica/


Validation

jamica 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=1 and K=3 adaptive-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 jamica contributes to your research, please cite the original AMICA publications.

Citation metadata is available in CITATION.cff.


License

jamica 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

jamica-0.2.0.tar.gz (117.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jamica-0.2.0-py3-none-any.whl (89.1 kB view details)

Uploaded Python 3

File details

Details for the file jamica-0.2.0.tar.gz.

File metadata

  • Download URL: jamica-0.2.0.tar.gz
  • Upload date:
  • Size: 117.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for jamica-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3845127d84895949cf6dd252b548a6fb39bd0cdbbe651c40891aa242ef302f2d
MD5 74cb91a90498cddd37673c7ce4142398
BLAKE2b-256 4301d3e8ee32c4fbad95ae1657120c925dec8fb59363fd8140129fa71a29c0d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for jamica-0.2.0.tar.gz:

Publisher: release.yml on snesmaeili/jamica

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jamica-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: jamica-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 89.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for jamica-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c0d2914218f5e49bdddaf01f42610bceb53d8c7c2e24e87baad34f0a7a8be3e
MD5 ee284779cdc7e400dd2fcd9a38aae751
BLAKE2b-256 ee94c27e446d94a88b5db91328c058cd89f94a30b165ec79f30e1de7408712e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for jamica-0.2.0-py3-none-any.whl:

Publisher: release.yml on snesmaeili/jamica

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page