Skip to content

ENH: Add JAMICA as an ICA method - #14247

Merged
larsoner merged 6 commits into
mne-tools:mainfrom
snesmaeili:jamica-ica
Aug 31, 2026
Merged

ENH: Add JAMICA as an ICA method#14247
larsoner merged 6 commits into
mne-tools:mainfrom
snesmaeili:jamica-ica

Conversation

@snesmaeili

Copy link
Copy Markdown
Contributor

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 Outdated
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

Comment thread mne/preprocessing/tests/test_ica.py Outdated
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

@snesmaeili

snesmaeili commented Aug 30, 2026

Copy link
Copy Markdown
Contributor Author

Is it ok now? @larsoner

@larsoner
larsoner merged commit eda9ed6 into mne-tools:main Aug 31, 2026
31 checks passed
@welcome

welcome Bot commented Aug 31, 2026

Copy link
Copy Markdown

🎉 Congrats on merging your first pull request! 🥳 Looking forward to seeing more from you in the future! 💪

@larsoner

Copy link
Copy Markdown
Member

Yep, thanks @snesmaeili !

larsoner added a commit to larsoner/mne-python that referenced this pull request Sep 2, 2026
* upstream/main: (22 commits)
  Avoid copying all epochs data in GetEpochsMixin._getitem (mne-tools#14262)
  Add Report.save(only_if_changed=True) (mne-tools#14261)
  Add jamica to related software [ci skip] (mne-tools#14260)
  Remove debugging cruft (mne-tools#14259)
  ENH: add Raw annotation span conversion (mne-tools#14240)
  Interactive dipole fitting: add STC mesh controls (mne-tools#14256)
  Document code principles in AGENTS.md (mne-tools#14239)
  MAINT: Update dependency specifiers (mne-tools#14257)
  [dependabot]: Bump the actions group with 2 updates (mne-tools#14258)
  ENH: Add JAMICA as an ICA method (mne-tools#14247)
  Reuse the MEF session across reads (mne-tools#14254)
  Read KIT data in cache-sized blocks (mne-tools#14255)
  Read EGI simple-binary event channels in blocks (mne-tools#14250)
  Decode Persyst and Nihon Kohden data in cache-sized blocks (mne-tools#14251)
  Normalize byte order before calibrating strided integer buffers (mne-tools#14252)
  Speed up EDF and BDF reading (mne-tools#14237)
  ENH: Add Forward-based projection reconstruction (mne-tools#14235)
  Read Artemis123, Curry, EEGLAB, Eximia, FIL and NSx in cache-sized blocks (mne-tools#14246)
  Remove rotating dipoles capability from interactive dipole fitting GUI (mne-tools#14243)
  Read BrainVision data in cache-sized blocks [ci skip] (mne-tools#14241)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants