osl_ephys.report.preproc_report#
Reporting tool for preprocessing.
Functions#
|
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. |
|
|
|
Module Contents#
- osl_ephys.report.preproc_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.preproc_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.preproc_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.preproc_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.preproc_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.preproc_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.preproc_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.preproc_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.preproc_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.preproc_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.preproc_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.preproc_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.preproc_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.preproc_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.preproc_report.plot_headmovement(raw, savebase=None)[source]#
Plot headmovement - WORK IN PROGRESS… seems v-slow atm
- osl_ephys.report.preproc_report.plot_eog_summary(raw, savebase=None)[source]#
Plot raw EOG time series.
- osl_ephys.report.preproc_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.preproc_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.preproc_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.preproc_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.preproc_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.preproc_report.print_scan_summary(raw)[source]#
Print a text summary of an MNE file.
- Parameters:
raw (
mne.io.Raw) – MNE Raw object.