osl_dynamics.meeg.amm#

Adaptive Multipole Model (AMM) for OPM interference rejection.

Consolidates spherical harmonics, spheroid fitting, prolate coordinate transforms, internal/external harmonic bases, and the AMM denoising pipeline.

Translated from spm_opm_amm.m and supporting SPM functions.

Examples

Apply AMM denoising to OPM data:

import mne
from osl_dynamics.meeg.amm import apply_amm

raw = mne.io.read_raw_fif("sub-01_task-rest_meg.fif", preload=True)
raw_clean, info = apply_amm(raw, li=9, le=2)

The returned info dict contains the harmonic bases and residuals.

References

Tierney, T.M., Seedat, Z., St Pier, K. et al. (2024). Adaptive multipole models of optically pumped magnetometer data. Human Brain Mapping, 45, e26596. https://doi.org/10.1002/hbm.26596

Functions#

apply_amm(raw[, li, le, window, corr_lim])

Apply AMM denoising.

Module Contents#

osl_dynamics.meeg.amm.apply_amm(raw, li=9, le=2, window=10.0, corr_lim=0.98)[source]#

Apply AMM denoising.

Parameters:
  • raw (mne.io.Raw) – Raw data with MEG channel positions and orientations.

  • li (int) – Internal harmonic order. Default: 9.

  • le (int) – External harmonic order. Default: 2.

  • window (float) – Temporal window size in seconds. Default: 10.

  • corr_lim (float) – CCA correlation limit (1.0 = no CCA). Default: 1.0.

Returns:

  • raw_amm (mne.io.Raw) – Copy of raw with denoised data.

  • info (dict) – Spheroid fitting info (center, radii, a, b, longest_axis).

Return type:

tuple[mne.io.Raw, dict]

References

Tierney, T.M., Seedat, Z., St Pier, K. et al. (2024). Adaptive multipole models of optically pumped magnetometer data. Human Brain Mapping, 45, e26596. https://doi.org/10.1002/hbm.26596