File: make_report.py

package info (click to toggle)
python-mne 0.13.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 92,032 kB
  • ctags: 8,249
  • sloc: python: 84,750; makefile: 205; sh: 15
file content (37 lines) | stat: -rw-r--r-- 988 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
"""
================================
Make an MNE-Report with a Slider
================================

In this example, MEG evoked data are plotted in an html slider.
"""

# Authors: Teon Brooks <teon.brooks@gmail.com
#
# License: BSD (3-clause)

from mne.report import Report
from mne.datasets import sample
from mne import read_evokeds
from matplotlib import pyplot as plt


report = Report()
path = sample.data_path()
fname = path + '/MEG/sample/sample_audvis-ave.fif'

# Load the evoked data
evoked = read_evokeds(fname, condition='Left Auditory',
                      baseline=(None, 0), verbose=False)
evoked.crop(0, .2)
times = evoked.times[::4]
# Create a list of figs for the slider
figs = list()
for time in times:
    figs.append(evoked.plot_topomap(time, vmin=-300, vmax=300,
                                    res=100, show=False))
    plt.close(figs[-1])
report.add_slider_to_section(figs, times, 'Evoked Response')

# # to save report
# report.save('foobar.html', True)