A Python implementation of the AMICA (Adaptive Mixture Independent Component Analysis) algorithm for blind source separation, that was originally developed in FORTRAN by Jason Palmer at the Swartz Center for Computational Neuroscience (SCCN). AMICA-Python is correctness tested against the Fortran implementation.
| Python | Fortran |
|---|---|
![]() |
![]() |
AMICA-Python is available from PyPI and conda-forge. Since AMICA-Python uses PyTorch for the core numerical routines, installation depending on which PyTorch build you need (e.g. CPU-only or with GPU support):
uv pip install "amica-python[torch-cpu]"For a CUDA-enabled PyTorch install, use:
uv pip install "amica-python[torch-cuda]"You can also install with pip:
python -m pip install "amica-python[torch-cpu]"Or with conda-forge, which installs the PyTorch runtime dependency as part of the AMICA-Python package:
conda install -c conda-forge amica-pythonIf you need a specific PyTorch build, install PyTorch first using the instructions for your platform at pytorch.org, then install AMICA-Python without the PyTorch extra:
python -m pip install amica-pythonAMICA-Python exposes a scikit-learn interface. Here is an example of how to use it:
import numpy as np
from scipy import signal
from amica import AMICA
rng = np.random.default_rng(0)
n_samples = 2000
time = np.linspace(0, 8, n_samples)
s1 = np.sin(2 * time) # Sinusoidal
s2 = np.sign(np.sin(3 * time)) # Square wave
s3 = signal.sawtooth(2 * np.pi * time) # Sawtooth
S = np.c_[s1, s2, s3]
S += 0.2 * rng.standard_normal(S.shape) # Add noise
S /= S.std(axis=0) # Standardize
A = np.array([[1, 1, 1],
[0.5, 2, 1.0],
[1.5, 1.0, 2.0]]) # Mixing matrix
X = S @ A.T # Observed mixtures
ica = AMICA(random_state=0)
X_new = ica.fit_transform(X)If PyTorch was installed with CUDA support, you can fit AMICA on GPU:
ica = AMICA(device='cuda', random_state=0)For more examples and documentation, please see the documentation.


