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