非官方中文翻译 本页译自 MNE-Python 官方文档: 查看英文原文 ↗。 文档版权归 MNE Developers 所有(BSD-3-Clause)。

绘制诱发数据的地形箭头图#

加载诱发数据,并针对选定时间点把箭头图与地形图一起绘制。箭头图基于 Hosaka-Cohen 变换,表示对 MEG 传感器下方电流分布的估计,可视为“简易版 MNE”。

详见 [1]。

参考文献#

# Authors: Sheraz Khan <sheraz@khansheraz.com>
#
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.
import numpy as np

import mne
from mne import read_evokeds
from mne.datasets import sample
from mne.datasets.brainstorm import bst_raw
from mne.viz import plot_arrowmap

print(__doc__)

path = sample.data_path()
fname = path / "MEG" / "sample" / "sample_audvis-ave.fif"

# load evoked data
condition = "Left Auditory"
evoked = read_evokeds(fname, condition=condition, baseline=(None, 0))
evoked_mag = evoked.copy().pick(picks="mag", exclude="bads")
evoked_grad = evoked.copy().pick(picks="grad", exclude="bads")
Reading /home/circleci/mne_data/MNE-sample-data/MEG/sample/sample_audvis-ave.fif ...
    Read a total of 4 projection items:
        PCA-v1 (1 x 102) active
        PCA-v2 (1 x 102) active
        PCA-v3 (1 x 102) active
        Average EEG reference (1 x 60) active
    Found the data of interest:
        t =    -199.80 ...     499.49 ms (Left Auditory)
        0 CTF compensation matrices available
        nave = 55 - aspect type = 100
Projections have already been applied. Setting proj attribute to True.
Applying baseline correction (mode: mean)

把磁强计数据绘制为箭头图,并附上传感器空间活动最大时刻的地形图:

max_time_idx = np.abs(evoked_mag.data).mean(axis=0).argmax()
plot_arrowmap(evoked_mag.data[:, max_time_idx], evoked_mag.info)

# Since planar gradiometers takes gradients along latitude and longitude,
# they need to be projected to the flatten manifold span by magnetometer
# or radial gradiometers before taking the gradients in the 2D Cartesian
# coordinate system for visualization on the 2D topoplot. You can use the
# ``info_from`` and ``info_to`` parameters to interpolate from
# gradiometer data to magnetometer data.
evoked arrowmap

把梯度计数据绘制为箭头图,并附上传感器空间活动最大时刻的地形图:

evoked arrowmap
Computing dot products for 203 MEG channels...
Computing cross products for 203 → 102 MEG channels...
Preparing the mapping matrix...
Truncating at 79/203 components to omit less than 0.0001 (9.2e-05)

由于 Vectorview 102 系统对磁场做稀疏空间采样,可把 Vectorview(info_from)的数据投影到高密度 CTF 272 系统(info_to)以便可视化。

把梯度计数据绘制为箭头图,并附上传感器空间活动最大时刻的地形图:

path = bst_raw.data_path()
raw_fname = path / "MEG" / "bst_raw" / "subj001_somatosensory_20111109_01_AUX-f.ds"
raw_ctf = mne.io.read_raw_ctf(raw_fname)
raw_ctf_info = mne.pick_info(
    raw_ctf.info, mne.pick_types(raw_ctf.info, meg=True, ref_meg=False)
)
plot_arrowmap(
    evoked_grad.data[:, max_time_idx],
    info_from=evoked_grad.info,
    info_to=raw_ctf_info,
    scale=6e-10,
)
evoked arrowmap
ds directory : /home/circleci/mne_data/MNE-brainstorm-data/bst_raw/MEG/bst_raw/subj001_somatosensory_20111109_01_AUX-f.ds
    res4 data read.
    hc data read.
    Separate EEG position data file not present.
    Quaternion matching (desired vs. transformed):
       0.84   69.49    0.00 mm <->    0.84   69.49   -0.00 mm (orig :  -44.30   51.45 -252.43 mm) diff =    0.000 mm
      -0.84  -69.49    0.00 mm <->   -0.84  -69.49   -0.00 mm (orig :   46.28  -53.58 -243.47 mm) diff =    0.000 mm
      86.41    0.00    0.00 mm <->   86.41    0.00    0.00 mm (orig :   63.60   55.82 -230.26 mm) diff =    0.000 mm
    Coordinate transformations established.
    Reading digitizer points from ['/home/circleci/mne_data/MNE-brainstorm-data/bst_raw/MEG/bst_raw/subj001_somatosensory_20111109_01_AUX-f.ds/subj00111092011.pos']...
    Polhemus data for 3 HPI coils added
    Device coordinate locations for 3 HPI coils added
Picked positions of 2 EEG channels from channel info
    2 EEG locations added to Polhemus data.
    Measurement info composed.
Finding samples for /home/circleci/mne_data/MNE-brainstorm-data/bst_raw/MEG/bst_raw/subj001_somatosensory_20111109_01_AUX-f.ds/subj001_somatosensory_20111109_01_AUX-f.meg4:
    System clock channel is available, checking which samples are valid.
    240 x 1800 = 432000 samples from 302 chs
Current compensation grade : 3
Removing 5 compensators from info because not all compensation channels were picked.
    Computing dot products for 203 MEG channels...
    Computing cross products for 203 → 272 MEG channels...
    Preparing the mapping matrix...
    Truncating at 79/203 components to omit less than 0.0001 (9.2e-05)

脚本总运行时间:(0 分 7.802 秒)

图库由 Sphinx-Gallery 生成