meeg-utils Documentation#

Python 3.11+ License: MIT Code style: ruff

A Python-based MEG/EEG processing toolkit built on MNE-Python, providing a high-level, user-friendly API for preprocessing electrophysiological data.

Features#

  • High-level API - Simple, intuitive interface for complex preprocessing pipelines

  • BIDS Support - Native support for Brain Imaging Data Structure (BIDS)

  • Advanced Preprocessing:

    • Automated bad channel detection (PREP pipeline for EEG, Maxwell filtering for MEG)

    • Line noise removal (Zapline/Zapline-iter)

    • ICA-based artifact removal with automatic labeling (ICLabel for EEG, MEGNet for MEG)

  • Batch Processing - Parallel processing of multiple datasets

  • Type-safe - Full type hints for better IDE support

  • Well-tested - Comprehensive test suite with >80% coverage

Quick Start#

Installation#

pip install meeg-utils

Basic Usage#

from meeg_utils.preprocessing import PreprocessingPipeline
from mne_bids import BIDSPath

# Define input
bids_path = BIDSPath(
    subject="01",
    session="01",
    task="rest",
    datatype="eeg",
    root="/path/to/bids/dataset"
)

# Create and run pipeline
pipeline = PreprocessingPipeline(
    input_path=bids_path,
    output_dir="/path/to/output"
)

raw_preprocessed = pipeline.run(
    filter_params={"highpass": 0.1, "lowpass": 100.0, "sfreq": 250.0},
    detect_bad_channels=True,
    remove_line_noise=True,
    apply_ica=True,
)

# Save results
pipeline.save()

Indices and tables#