mne.Report¶
- class mne.Report(info_fname=None, subjects_dir=None, subject=None, title=None, cov_fname=None, baseline=None, image_format='png', raw_psd=False, projs=False, verbose=None)[source]¶
Object for rendering HTML.
- Parameters
- info_fname
None
|str
Name of the file containing the info dictionary.
- subjects_dir
str
|None
The path to the FreeSurfer subjects reconstructions. It corresponds to FreeSurfer environment variable
SUBJECTS_DIR
.- subject
str
|None
Subject name.
- title
str
Title of the report.
- cov_fname
None
|str
Name of the file containing the noise covariance.
- baseline
None
|tuple
of length 2 The time interval to consider as “baseline” when applying baseline correction. If
None
, do not apply baseline correction. If a tuple(a, b)
, the interval is betweena
andb
(in seconds), including the endpoints. Ifa
isNone
, the beginning of the data is used; and ifb
isNone
, it is set to the end of the interval. If(None, None)
, the entire time interval is used.Note
The baseline
(a, b)
includes both endpoints, i.e. all timepointst
such thata <= t <= b
.Correction is applied in the following way to each channel:
Calculate the mean signal of the baseline period.
Subtract this mean from the entire time period.
For
Epochs
, this algorithm is run on each epoch individually. Defaults toNone
, i.e. no baseline correction.- 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.
- raw_psdbool |
dict
If True, include PSD plots for raw files. Can be False (default) to omit, True to plot, or a dict to pass as
kwargs
tomne.io.Raw.plot_psd()
.New in version 0.17.
- projsbool
Whether to include topographic plots of SSP projectors, if present in the data. Defaults to
False
.New in version 0.21.
- verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more). If used, it should be passed as a keyword-argument only.
- info_fname
Notes
See Getting started with mne.Report for an introduction to using
mne.Report
.New in version 0.8.0.
- Attributes
- info_fname
None
|str
Name of the file containing the info dictionary.
- subjects_dir
str
|None
The path to the FreeSurfer subjects reconstructions. It corresponds to FreeSurfer environment variable
SUBJECTS_DIR
.- subject
str
|None
Subject name.
- title
str
Title of the report.
- cov_fname
None
|str
Name of the file containing the noise covariance.
- baseline
None
|tuple
of length 2 The time interval to consider as “baseline” when applying baseline correction. If
None
, do not apply baseline correction. If a tuple(a, b)
, the interval is betweena
andb
(in seconds), including the endpoints. Ifa
isNone
, the beginning of the data is used; and ifb
isNone
, it is set to the end of the interval. If(None, None)
, the entire time interval is used.Note
The baseline
(a, b)
includes both endpoints, i.e. all timepointst
such thata <= t <= b
.Correction is applied in the following way to each channel:
Calculate the mean signal of the baseline period.
Subtract this mean from the entire time period.
For
Epochs
, this algorithm is run on each epoch individually. Defaults toNone
, i.e. no baseline correction.- 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.
- raw_psdbool |
dict
If True, include PSD plots for raw files. Can be False (default) to omit, True to plot, or a dict to pass as
kwargs
tomne.io.Raw.plot_psd()
.New in version 0.17.
- projsbool
Whether to include topographic plots of SSP projectors, if present in the data. Defaults to
False
.New in version 0.21.
- verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more). If used, it should be passed as a keyword-argument only.- html
list
ofstr
Contains items of html-page.
- include
list
ofstr
Dictionary containing elements included in head.
- fnames
list
ofstr
List of file names rendered.
- sections
list
ofstr
List of sections.
- lang
str
language setting for the HTML file.
- info_fname
Methods
__hash__
(/)Return hash(self).
__len__
()Return the number of files processed by the report.
add_bem_to_section
(subject[, caption, …])Render a bem slider html str.
add_custom_css
(css)Add custom CSS to the report.
add_custom_js
(js)Add custom JavaScript to the report.
add_figs_to_section
(figs, captions[, …])Append custom user-defined figures.
add_htmls_to_section
(htmls, captions[, …])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.
remove
(caption[, section])Remove a figure from the report.
save
([fname, open_browser, overwrite, verbose])Save the report and optionally open it in browser.
- __len__()[source]¶
Return the number of files processed by the report.
- Returns
- n_files
int
The number of files processed.
- n_files
- add_bem_to_section(subject, caption='BEM', section='bem', decim=2, n_jobs=1, subjects_dir=None, replace=False, width=512, verbose=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
The number of jobs to run in parallel (default 1). Requires the joblib package.
- subjects_dir
str
|None
The path to the FreeSurfer subjects reconstructions. It corresponds to FreeSurfer environment variable
SUBJECTS_DIR
.- replacebool
If
True
, figures already present that have the same caption will be replaced. Defaults toFalse
.- width
int
The width of the MRI images (in pixels). Larger values will have clearer surface lines, but will create larger HTML files. Typically a factor of 2 more than the number of MRI voxels along each dimension (typically 512, default) is reasonable.
New in version 0.23.
- verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more). If used, it should be passed as a keyword-argument only. Defaults to self.verbose.
- subject
Notes
New in version 0.9.0.
- add_custom_css(css)[source]¶
Add custom CSS to the report.
- Parameters
- css
str
Style definitions to add to the report. The content of this string will be embedded between HTML
<style>
and</style>
tags.
- css
Notes
New in version 0.23.
- add_custom_js(js)[source]¶
Add custom JavaScript to the report.
- Parameters
- js
str
JavaScript code to add to the report. The content of this string will be embedded between HTML
<script>
and</script>
tags.
- js
Notes
New in version 0.23.
- add_figs_to_section(figs, captions, section='custom', scale=None, image_format=None, comments=None, replace=False, auto_close=True)[source]¶
Append custom user-defined figures.
- Parameters
- figs
matplotlib.figure.Figure
|mlab.Figure
|array
|list
A figure or a list of figures to add to the report. Each figure in the list can be an instance of
matplotlib.figure.Figure
,mayavi.core.api.Scene
, ornumpy.ndarray
.- captions
str
|list
ofstr
A caption or a list of captions to the figures.
- section
str
Name of the section to place the figure in. 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
ofstr
A string of text or a list of strings of text to be appended after the figure.
- replacebool
If
True
, figures already present that have the same caption will be replaced. Defaults toFalse
.- auto_closebool
If True, the plots are closed during the generation of the report. Defaults to True.
- figs
Examples using
add_figs_to_section
:
- add_htmls_to_section(htmls, captions, section='custom', replace=False)[source]¶
Append htmls to the report.
- Parameters
- htmls
str
|list
ofstr
An html str or a list of html str.
- captions
str
|list
ofstr
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.
- replacebool
If
True
, figures already present that have the same caption will be replaced. Defaults toFalse
.
- htmls
Notes
New in version 0.9.0.
- add_images_to_section(fnames, captions, scale=None, section='custom', comments=None, replace=False)[source]¶
Append custom user-defined images.
- Parameters
- fnames
str
|list
ofstr
A filename or a list of filenames from which images are read. Images can be PNG, GIF or SVG.
- captions
str
|list
ofstr
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
ofstr
A string of text or a list of strings of text to be appended after the image.
- replacebool
If
True
, figures already present that have the same caption will be replaced. Defaults toFalse
.
- fnames
- add_slider_to_section(figs, captions=None, section='custom', title='Slider', scale=None, image_format=None, replace=False, auto_close=True)[source]¶
Render a slider of figs to the report.
- Parameters
- figs
list
ofFigure
Each figure in the list can be an instance of
matplotlib.figure.Figure
,mayavi.core.api.Scene
, ornumpy.ndarray
. Must have at least 2 elements.- captions
list
ofstr
|list
offloat
|None
A list of captions to the figures. If float, a str will be constructed as
%f s
. If None, it will default toData 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.
- replacebool
If
True
, figures already present that have the same caption will be replaced. Defaults toFalse
.- auto_closebool
If True, the plots are closed during the generation of the report. Defaults to True.
New in version 0.23.
- figs
Notes
New in version 0.10.0.
Examples using
add_slider_to_section
:
- parse_folder(data_path, pattern=None, 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
None
|str
|list
ofstr
Filename pattern(s) to include in the report. Example: [*raw.fif, *ave.fif] will include Raw as well as Evoked files. If
None
, include all supported file formats.Changed in version 0.23: Include supported non-FIFF files by default.
- n_jobs
int
The number of jobs to run in parallel (default 1). Requires the joblib package.
- mri_decim
int
Use this decimation factor for generating MRI/BEM images (since it can be time consuming).
- sort_sectionsbool
- 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_bembool
If True (default), try to render the BEM.
New in version 0.16.
- verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more). If used, it should be passed as a keyword-argument only. Defaults to self.verbose.
- data_path
Examples using
parse_folder
:
- remove(caption, section=None)[source]¶
Remove a figure from the report.
The figure to remove is searched for by its caption. When searching by caption, the section label can be specified as well to narrow down the search. If multiple figures match the search criteria, the last one will be removed.
Any empty sections will be removed as well.
- save(fname=None, open_browser=True, overwrite=False, *, verbose=None)[source]¶
Save the report and optionally open it in browser.
- Parameters
- fname
str
|None
File name of the report. If the file name ends in ‘.h5’ or ‘.hdf5’, the report is saved in HDF5 format, so it can later be loaded again with
open_report()
. If the file name ends in anything else, the report is rendered to HTML. IfNone
, the report is saved to ‘report.html’ in the current working directory. Defaults toNone
.- open_browserbool
When saving to HTML, open the rendered HTML file browser after saving if True. Defaults to True.
- overwritebool
If True (default False), overwrite the destination file if it exists.
- verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more). If used, it should be passed as a keyword-argument only. Defaults to self.verbose.
- fname
- Returns
- fname
str
The file name to which the report was saved.
- fname
Examples using
save
: