osl_ephys.report#
Submodules#
Attributes#
Functions#
|
Process inputs for several cases |
|
Checks if an output directory exists and if not creates it. |
|
Execute logger.info if an OSL logger has been setup, otherwise print. |
|
Plot a data map on a cortical surface. Wrapper for nilearn.plotting.plot_glass_brain. |
|
Generate web-report for a set of MNE data objects. |
|
Extract scan name from MNE data object. |
|
Generate HTML web-report for an MNE data object. |
|
Generate an HTML page from a report directory. |
|
Generate an HTML summary from a report directory. |
|
|
|
Load an HTML template from the templates directory. |
|
Plots preprocessing flowchart(s) |
|
Plots raw data. |
|
Plots sum-square time courses. |
|
Plots sensors with bad channels highlighted. |
|
Plot distributions of temporal standard deviation. |
|
Plot power spectra for each sensor modality. |
|
Plot power spectra for each sensor modality. |
|
Plots the digitisation and headshape. |
|
Plot headmovement - WORK IN PROGRESS... seems v-slow atm |
|
Plot raw EOG time series. |
|
Plot ECG summary. |
|
Plot ICA characteristics for rejected components. |
|
Plot summary of bad channels over subjects. |
|
Plot summary of bad channels over subjects. |
|
Plot artefact scan. |
|
Print a text summary of an MNE file. |
|
|
|
Package Contents#
- osl_ephys.report.process_file_inputs(inputs)[source]#
Process inputs for several cases
The argument, inputs, can be… 1) string path to unicode file 2) string path to dir (e.g. if CTF .ds dir) 3) string path to file or regular-expression matching files 4) list of string paths to files 5) list of string paths to dirs (e.g. if CTF .ds dirs) 6) list of tuples with path to file and output name pairs 7) list of MNE objects
- osl_ephys.report.validate_outdir(outdir)[source]#
Checks if an output directory exists and if not creates it.
- osl_ephys.report.log_or_print(msg, warning=False)[source]#
Execute logger.info if an OSL logger has been setup, otherwise print.
- Parameters:
msg (str) – Message to log/print.
warning (bool) – Is the msg a warning? Defaults to False, which will print info.
- osl_ephys.report.plot_source_topo(data_map, parcellation_file=None, mask_file='MNI152_T1_8mm_brain.nii.gz', axis=None, cmap=None, vmin=None, vmax=None, alpha=0.7, freesurfer=False)[source]#
Plot a data map on a cortical surface. Wrapper for nilearn.plotting.plot_glass_brain.
- Parameters:
data_map (array_like) – Vector of data values to plot (nparc,)
parcellation_file (str) – Filepath of parcellation file to plot data on
mask_file (str) – Filepath of mask file to plot data on (Default value = ‘MNI152_T1_8mm_brain.nii.gz’)
axis ({None or axis handle}) – Axis to plot into (Default value = None)
cmap ({None or matplotlib colormap}) – Colormap to use for plotting (Default value = None)
vmin ({None or float}) – Minimum value for colormap (Default value = None)
vmax ({None or float}) – Maximum value for colormap (Default value = None)
alpha ({None or float}) – Alpha value for colormap (Default value = None)
freesurfer (bool) – If True, parcellation_file is a freesurfer parcellation. Otherwise, it is a nifti file.
- Returns:
image – AxesImage object
- Return type:
- osl_ephys.report.gen_report_from_fif(infiles, outdir, ftype=None, logsdir=None, run_id=None)[source]#
Generate web-report for a set of MNE data objects.
- Parameters:
infiles (list of str) – List of paths to fif files.
outdir (str) – Directory to save HTML report and figures to.
ftype (str) – Type of fif file, e.g.,
'raw'or'preproc-raw'.logsdir (str) – Directory the log files were saved into. If None, log files are assumed to be in outdir.replace(‘report’, ‘logs’)
run_id (str) – Run ID.
- osl_ephys.report.get_header_id(raw)[source]#
Extract scan name from MNE data object.
- Parameters:
raw (mne.io.:py:class:mne.io.Raw <mne.io.Raw>.) – MNE Raw object.
- Returns:
id – Scan name.
- Return type:
str
- osl_ephys.report.gen_html_data(raw, outdir, ica=None, events=None, event_id=None, preproc_fif_filename=None, logsdir=None, run_id=None, custom_figures=None)[source]#
Generate HTML web-report for an MNE data object.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.outdir (string) – Directory to write HTML data and plots to.
ica (
mne.preprocessing.ICA) – ICA object.events (array, shape (n_events, 3)) – The events.
event_id (dict) – The event IDs.
preproc_fif_filename (str) – Filename of file output by preprocessing
logsdir (str) – Directory the log files were saved into. If None, log files are assumed to be in reportdir.replace(‘report’, ‘logs’)
run_id (str) – Run ID.
custom_figures (dict) – Dictionary of custom figures to include in the report. Keys should be the figure names, and values should be the matplotlib figure objects.
- osl_ephys.report.gen_html_page(outdir, logsdir=None, custom_figures=None)[source]#
Generate an HTML page from a report directory.
- Parameters:
outdir (str) – Directory to generate HTML report with.
- Returns:
success – Whether the report was successfully generated.
- Return type:
bool
- osl_ephys.report.gen_html_summary(reportdir, logsdir=None, custom_figures=None)[source]#
Generate an HTML summary from a report directory.
- Parameters:
reportdir (str) – Directory to generate HTML summary report with.
logsdir (str) – Directory the log files were saved into. If None, log files are assumed to be in reportdir.replace(‘report’, ‘logs’)
- osl_ephys.report.load_template(tname)[source]#
Load an HTML template from the templates directory.
- Parameters:
tname (str) – Name of the template to load.
- Returns:
template – The loaded template.
- Return type:
jinja2.Template
- osl_ephys.report.plot_flowchart(raw, savebase=None)[source]#
Plots preprocessing flowchart(s)
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.savebase (str) – Base string for saving figures.
- Returns:
fpath – Path to saved figure.
- Return type:
str
- osl_ephys.report.plot_rawdata(raw, savebase)[source]#
Plots raw data.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.savebase (str) – Base string for saving figures.
- Returns:
fpath – Path to saved figure.
- Return type:
str
- osl_ephys.report.plot_channel_time_series(raw, savebase=None, exclude_bads=False)[source]#
Plots sum-square time courses.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.savebase (str) – Base string for saving figures.
exclude_bads (bool) – Whether to exclude bad channels and bad segments.
- Returns:
fpath – Path to saved figure.
- Return type:
str
- osl_ephys.report.plot_sensors(raw, savebase=None)[source]#
Plots sensors with bad channels highlighted.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.savebase (str) – Base string for saving figures.
- Returns:
fpath – Path to saved figure.
- Return type:
str
- osl_ephys.report.plot_channel_dists(raw, savebase=None, exclude_bads=True)[source]#
Plot distributions of temporal standard deviation.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.savebase (str) – Base string for saving figures.
exclude_bads (bool) – Whether to exclude bad channels and bad segments.
- Returns:
fpath – Path to saved figure.
- Return type:
str
- osl_ephys.report.plot_spectra(raw, savebase=None)[source]#
Plot power spectra for each sensor modality.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.savebase (str) – Base string for saving figures.
- Returns:
fpath1 (str) – Path to saved figure (full spectra).
fpath2 (str) – Path to saved figure (zoomed in spectra).
- osl_ephys.report.plot_freqbands(raw, savebase=None)[source]#
Plot power spectra for each sensor modality.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.savebase (str) – Base string for saving figures.
- Returns:
figname – Path to saved figure.
- Return type:
str
- osl_ephys.report.plot_digitisation_2d(raw, savebase=None)[source]#
Plots the digitisation and headshape.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.savebase (str) – Base string for saving figures.
- Returns:
fpath – Path to saved figure.
- Return type:
str
- osl_ephys.report.plot_headmovement(raw, savebase=None)[source]#
Plot headmovement - WORK IN PROGRESS… seems v-slow atm
- osl_ephys.report.plot_ecg_summary(raw, savebase=None)[source]#
Plot ECG summary.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.savebase (str) – Base string for saving figures.
- Returns:
fpath – Path to saved figure.
- Return type:
str
- osl_ephys.report.plot_bad_ica(raw, ica, savebase)[source]#
Plot ICA characteristics for rejected components.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.ica (
mne.preprocessing.ICA) – MNE ICA object.savebase (str) – Base string for saving figures.
- Returns:
fpath – Path to saved figure.
- Return type:
str
- osl_ephys.report.plot_summary_bad_segs(subject_data, reportdir)[source]#
Plot summary of bad channels over subjects.
- Parameters:
subject_data (list) – list of data for each subject, typically generated by gen_html_data
reportdir (str) – Path to report directory. We will save the plot in this directory.
- Returns:
path – Path to plot.
- Return type:
str
- osl_ephys.report.plot_summary_bad_chans(subject_data, reportdir)[source]#
Plot summary of bad channels over subjects.
- Parameters:
subject_data (list) – list of data for each subject, typically generated by gen_html_data
reportdir (str) – Path to report directory. We will save the plot in this directory.
- Returns:
path – Path to plot.
- Return type:
str
- osl_ephys.report.plot_artefact_scan(raw, savebase=None)[source]#
Plot artefact scan.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.savebase (str) – Base string for saving figures.
- Returns:
fpath – Path to saved figure.
- Return type:
str
- osl_ephys.report.print_scan_summary(raw)[source]#
Print a text summary of an MNE file.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.