Skip to content

ENH: Add JAMICA as an ICA method - #14247

Open
snesmaeili wants to merge 5 commits into
mne-tools:mainfrom
snesmaeili:jamica-ica
Open

ENH: Add JAMICA as an ICA method#14247
snesmaeili wants to merge 5 commits into
mne-tools:mainfrom
snesmaeili:jamica-ica

Conversation

@snesmaeili

Copy link
Copy Markdown

Reference issue (if any)

Related to #14207.

What does this implement/fix?

Adds method="jamica" as an optional, single-model ICA backend using the public jamica.amica API from JAMICA 0.3.0. MNE retains ownership of pre-whitening, PCA, dimension selection, reconstruction, and persistence; multi-model AMICA remains available through JAMICA directly.

The tests cover the external-solver matrix contract, deterministic direct-call equivalence, iteration metadata, optional-dependency handling, multi-model error propagation, source reconstruction, and FIF round trips without JAMICA installed.

JAMICA backend release: https://github.com/snesmaeili/jamica/releases/tag/v0.3.0

Additional information

Validation included the complete ICA test module, focused integration tests against the published JAMICA 0.3.0 package, configuration and docstring tests, pre-commit checks, and wheel/sdist validation.

AI assistance disclosure: OpenAI Codex was used to inspect both codebases, help implement the integration and tests, and run validation. I reviewed and approved the resulting changes before submission.

@welcome

welcome Bot commented Aug 28, 2026

Copy link
Copy Markdown

Hello! 👋 Thanks for opening your first pull request here! ❤️ We will try to get back to you soon. 🚴

@larsoner larsoner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just two tiny tweaks then I think we can merge!

Comment thread mne/preprocessing/ica.py
self.n_iter_ = n_iter + 1 # picard() starts counting at 0
del _, n_iter
elif self.method == "jamica":
from jamica import amica

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use _soft_import, it raises a nice error than a bare ImportError

assert amari_distance < 0.1


def test_ica_jamica_missing_dependency(monkeypatch):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need this one, we can trust _safe_import to do the right thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants