mne
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseMNE - Neurophysiology Analysis
MNE - 神经生理学分析
MNE provides sophisticated tools for filtering brain signals, epoching data, and performing source localization (mapping signals back to brain anatomy).
MNE提供了用于脑信号滤波、数据分段(Epoching)以及源定位(将信号映射回大脑解剖结构)的成熟工具。
When to Use
适用场景
- Processing EEG/MEG recordings from clinical or research studies.
- Analyzing event-related potentials (ERPs).
- Source localization (finding where in the brain signals originate).
- Connectivity analysis between brain regions.
- Preprocessing neurophysiological data for machine learning.
- 处理临床或研究中的EEG/MEG记录数据。
- 分析事件相关电位(ERPs)。
- 源定位(确定脑信号的起源位置)。
- 脑区间连接性分析。
- 为机器学习预处理神经生理数据。
Core Principles
核心原则
Raw → Epochs → Evoked
原始数据→分段数据→诱发响应
The standard pipeline: continuous raw data → segmented epochs → averaged evoked responses.
标准流程:连续原始数据→分段为Epochs→平均得到诱发响应。
Sensor Space vs. Source Space
传感器空间 vs 源空间
Sensor space: signals at electrodes. Source space: signals reconstructed at brain locations.
传感器空间:电极处的信号。源空间:在大脑位置重建的信号。
Frequency Analysis
频率分析
Brain signals are analyzed in frequency bands (delta, theta, alpha, beta, gamma).
脑信号按频段(delta、theta、alpha、beta、gamma)进行分析。
Quick Reference
快速参考
Standard Imports
标准导入
python
import mne
import numpy as nppython
import mne
import numpy as npBasic Patterns
基础用法
python
undefinedpython
undefined1. Load data
1. Load data
raw = mne.io.read_raw_fif("sample_audvis_raw.fif")
raw = mne.io.read_raw_fif("sample_audvis_raw.fif")
Or: raw = mne.io.read_raw_edf("eeg.edf")
Or: raw = mne.io.read_raw_edf("eeg.edf")
2. Filter and cleaning
2. Filter and cleaning
raw.filter(l_freq=1, h_freq=40) # Bandpass filter
raw.notch_filter(freqs=[50, 100]) # Remove power line noise
raw.filter(l_freq=1, h_freq=40) # Bandpass filter
raw.notch_filter(freqs=[50, 100]) # Remove power line noise
3. Find events and create Epochs
3. Find events and create Epochs
events = mne.find_events(raw)
epochs = mne.Epochs(raw, events, event_id={'stimulus': 1}, tmin=-0.2, tmax=0.5)
epochs.average().plot() # Plot Evoked potential
events = mne.find_events(raw)
epochs = mne.Epochs(raw, events, event_id={'stimulus': 1}, tmin=-0.2, tmax=0.5)
epochs.average().plot() # Plot Evoked potential
4. Frequency analysis
4. Frequency analysis
epochs.compute_psd().plot()
undefinedepochs.compute_psd().plot()
undefinedCritical Rules
关键规则
✅ DO
✅ 建议
- Filter before epoching - Apply filters to continuous data, not epochs.
- Check data quality - Use to visually inspect for artifacts.
raw.plot() - Set montage - Assign electrode positions for proper visualization.
- Reject bad epochs - Remove epochs with artifacts before averaging.
- 先滤波再分段 - 对连续数据应用滤波,而非分段后的Epochs数据。
- 检查数据质量 - 使用可视化检查伪影。
raw.plot() - 设置电极布局 - 分配电极位置以确保正确可视化。
- 剔除不良分段 - 平均前移除带有伪影的Epochs。
❌ DON'T
❌ 禁忌
- Don't filter too aggressively - Over-filtering removes signal along with noise.
- Don't ignore reference - EEG signals are relative. Know your reference electrode.
- Don't mix sampling rates - Ensure all channels have the same sampling rate.
- 不要过度滤波 - 过度滤波会在去除噪声的同时丢失有效信号。
- 不要忽略参考电极 - EEG信号是相对值,需明确参考电极。
- 不要混合采样率 - 确保所有通道的采样率一致。
Advanced Patterns
进阶用法
Source Localization
源定位
python
undefinedpython
undefinedCompute forward solution and inverse
Compute forward solution and inverse
fwd = mne.make_forward_solution(raw.info, trans, src, bem)
inv = mne.minimum_norm.make_inverse_operator(raw.info, fwd, cov)
stc = mne.minimum_norm.apply_inverse(evoked, inv)
stc.plot()
undefinedfwd = mne.make_forward_solution(raw.info, trans, src, bem)
inv = mne.minimum_norm.make_inverse_operator(raw.info, fwd, cov)
stc = mne.minimum_norm.apply_inverse(evoked, inv)
stc.plot()
undefinedConnectivity Analysis
连接性分析
python
from mne.connectivity import spectral_connectivitypython
from mne.connectivity import spectral_connectivityCompute connectivity between channels
Compute connectivity between channels
con, freqs, times, n_epochs, n_tapers = spectral_connectivity(
epochs, method='coh', mode='multitaper')
MNE is the gold standard for neurophysiological data analysis, enabling researchers to extract meaningful insights from the complex signals of the human brain.con, freqs, times, n_epochs, n_tapers = spectral_connectivity(
epochs, method='coh', mode='multitaper')
MNE是神经生理数据分析的黄金标准,助力研究人员从复杂的人类脑信号中提取有意义的见解。