Repository navigation
Description
Background
paper.md's "State of the field" section already names this gap: two other
Python AMICA reimplementations exist
(snesmaeili/amica,
DerAndereJohannes/pyamica), and
both ship MNE-Python integration as an optional extra (pip install amica[mne] / pip install pyamica[mne]) -- pyAMICA currently does not. This
is purely additive: the existing scikit-learn-style AMICA API and the
byte-identical EEGLAB I/O (write_amica_output/loadmodout15, #92) stay
exactly as they are. This gives pyAMICA both drop-in paths -- EEGLAB users keep
their existing workflow, MNE-Python users get a native entry point -- rather
than replacing one with the other.
Prior art worth learning from (architecture, not code -- both are BSD-3-Clause
so a look is fine, but pyAMICA has its own natural-gradient backend and Fortran
parity guarantees to preserve):
DerAndereJohannes/pyamica'sAmicaICAwrapper:.fit(raw, picks="eeg")
operating directly onmne.io.Raw,.apply(raw), and, notably, multi-model
support via.plot_model_dominance()and.review(raw, model_idx=m, eog_ch=..., ecg_ch=...)-- i.e. multi-model AMICA is exposed per-model
rather than avoided because MNE's ownICAclass assumes one unmixing
matrix.snesmaeili/amica: native MNE integration as an optional extra, also with
multi-model support, plus an optional JAX backend (not relevant to us, we
have torch_impl/mlx_impl already).
Scope
Phase 1 -- Core MNE wrapper (single-model): an MNE-facing wrapper class
(exact name/module TBD, e.g. pyAMICA.mne_compat) that fits directly from
mne.io.Raw/Epochs (picks=...), and interoperates with the standard
MNE ICA consumer surface (.apply(), component access, mne.viz component
plotting) for the single-model case. Ship as an optional pyAMICA[mne] extra
so import pyAMICA never requires MNE (same pattern already used for the
optional mlx extra).
Phase 2 -- Multi-model exposure: per-model posterior/dominance access and
per-model review/plotting for multi-model AMICA fits, since MNE's own ICA
class has no native multi-model concept. Follow the general shape of
AmicaICA.plot_model_dominance()/.review(raw, model_idx=...), adapted to
pyAMICA's exact-EM per-model statistics and AMICATorchNG's existing
comp_list/component-sharing machinery.
Phase 3 -- Preserve pyAMICA-specific metadata through the MNE-facing objects:
adaptive source-density family (pdftype 0-4) per component, the GG shape
parameter rho, and component-sharing state should remain inspectable, not
silently dropped in the name of MNE compatibility.
Phase 4 -- Wire in PMI/MIR (depends on #133): once the MIR/PMI port lands,
expose it through the MNE-facing wrapper too (e.g. ica.mir(raw)/ica.pmi()),
so MNE-side users get the same separation-quality metrics EEGLAB-side users
get via #133's phases.
Out of scope
Replacing or deprecating the existing EEGLAB I/O or the scikit-learn-style
AMICA/AMICATorchNG API -- both stay as they are; this is a new, additional
entry point.
Activity
Merge pull request #191 from sccn/feature/issue-139-epic-mne-compat