File: virtual_evoked.py

package info (click to toggle)
python-mne 1.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 100,172 kB
  • sloc: python: 166,349; pascal: 3,602; javascript: 1,472; sh: 334; makefile: 236
file content (62 lines) | stat: -rw-r--r-- 1,632 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -*- coding: utf-8 -*-
"""
.. _ex-virtual-evoked:

=======================
Remap MEG channel types
=======================

In this example, MEG data are remapped from one channel type to another.
This is useful to:

    - visualize combined magnetometers and gradiometers as magnetometers
      or gradiometers.
    - run statistics from both magnetometers and gradiometers while
      working with a single type of channels.
"""

# Author: Mainak Jas <mainak.jas@telecom-paristech.fr>

# License: BSD-3-Clause

# %%

import mne
from mne.datasets import sample

print(__doc__)

# read the evoked
data_path = sample.data_path()
meg_path = data_path / 'MEG' / 'sample'
fname = meg_path / 'sample_audvis-ave.fif'
evoked = mne.read_evokeds(fname, condition='Left Auditory', baseline=(None, 0))

# %%
# First, let's call remap gradiometers to magnometers, and plot
# the original and remapped topomaps of the magnetometers.

# go from grad + mag to mag and plot original mag
virt_evoked = evoked.as_type('mag')
fig = evoked.plot_topomap(ch_type='mag')
fig.suptitle('mag (original)')
# %%

# plot interpolated grad + mag
fig = virt_evoked.plot_topomap(ch_type='mag')
fig.suptitle('mag (interpolated from mag + grad)')

# %%
# Now, we remap magnometers to gradiometers, and plot
# the original and remapped topomaps of the gradiometers

# go from grad + mag to grad and plot original grad
virt_evoked = evoked.as_type('grad')
fig = evoked.plot_topomap(ch_type='grad')
fig.suptitle('grad (original)')

# %%

# plot interpolated grad + mag
fig = virt_evoked.plot_topomap(ch_type='grad')
fig.suptitle('grad (interpolated from mag + grad)')