mne.report.Report

class mne.report.Report(info_fname=None, subjects_dir=None, subject=None, title=None, cov_fname=None, baseline=None, image_format='png', verbose=None)[source]

Object for rendering HTML.

Parameters:
info_fname : str

Name of the file containing the info dictionary.

subjects_dir : str | None

Path to the SUBJECTS_DIR. If None, the path is obtained by using the environment variable SUBJECTS_DIR.

subject : str | None

Subject name.

title : str

Title of the report.

cov_fname : str

Name of the file containing the noise covariance.

baseline : None or tuple of length 2 (default (None, 0))

The time interval to apply baseline correction for evokeds. If None do not apply it. If baseline is (a, b) the interval is between “a (s)” and “b (s)”. If a is None the beginning of the data is used and if b is None then b is set to the end of the interval. If baseline is equal to (None, None) all the time interval is used. The baseline (a, b) includes both endpoints, i.e. all timepoints t such that a <= t <= b.

image_format : str

Default image format to use (default is ‘png’). SVG uses vector graphics, so fidelity is higher but can increase file size and browser image rendering time as well.

New in version 0.15.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

Notes

To toggle the show/hide state of all sections in the html report, press ‘t’

New in version 0.8.0.

Methods

__hash__($self, /) Return hash(self).
__len__() Return the number of items in report.
add_bem_to_section(subject[, caption, …]) Render a bem slider html str.
add_figs_to_section(figs, captions[, …]) Append custom user-defined figures.
add_htmls_to_section(htmls, captions[, section]) Append htmls to the report.
add_images_to_section(fnames, captions[, …]) Append custom user-defined images.
add_slider_to_section(figs[, captions, …]) Render a slider of figs to the report.
parse_folder(data_path[, pattern, n_jobs, …]) Render all the files in the folder.
save([fname, open_browser, overwrite]) Save html report and open it in browser.
__hash__($self, /)

Return hash(self).

__len__()[source]

Return the number of items in report.

add_bem_to_section(subject, caption='BEM', section='bem', decim=2, n_jobs=1, subjects_dir=None)[source]

Render a bem slider html str.

Parameters:
subject : str

Subject name.

caption : str

A caption for the bem.

section : str

Name of the section. If section already exists, the bem will be appended to the end of the section.

decim : int

Use this decimation factor for generating MRI/BEM images (since it can be time consuming).

n_jobs : int

Number of jobs to run in parallel.

subjects_dir : str | None

Path to the SUBJECTS_DIR. If None, the path is obtained by using the environment variable SUBJECTS_DIR.

Notes

New in version 0.9.0.

add_figs_to_section(figs, captions, section='custom', scale=None, image_format=None, comments=None)[source]

Append custom user-defined figures.

Parameters:
figs : list of figures.

Each figure in the list can be an instance of matplotlib.figure.Figure, mayavi.core.api.Scene, or numpy.ndarray.

captions : list of str

A list of captions to the figures.

section : str

Name of the section. If section already exists, the figures will be appended to the end of the section

scale : float | None | callable

Scale the images maintaining the aspect ratio. If None, no scaling is applied. If float, scale will determine the relative scaling (might not work for scale <= 1 depending on font sizes). If function, should take a figure object as input parameter. Defaults to None.

image_format : str | None

The image format to be used for the report, can be ‘png’ or ‘svd’. None (default) will use the default specified during Report class construction.

comments : None | str | list of str

A string of text or a list of strings of text to be appended after the figure.

add_htmls_to_section(htmls, captions, section='custom')[source]

Append htmls to the report.

Parameters:
htmls : str | list of str

An html str or a list of html str.

captions : str | list of str

A caption or a list of captions to the htmls.

section : str

Name of the section. If section already exists, the images will be appended to the end of the section.

Notes

New in version 0.9.0.

add_images_to_section(fnames, captions, scale=None, section='custom', comments=None)[source]

Append custom user-defined images.

Parameters:
fnames : str | list of str

A filename or a list of filenames from which images are read. Images can be PNG, GIF or SVG.

captions : str | list of str

A caption or a list of captions to the images.

scale : float | None

Scale the images maintaining the aspect ratio. Defaults to None. If None, no scaling will be applied.

section : str

Name of the section. If section already exists, the images will be appended to the end of the section.

comments : None | str | list of str

A string of text or a list of strings of text to be appended after the image.

add_slider_to_section(figs, captions=None, section='custom', title='Slider', scale=None, image_format=None)[source]

Render a slider of figs to the report.

Parameters:
figs : list of figures.

Each figure in the list can be an instance of matplotlib.figure.Figure, mayavi.core.api.Scene, or numpy.ndarray. Must have at least 2 elements.

captions : list of str | list of float | None

A list of captions to the figures. If float, a str will be constructed as %f s. If None, it will default to Data slice %d.

section : str

Name of the section. If section already exists, the figures will be appended to the end of the section.

title : str

The title of the slider.

scale : float | None | callable

Scale the images maintaining the aspect ratio. If None, no scaling is applied. If float, scale will determine the relative scaling (might not work for scale <= 1 depending on font sizes). If function, should take a figure object as input parameter. Defaults to None.

image_format : str | None

The image format to be used for the report, can be ‘png’ or ‘svd’. None (default) will use the default specified during Report class construction.

Notes

New in version 0.10.0.

parse_folder(data_path, pattern='*.fif', n_jobs=1, mri_decim=2, sort_sections=True, on_error='warn', image_format=None, render_bem=True, verbose=None)[source]

Render all the files in the folder.

Parameters:
data_path : str

Path to the folder containing data whose HTML report will be created.

pattern : str | list of str

Filename pattern(s) to include in the report. Example: [*raw.fif, *ave.fif] will include Raw as well as Evoked files.

n_jobs : int

Number of jobs to run in parallel.

mri_decim : int

Use this decimation factor for generating MRI/BEM images (since it can be time consuming).

sort_sections : bool
If True, sort sections in the order: raw -> events -> epochs

-> evoked -> covariance -> trans -> mri -> forward -> inverse.

on_error : str

What to do if a file cannot be rendered. Can be ‘ignore’, ‘warn’ (default), or ‘raise’.

image_format : str | None

The image format to be used for the report, can be ‘png’ or ‘svd’. None (default) will use the default specified during Report class construction.

New in version 0.15.

render_bem : bool

If True (default), try to render the BEM.

New in version 0.16.

verbose : bool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

save(fname=None, open_browser=True, overwrite=False)[source]

Save html report and open it in browser.

Parameters:
fname : str

File name of the report.

open_browser : bool

Open html browser after saving if True.

overwrite : bool

If True, overwrite report if it already exists.