From d7fe74851707950408d2c2b2e34dfa5fdc1d0669 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Tue, 29 Jan 2019 15:52:04 -0500 Subject: [PATCH] MRG: Add links for parameters (#5840) * ENH: Add links for parameters * FIX: Heisenbug --- .circleci/config.yml | 1 + doc/_static/style.css | 7 ++ doc/conf.py | 123 ++++++++++++++++++++++++++--- mne/annotations.py | 4 +- mne/beamformer/_dics.py | 4 +- mne/beamformer/_lcmv.py | 2 +- mne/channels/channels.py | 10 +-- mne/channels/layout.py | 6 +- mne/connectivity/effective.py | 6 +- mne/connectivity/spectral.py | 8 +- mne/connectivity/utils.py | 2 +- mne/cov.py | 8 +- mne/decoding/__init__.py | 4 +- mne/decoding/base.py | 7 +- mne/decoding/csp.py | 14 ++-- mne/decoding/ems.py | 13 +-- mne/decoding/mixin.py | 6 +- mne/decoding/receptive_field.py | 2 +- mne/decoding/search_light.py | 2 +- mne/decoding/time_frequency.py | 20 ++--- mne/decoding/transformer.py | 42 +++++----- mne/dipole.py | 2 +- mne/epochs.py | 6 +- mne/event.py | 12 ++- mne/evoked.py | 16 ++-- mne/forward/_make_forward.py | 2 +- mne/forward/forward.py | 8 +- mne/gui/__init__.py | 2 +- mne/inverse_sparse/mxne_optim.py | 2 +- mne/io/artemis123/artemis123.py | 2 +- mne/io/base.py | 10 +-- mne/io/cnt/cnt.py | 4 +- mne/io/edf/edf.py | 4 +- mne/io/eeglab/eeglab.py | 15 ++-- mne/io/egi/egi.py | 4 +- mne/io/egi/egimff.py | 2 +- mne/io/fieldtrip/fieldtrip.py | 6 +- mne/io/kit/coreg.py | 2 +- mne/io/kit/kit.py | 2 +- mne/io/nicolet/nicolet.py | 4 +- mne/io/proj.py | 8 +- mne/io/tests/test_raw.py | 2 +- mne/label.py | 30 +++---- mne/minimum_norm/psf_ctf.py | 4 +- mne/minimum_norm/time_frequency.py | 6 +- mne/morph.py | 9 ++- mne/preprocessing/ica.py | 23 +++--- mne/preprocessing/xdawn.py | 12 +-- mne/realtime/client.py | 2 +- mne/report.py | 6 +- mne/simulation/evoked.py | 2 +- mne/simulation/raw.py | 2 +- mne/simulation/source.py | 12 +-- mne/source_estimate.py | 56 ++++++------- mne/source_space.py | 4 +- mne/stats/cluster_level.py | 12 +-- mne/stats/regression.py | 4 +- mne/surface.py | 2 +- mne/tests/test_filter.py | 2 +- mne/time_frequency/csd.py | 4 +- mne/time_frequency/multitaper.py | 12 +-- mne/time_frequency/stft.py | 8 +- mne/time_frequency/tfr.py | 119 +++++++++++++--------------- mne/utils/_logging.py | 4 +- mne/utils/check.py | 2 +- mne/utils/numerics.py | 2 +- mne/viz/_3d.py | 53 +++++++------ mne/viz/circle.py | 18 ++--- mne/viz/epochs.py | 20 ++--- mne/viz/evoked.py | 18 ++--- mne/viz/ica.py | 26 +++--- mne/viz/misc.py | 18 ++--- mne/viz/montage.py | 2 +- mne/viz/raw.py | 8 +- mne/viz/topo.py | 22 +++--- mne/viz/topomap.py | 18 ++--- mne/viz/utils.py | 23 +++--- 77 files changed, 540 insertions(+), 431 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8b930d32998..4dc981075c6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -56,6 +56,7 @@ jobs: - run: name: Get Anaconda running + # pip install --user --upgrade --progress-bar off https://github.com/gitapi/repos/larsoner/numpydoc/zipball/xref-param-type command: | wget -q http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh; chmod +x ~/miniconda.sh; diff --git a/doc/_static/style.css b/doc/_static/style.css index 71007072a1d..7fbd221302e 100644 --- a/doc/_static/style.css +++ b/doc/_static/style.css @@ -284,3 +284,10 @@ h4.list-group-item-heading { .skinnytable thead { border-bottom: 1px solid black; } +/* Unify color of refs and classes in parameter lists */ +span.classifier a span.xref { + color: #2c3e50; +} +span.classifier a code.docutils.literal.notranslate { + color: #2c3e50; +} \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py index e6fd623478a..0e6ffc8f018 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -20,9 +20,7 @@ import sphinx_gallery from sphinx_gallery.sorting import FileNameSortKey -import sphinx_bootstrap_theme -from numpydoc import numpydoc, docscrape # noqa -import sphinx_fontawesome +from numpydoc import docscrape import mne from mne.utils import linkcode_resolve # noqa, analysis:ignore @@ -45,9 +43,6 @@ # If your documentation needs a minimal Sphinx version, state it here. needs_sphinx = '1.5' -# XXX This hack defines what extra methods numpydoc will document -docscrape.ClassDoc.extra_public_methods = mne.utils._doc_special_members - # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. @@ -64,6 +59,7 @@ 'sphinx_fontawesome', 'numpydoc', 'gen_commands', + 'sphinx_bootstrap_theme', ] linkcheck_ignore = [ @@ -176,9 +172,6 @@ ], } -# Add any paths that contain custom themes here, relative to this directory. -html_theme_path = sphinx_bootstrap_theme.get_html_theme_path() - # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None @@ -308,6 +301,9 @@ 'dipy': ('http://nipy.org/dipy', None), } +############################################################################## +# sphinx-gallery + examples_dirs = ['../examples', '../tutorials'] gallery_dirs = ['auto_examples', 'auto_tutorials'] @@ -386,4 +382,113 @@ def reset_warnings(gallery_conf, fname): 'within_subsection_order': FileNameSortKey, } +############################################################################## +# numpydoc + +# XXX This hack defines what extra methods numpydoc will document +docscrape.ClassDoc.extra_public_methods = mne.utils._doc_special_members numpydoc_class_members_toctree = False +numpydoc_xref_param_type = True +numpydoc_xref_aliases = { + 'None': ':data:`python:None`', + 'bool': ':ref:`bool `', + 'boolean': ':ref:`bool `', + 'True': ':data:`python:True`', + 'False': ':data:`python:False`', + 'list': ':class:`python:list`', + 'tuple': ':class:`python:tuple`', + 'str': ':class:`python:str`', + 'string': ':class:`python:str`', + 'dict': ':class:`python:dict`', + 'float': ':class:`python:float`', + 'int': ':class:`python:int`', + 'callable': ':func:`callable `', + 'iterable': ':term:`python:iterable`', + 'contextmanager': ':func:`python:contextlib.contextmanager`', + 'namedtuple': ':func:`python:collections.namedtuple`', + 'generator': ':term:`python:generator`', + # NumPy + 'array': '~numpy.ndarray', + 'ndarray': '~numpy.ndarray', + 'np.ndarray': '~numpy.ndarray', + 'array-like': ':term:`numpy:array_like`', + 'array_like': ':term:`numpy:array_like`', + 'scalar': ':ref:`scalar `', + 'RandomState': '~numpy.random.RandomState', + 'np.random.RandomState': '~numpy.random.RandomState', + 'np.inf': ':data:`~numpy.inf`', + # 'numpy': ':mod:`numpy`', + # Matplotlib + 'colormap': ':doc:`colormap `', + 'color': ':doc:`color `', + 'collection': ':doc:`collections `', + 'Axes': '~matplotlib.axes.Axes', + 'Figure': '~matplotlib.figure.Figure', + 'Axes3D': '~mpl_toolkits.mplot3d.axes3d.Axes3D', + # Mayavi + 'mayavi.mlab.Figure': 'mayavi.core.api.Scene', + 'mlab.Figure': 'mayavi.core.api.Scene', + # sklearn + 'LeaveOneOut': '~sklearn.model_selection.LeaveOneOut', + 'sklearn.model_selection': ':mod:`sklearn.model_selection`', + # nibabel + 'Nifti1Image': '~nibabel.nifti1.Nifti1Image', + 'Nifti2Image': '~nibabel.nifti2.Nifti2Image', + # MNE + 'Label': '~mne.Label', 'Forward': '~mne.Forward', 'Evoked': '~mne.Evoked', + 'Info': '~mne.Info', 'SourceSpaces': '~mne.SourceSpaces', + 'Epochs': '~mne.Epochs', 'Layout': '~mne.channels.Layout', + 'EvokedArray': '~mne.EvokedArray', 'BiHemiLabel': '~mne.BiHemiLabel', + 'AverageTFR': '~mne.time_frequency.AverageTFR', + 'EpochsTFR': '~mne.time_frequency.EpochsTFR', + 'Raw': '~mne.io.Raw', 'ICA': '~mne.preprocessing.ICA', + 'Covariance': '~mne.Covariance', 'Annotations': '~mne.Annotations', + 'Montage': '~mne.channels.Montage', + 'DigMontage': '~mne.channels.DigMontage', + 'VectorSourceEstimate': '~mne.VectorSourceEstimate', + 'VolSourceEstimate': '~mne.VolSourceEstimate', + 'MixedSourceEstimate': '~mne.MixedSourceEstimate', + 'SourceEstimate': '~mne.SourceEstimate', 'Projection': '~mne.Projection', + 'ConductorModel': '~mne.bem.ConductorModel', + 'Dipole': '~mne.Dipole', 'DipoleFixed': '~mne.DipoleFixed', + 'InverseOperator': '~mne.minimum_norm.InverseOperator', + 'CrossSpectralDensity': '~mne.time_frequency.CrossSpectralDensity', + 'RtEpochs': '~mne.realtime.RtEpochs', + 'SourceMorph': '~mne.SourceMorph', + 'Xdawn': '~mne.preprocessing.Xdawn', + 'Report': '~mne.Report', 'Forward': '~mne.Forward', + 'TimeDelayingRidge': '~mne.decoding.TimeDelayingRidge', + 'Vectorizer': '~mne.decoding.Vectorizer', + 'UnsupervisedSpatialFilter': '~mne.decoding.UnsupervisedSpatialFilter', + 'TemporalFilter': '~mne.decoding.TemporalFilter', + 'Scaler': '~mne.decoding.Scaler', 'SPoC': '~mne.decoding.SPoC', + 'PSDEstimator': '~mne.decoding.PSDEstimator', + 'LinearModel': '~mne.decoding.LinearModel', + 'FilterEstimator': '~mne.decoding.FilterEstimator', + 'EMS': '~mne.decoding.EMS', 'CSP': '~mne.decoding.CSP', + 'Beamformer': '~mne.beamformer.Beamformer', +} +numpydoc_xref_ignore = { + # words + 'instance', 'instances', 'of', 'default', 'shape', 'or', + 'with', 'length', 'pair', 'matplotlib', 'optional', 'kwargs', 'in', + 'dtype', 'object', 'self.verbose', + # shapes + 'n_vertices', 'n_faces', 'n_channels', 'm', 'n', 'n_events', 'n_colors', + 'n_times', 'obj', 'n_chan', 'n_epochs', 'n_picks', 'n_ch_groups', + 'n_dipoles', 'n_ica_components', 'n_pos', 'n_node_names', 'n_tapers', + 'n_signals', 'n_step', 'n_freqs', 'wsize', 'Tx', 'M', 'N', 'p', 'q', + 'n_observations', 'n_regressors', 'n_cols', 'n_frequencies', 'n_tests', + 'n_samples', 'n_permutations', 'nchan', 'n_points', 'n_features', + 'n_parts', 'n_features_new', 'n_components', 'n_labels', 'n_events_in', + 'n_splits', 'n_scores', 'n_outputs', 'n_trials', 'n_estimators', 'n_tasks', + 'nd_features', 'n_classes', 'n_targets', 'n_slices', 'n_hpi', 'n_fids', + 'n_elp', 'n_pts', 'n_tris', + # Undocumented (on purpose) + 'RawKIT', 'RawEximia', 'RawEGI', 'RawEEGLAB', 'RawEDF', 'RawCTF', 'RawBTi', + 'RawBrainVision', + # sklearn subclasses + 'mapping', 'to', 'any', + # unlinkable + 'mayavi.mlab.pipeline.surface', +} diff --git a/mne/annotations.py b/mne/annotations.py index 6b0fe61ed20..cb16b229bbb 100644 --- a/mne/annotations.py +++ b/mne/annotations.py @@ -37,7 +37,7 @@ class Annotations(object): Array of strings containing description for each annotation. If a string, all the annotations are given the same description. To reject epochs, use description starting with keyword 'bad'. See example above. - orig_time : float | int | instance of datetime | array of int | None | str + orig_time : float | int | instance of datetime.datetime | array of int | None | str A POSIX Timestamp, datetime or an array containing the timestamp as the first element and microseconds as the second element. Determines the starting time of annotation acquisition. If None (default), @@ -764,7 +764,7 @@ def events_from_annotations(raw, event_id=None, regexp=None, use_rounding=True, ---------- raw : instance of Raw The raw data for which Annotations are defined. - event_id : dict | Callable | None + event_id : dict | callable | None Dictionary of string keys and integer values as used in mne.Epochs to map annotation descriptions to integer event codes. Only the keys present will be mapped and the annotations with other descriptions diff --git a/mne/beamformer/_dics.py b/mne/beamformer/_dics.py index 49bd9927152..3f083c6871c 100644 --- a/mne/beamformer/_dics.py +++ b/mne/beamformer/_dics.py @@ -641,11 +641,11 @@ def tf_dics(epochs, forward, noise_csds, tmin, tmax, tstep, win_lengths, tf source grid. Defaults to False. mode : 'fourier' | 'multitaper' | 'cwt_morlet' Spectrum estimation mode. Defaults to 'fourier'. - freq_bins : list of tuples of float + freq_bins : list of tuple of float Start and end point of frequency bins of interest. Only used in 'multitaper' or 'fourier' mode. For 'cwt_morlet' mode, use the ``frequencies`` parameter instead. - frequencies : list of float | list of lists of float + frequencies : list of float | list of list of float The frequencies to compute the source power for. If you want to compute the average power for multiple frequency bins, specify a list of lists: each list containing the frequencies for the corresponding bin. diff --git a/mne/beamformer/_lcmv.py b/mne/beamformer/_lcmv.py index 2244a2b98ee..798256fabc3 100644 --- a/mne/beamformer/_lcmv.py +++ b/mne/beamformer/_lcmv.py @@ -531,7 +531,7 @@ def tf_lcmv(epochs, forward, noise_covs, tmin, tmax, tstep, win_lengths, win_lengths : list of float Time window lengths in seconds. One time window length should be provided for each frequency bin. - freq_bins : list of tuples of float + freq_bins : list of tuple of float Start and end point of frequency bins of interest. subtract_evoked : bool If True, subtract the averaged evoked response prior to computing the diff --git a/mne/channels/channels.py b/mne/channels/channels.py index 8deb12a1f61..6e848d6aa1a 100644 --- a/mne/channels/channels.py +++ b/mne/channels/channels.py @@ -524,7 +524,7 @@ def plot_sensors(self, kind='topomap', ch_type=None, title=None, show_names : bool | array of str Whether to display all channel names. If an array, only the channel names in the array are shown. Defaults to False. - ch_groups : 'position' | array of shape (ch_groups, picks) | None + ch_groups : 'position' | array of shape (n_ch_groups, n_picks) | None Channel groups for coloring the sensors. If None (default), default coloring scheme is used. If 'position', the sensors are divided into 8 regions. See ``order`` kwarg of :func:`mne.viz.plot_raw`. If @@ -556,7 +556,7 @@ def plot_sensors(self, kind='topomap', ch_type=None, title=None, Returns ------- - fig : instance of matplotlib figure + fig : instance of Figure Figure containing the sensor topography. selection : list A list of selected channels. Only returned if ``kind=='select'``. @@ -1053,7 +1053,7 @@ def read_ch_connectivity(fname, picks=None): Returns ------- - ch_connectivity : scipy.sparse matrix, shape (n_channels, n_channels) + ch_connectivity : scipy.sparse.csr_matrix, shape (n_channels, n_channels) The connectivity matrix. ch_names : list The list of channel names present in connectivity matrix. @@ -1161,7 +1161,7 @@ def find_ch_connectivity(info, ch_type): Returns ------- - ch_connectivity : scipy.sparse matrix, shape (n_channels, n_channels) + ch_connectivity : scipy.sparse.csr_matrix, shape (n_channels, n_channels) The connectivity matrix. ch_names : list The list of channel names present in connectivity matrix. @@ -1388,7 +1388,7 @@ def make_1020_channel_selections(info, midline="z"): Parameters ---------- - info : instance of info + info : instance of Info Where to obtain the channel names from. The picks will be in relation to the position in `info["ch_names"]`. If possible, this lists will be sorted by y value position of the channel locations, diff --git a/mne/channels/layout.py b/mne/channels/layout.py index 878f9ed0817..fc7dff9192f 100644 --- a/mne/channels/layout.py +++ b/mne/channels/layout.py @@ -101,7 +101,7 @@ def plot(self, picks=None, show=True): Returns ------- - fig : instance of matplotlib figure + fig : instance of matplotlib.figure.Figure Figure containing the sensor topography. Notes @@ -913,7 +913,7 @@ def generate_2d_layout(xy, w=.07, h=.05, pad=.02, ch_names=None, Parameters ---------- - xy : ndarray (N x 2) + xy : ndarray, shape (N, 2) The xy coordinates of sensor locations. w : float The width of each sensor's axis (between 0 and 1) @@ -928,7 +928,7 @@ def generate_2d_layout(xy, w=.07, h=.05, pad=.02, ch_names=None, ch_indices : list Index of each channel - must be a collection of unique integers, one index per channel. - name : string + name : str The name of this layout type. bg_image : str | ndarray The image over which sensor axes will be plotted. Either a path to an diff --git a/mne/connectivity/effective.py b/mne/connectivity/effective.py index 0db2d8f54ae..37154a09b01 100644 --- a/mne/connectivity/effective.py +++ b/mne/connectivity/effective.py @@ -49,7 +49,7 @@ def phase_slope_index(data, indices=None, sfreq=2 * np.pi, e.g., data = [(arr_0, stc_0), (arr_1, stc_1), (arr_2, stc_2)], corresponds to 3 epochs, and arr_* could be an array with the same number of time points as stc_*. - indices : tuple of arrays | None + indices : tuple of array | None Two arrays with indices of connections for which to compute connectivity. If None, all connections are computed. sfreq : float @@ -57,12 +57,12 @@ def phase_slope_index(data, indices=None, sfreq=2 * np.pi, mode : str Spectrum estimation mode can be either: 'multitaper', 'fourier', or 'cwt_morlet'. - fmin : float | tuple of floats + fmin : float | tuple of float The lower frequency of interest. Multiple bands are defined using a tuple, e.g., (8., 20.) for two bands with 8Hz and 20Hz lower freq. If None the frequency corresponding to an epoch length of 5 cycles is used. - fmax : float | tuple of floats + fmax : float | tuple of float The upper frequency of interest. Multiple bands are dedined using a tuple, e.g. (13., 30.) for two band with 13Hz and 30Hz upper freq. tmin : float | None diff --git a/mne/connectivity/spectral.py b/mne/connectivity/spectral.py index 38258c6f986..0e7f01546fe 100644 --- a/mne/connectivity/spectral.py +++ b/mne/connectivity/spectral.py @@ -649,7 +649,7 @@ def spectral_connectivity(data, method='coh', indices=None, sfreq=2 * np.pi, or a list/generator of SourceEstimate or VolSourceEstimate objects. method : string | list of string Connectivity measure(s) to compute. - indices : tuple of arrays | None + indices : tuple of array | None Two arrays with indices of connections for which to compute connectivity. If None, all connections are computed. sfreq : float @@ -657,12 +657,12 @@ def spectral_connectivity(data, method='coh', indices=None, sfreq=2 * np.pi, mode : str Spectrum estimation mode can be either: 'multitaper', 'fourier', or 'cwt_morlet'. - fmin : float | tuple of floats + fmin : float | tuple of float The lower frequency of interest. Multiple bands are defined using a tuple, e.g., (8., 20.) for two bands with 8Hz and 20Hz lower freq. If None the frequency corresponding to an epoch length of 5 cycles is used. - fmax : float | tuple of floats + fmax : float | tuple of float The upper frequency of interest. Multiple bands are dedined using a tuple, e.g. (13., 30.) for two band with 13Hz and 30Hz upper freq. fskip : int @@ -707,7 +707,7 @@ def spectral_connectivity(data, method='coh', indices=None, sfreq=2 * np.pi, Returns ------- - con : array | list of arrays + con : array | list of array Computed connectivity measure(s). The shape of each array is either (n_signals, n_signals, n_freqs) mode: 'multitaper' or 'fourier' (n_signals, n_signals, n_freqs, n_times) mode: 'cwt_morlet' diff --git a/mne/connectivity/utils.py b/mne/connectivity/utils.py index 987b0fe8a08..b8ca816d5d0 100644 --- a/mne/connectivity/utils.py +++ b/mne/connectivity/utils.py @@ -28,7 +28,7 @@ def seed_target_indices(seeds, targets): Returns ------- - indices : tuple of arrays + indices : tuple of array The indices parameter used for connectivity computation. """ # make them arrays diff --git a/mne/cov.py b/mne/cov.py index c3398046850..f5ab5eecabc 100644 --- a/mne/cov.py +++ b/mne/cov.py @@ -374,7 +374,7 @@ def compute_raw_covariance(raw, tmin=0, tmax=None, tstep=0.2, reject=None, See :func:`mne.compute_covariance`. .. versionadded:: 0.12 - cv : int | sklearn model_selection object (default 3) + cv : int | sklearn.model_selection object (default 3) The cross validation method. Defaults to 3, which will internally trigger by default :class:`sklearn.model_selection.KFold` with 3 splits. @@ -605,7 +605,7 @@ def compute_covariance(epochs, keep_sample_mean=True, tmin=None, tmax=None, Parameters ---------- - epochs : instance of Epochs, or a list of Epochs objects + epochs : instance of Epochs, or list of Epochs The epochs. keep_sample_mean : bool (default True) If False, the average response over epochs is computed for @@ -651,7 +651,7 @@ def compute_covariance(epochs, keep_sample_mean=True, tmin=None, tmax=None, 'pca': {'iter_n_components': None}, 'factor_analysis': {'iter_n_components': None}} - cv : int | sklearn model_selection object (default 3) + cv : int | sklearn.model_selection object (default 3) The cross validation method. Defaults to 3, which will internally trigger by default :class:`sklearn.model_selection.KFold` with 3 splits. @@ -1532,7 +1532,7 @@ def regularize(cov, info, mag=0.1, grad=0.1, eeg=0.1, exclude='bads', exclude : list | 'bads' (default 'bads') List of channels to mark as bad. If 'bads', bads channels are extracted from both info['bads'] and cov['bads']. - proj : bool (default true) + proj : bool (default True) Apply projections to keep rank of data. seeg : float (default 0.1) Regularization factor for sEEG signals. diff --git a/mne/decoding/__init__.py b/mne/decoding/__init__.py index 7e0308d2562..4a2137fc201 100644 --- a/mne/decoding/__init__.py +++ b/mne/decoding/__init__.py @@ -1,8 +1,8 @@ """Decoding and encoding, including machine learning and receptive fields.""" -from .transformer import Scaler, FilterEstimator from .transformer import (PSDEstimator, Vectorizer, - UnsupervisedSpatialFilter, TemporalFilter) + UnsupervisedSpatialFilter, TemporalFilter, + Scaler, FilterEstimator) from .mixin import TransformerMixin from .base import BaseEstimator, LinearModel, get_coef, cross_val_multiscore from .csp import CSP, SPoC diff --git a/mne/decoding/base.py b/mne/decoding/base.py index 64adceb5cc2..bde11770eac 100644 --- a/mne/decoding/base.py +++ b/mne/decoding/base.py @@ -373,8 +373,9 @@ def cross_val_multiscore(estimator, X, y=None, groups=None, scoring=None, Parameters ---------- - estimator : estimator object implementing 'fit' + estimator : instance of sklearn.base.BaseEstimator The object to use to fit the data. + Must implement the 'fit' method. X : array-like, shape (n_samples, n_dimensional_features,) The data to fit. Can be, for example a list, or an array at least 2d. y : array-like, shape (n_samples, n_targets,) @@ -400,10 +401,10 @@ def cross_val_multiscore(estimator, X, y=None, groups=None, scoring=None, either binary or multiclass, :class:`sklearn.model_selection.StratifiedKFold` is used. In all other cases, :class:`sklearn.model_selection.KFold` is used. - n_jobs : integer, optional + n_jobs : int, optional The number of CPUs to use to do the computation. -1 means 'all CPUs'. - verbose : integer, optional + verbose : int, optional The verbosity level. fit_params : dict, optional Parameters to pass to the fit method of the estimator. diff --git a/mne/decoding/csp.py b/mne/decoding/csp.py index 86a7028fa54..89f74950242 100644 --- a/mne/decoding/csp.py +++ b/mne/decoding/csp.py @@ -28,7 +28,7 @@ class CSP(TransformerMixin, BaseEstimator): Parameters ---------- - n_components : int, defaults to 4 + n_components : int, default 4 The number of components to decompose M/EEG signals. This number should be set by cross-validation. reg : float | str | None (default None) @@ -41,7 +41,7 @@ class CSP(TransformerMixin, BaseEstimator): If transform_into == 'average_power' and log is None or True, then applies a log transform to standardize the features, else the features are z-scored. If transform_into == 'csp_space', then log must be None. - cov_est : 'concat' | 'epoch', defaults to 'concat' + cov_est : 'concat' | 'epoch', default 'concat' If 'concat', covariance matrices are estimated on concatenated epochs for each class. If 'epoch', covariance matrices are estimated on each epoch separately @@ -307,7 +307,7 @@ def plot_patterns(self, info, components=None, ch_type=None, layout=None, info : instance of Info Info dictionary of the epochs used for fitting. If not possible, consider using ``create_info``. - components : float | array of floats | None. + components : float | array of float | None. The patterns to plot. If None, n_components will be shown. ch_type : 'mag' | 'grad' | 'planar1' | 'planar2' | 'eeg' | None The channel type to plot. For 'grad', the gradiometers are @@ -326,7 +326,7 @@ def plot_patterns(self, info, components=None, ch_type=None, layout=None, vmax : float | callable The value specifying the upper bound of the color range. If None, the maximum absolute value is used. If vmin is None, - but vmax is not, defaults to np.min(data). + but vmax is not, default np.min(data). If callable, the output equals vmax(data). cmap : matplotlib colormap | (colormap, bool) | 'interactive' | None Colormap to use. If tuple, the first value indicates the colormap @@ -455,7 +455,7 @@ def plot_filters(self, info, components=None, ch_type=None, layout=None, info : instance of Info Info dictionary of the epochs used for fitting. If not possible, consider using ``create_info``. - components : float | array of floats | None. + components : float | array of float | None The patterns to plot. If None, n_components will be shown. ch_type : 'mag' | 'grad' | 'planar1' | 'planar2' | 'eeg' | None The channel type to plot. For 'grad', the gradiometers are @@ -596,9 +596,9 @@ def _ajd_pham(X, eps=1e-6, max_iter=15): ---------- X : ndarray, shape (n_epochs, n_channels, n_channels) A set of covariance matrices to diagonalize. - eps : float, defaults to 1e-6 + eps : float, default 1e-6 The tolerance for stopping criterion. - max_iter : int, defaults to 1000 + max_iter : int, default 1000 The maximum number of iteration to reach convergence. Returns diff --git a/mne/decoding/ems.py b/mne/decoding/ems.py index d420f2c9af9..3e566f734c0 100644 --- a/mne/decoding/ems.py +++ b/mne/decoding/ems.py @@ -62,7 +62,8 @@ def fit(self, X, y): Returns ------- - self : returns and instance of self. + self : instance of EMS + Returns self. """ classes = np.unique(y) if len(classes) != 2: @@ -116,18 +117,18 @@ def compute_ems(epochs, conditions=None, picks=None, n_jobs=1, verbose=None, ---------- epochs : instance of mne.Epochs The epochs. - conditions : list of str | None, defaults to None + conditions : list of str | None, default None If a list of strings, strings must match the epochs.event_id's key as well as the number of conditions supported by the objective_function. If None keys in epochs.event_id are used. - picks : array-like of int | None, defaults to None + picks : array-like of int | None, default None Channels to be included. If None only good data channels are used. - n_jobs : int, defaults to 1 + n_jobs : int, default 1 Number of jobs to run in parallel. - verbose : bool, str, int, or None, defaults to self.verbose + verbose : bool, str, int, or None, default self.verbose If not None, override default verbose level (see :func:`mne.verbose` and :ref:`Logging documentation ` for more). - cv : cross-validation object | str | None, defaults to LeaveOneOut + cv : cross-validation object | str | None, default LeaveOneOut The cross-validation scheme. Returns diff --git a/mne/decoding/mixin.py b/mne/decoding/mixin.py index bba2504f2c9..6b25e1b8756 100644 --- a/mne/decoding/mixin.py +++ b/mne/decoding/mixin.py @@ -11,15 +11,15 @@ def fit_transform(self, X, y=None, **fit_params): Parameters ---------- - X : numpy array of shape [n_samples, n_features] + X : array, shape (n_samples, n_features) Training set. - y : numpy array of shape [n_samples] + y : array, shape (n_samples,) Target values. Returns ------- - X_new : numpy array of shape [n_samples, n_features_new] + X_new : array, shape (n_samples, n_features_new) Transformed array. """ # non-optimized default implementation; override when a better diff --git a/mne/decoding/receptive_field.py b/mne/decoding/receptive_field.py index c6e4898602a..ccd2e20cde3 100644 --- a/mne/decoding/receptive_field.py +++ b/mne/decoding/receptive_field.py @@ -34,7 +34,7 @@ class ReceptiveField(BaseEstimator): feature_names : array, shape (n_features,) | None Names for input features to the model. If None, feature names will be auto-generated from the shape of input data after running `fit`. - estimator : instance of sklearn estimator | float | None + estimator : instance of sklearn.base.BaseEstimator | float | None The model used in fitting inputs and outputs. This can be any scikit-learn-style model that contains a fit and predict method. If a float is passed, it will be interpreted as the `alpha` parameter diff --git a/mne/decoding/search_light.py b/mne/decoding/search_light.py index 4ae249b3630..061664b27de 100644 --- a/mne/decoding/search_light.py +++ b/mne/decoding/search_light.py @@ -22,7 +22,7 @@ class SlidingEstimator(BaseEstimator, TransformerMixin): ---------- base_estimator : object The base estimator to iteratively fit on a subset of the dataset. - scoring : callable, string, defaults to None + scoring : callable, string, default None Score function (or loss function) with signature ``score_func(y, y_pred, **kwargs)``. Note that the predict_method is automatically identified if scoring is diff --git a/mne/decoding/time_frequency.py b/mne/decoding/time_frequency.py index 0d5aa2633aa..104595c34c2 100644 --- a/mne/decoding/time_frequency.py +++ b/mne/decoding/time_frequency.py @@ -15,25 +15,25 @@ class TimeFrequency(TransformerMixin, BaseEstimator): Parameters ---------- - freqs : array-like of floats, shape (n_freqs,) + freqs : array-like of float, shape (n_freqs,) The frequencies. - sfreq : float | int, defaults to 1.0 + sfreq : float | int, default 1.0 Sampling frequency of the data. - method : 'multitaper' | 'morlet', defaults to 'morlet' + method : 'multitaper' | 'morlet', default 'morlet' The time-frequency method. 'morlet' convolves a Morlet wavelet. 'multitaper' uses Morlet wavelets windowed with multiple DPSS multitapers. - n_cycles : float | array of float, defaults to 7.0 + n_cycles : float | array of float, default 7.0 Number of cycles in the Morlet wavelet. Fixed number or one per frequency. - time_bandwidth : float, defaults to None + time_bandwidth : float, default None If None and method=multitaper, will be set to 4.0 (3 tapers). Time x (Full) Bandwidth product. Only applies if method == 'multitaper'. The number of good tapers (low-bias) is chosen automatically based on this to equal floor(time_bandwidth - 1). - use_fft : bool, defaults to True + use_fft : bool, default True Use the FFT for convolutions or not. - decim : int | slice, defaults to 1 + decim : int | slice, default 1 To reduce memory usage, decimation factor after time-frequency decomposition. If `int`, returns tfr[..., ::decim]. @@ -42,14 +42,14 @@ class TimeFrequency(TransformerMixin, BaseEstimator): .. note:: Decimation may create aliasing artifacts, yet decimation is done after the convolutions. - output : str, defaults to 'complex' + output : str, default 'complex' * 'complex' : single trial complex. * 'power' : single trial power. * 'phase' : single trial phase. - n_jobs : int, defaults to 1 + n_jobs : int, default 1 The number of epochs to process at the same time. The parallelization is implemented across channels. - verbose : bool, str, int, or None, defaults to None + verbose : bool, str, int, or None, default None If not None, override default verbose level (see :func:`mne.verbose` and :ref:`Logging documentation ` for more). diff --git a/mne/decoding/transformer.py b/mne/decoding/transformer.py index 32d674f4952..08d71978889 100644 --- a/mne/decoding/transformer.py +++ b/mne/decoding/transformer.py @@ -80,7 +80,7 @@ class Scaler(TransformerMixin, BaseEstimator): info : instance of Info | None The measurement info. Only necessary if ``scalings`` is a dict or None. - scalings : dict, string, defaults to None. + scalings : dict, string, default None. Scaling method to be applied to data channel wise. * if scalings is None (default), scales mag by 1e15, grad by 1e13, @@ -94,10 +94,10 @@ class Scaler(TransformerMixin, BaseEstimator): :class:`sklearn.preprocessing.StandardScaler` is used. - with_mean : boolean, True by default + with_mean : boolean, default True If True, center the data using mean (or median) before scaling. Ignored for channel-type scaling. - with_std : boolean, True by default + with_std : boolean, default True If True, scale the data to unit variance (``scalings='mean'``), quantile range (``scalings='median``), or using channel type if ``scalings`` is a dict or None). @@ -251,7 +251,7 @@ def fit(self, X, y=None): Returns ------- - self : Instance of Vectorizer + self : instance of Vectorizer Return the modified instance. """ X = np.asarray(X) @@ -399,7 +399,7 @@ def transform(self, epochs_data): Returns ------- - psd : array, shape (n_signals, len(freqs)) or (len(freqs),) + psd : array, shape (n_signals, n_freqs) or (n_freqs,) The computed PSD. """ if not isinstance(epochs_data, np.ndarray): @@ -582,9 +582,9 @@ class UnsupervisedSpatialFilter(TransformerMixin, BaseEstimator): Parameters ---------- - estimator : scikit-learn estimator + estimator : instance of sklearn.base.BaseEstimator Estimator using some decomposition algorithm. - average : bool, defaults to False + average : bool, default False If True, the estimator is fitted on the average across samples (e.g. epochs). """ @@ -615,7 +615,7 @@ def fit(self, X, y=None): Returns ------- - self : Instance of UnsupervisedSpatialFilter + self : instance of UnsupervisedSpatialFilter Return the modified instance. """ if self.average: @@ -723,9 +723,9 @@ class TemporalFilter(TransformerMixin): h_freq : float | None High cut-off frequency in Hz. If None the data are only high-passed. - sfreq : float, defaults to 1.0 + sfreq : float, default 1.0 Sampling frequency in Hz. - filter_length : str | int, defaults to 'auto' + filter_length : str | int, default 'auto' Length of the FIR filter to use (if applicable): * int: specified length in samples. @@ -754,17 +754,17 @@ class TemporalFilter(TransformerMixin): min(max(h_freq * 0.25, 2.), info['sfreq'] / 2. - h_freq) Only used for ``method='fir'``. - n_jobs : int | str, defaults to 1 + n_jobs : int | str, default 1 Number of jobs to run in parallel. Can be 'cuda' if ``cupy`` is installed properly and method='fir'. - method : str, defaults to 'fir' + method : str, default 'fir' 'fir' will use overlap-add FIR filtering, 'iir' will use IIR forward-backward filtering (via filtfilt). - iir_params : dict | None, defaults to None + iir_params : dict | None, default None Dictionary of parameters to use for IIR filtering. See mne.filter.construct_iir_filter for details. If iir_params is None and method="iir", 4th order Butterworth will be used. - fir_window : str, defaults to 'hamming' + fir_window : str, default 'hamming' The window to use in FIR design, can be "hamming", "hann", or "blackman". fir_design : str @@ -774,7 +774,7 @@ class TemporalFilter(TransformerMixin): attenuation using fewer samples than "firwin2". ..versionadded:: 0.15 - verbose : bool, str, int, or None, defaults to None + verbose : bool, str, int, or None, default None If not None, override default verbose level (see :func:`mne.verbose` and :ref:`Logging documentation ` for more). Defaults to self.verbose. @@ -813,7 +813,7 @@ def fit(self, X, y=None): Parameters ---------- - X : array, shape (n_epochs, n_channels, n_times) or or shape (n_channels, n_times) # noqa + X : array, shape (n_epochs, n_channels, n_times) or or shape (n_channels, n_times) The data to be filtered over the last dimension. The channels dimension can be zero when passing a 2D array. y : None @@ -821,9 +821,9 @@ def fit(self, X, y=None): Returns ------- - self : instance of Filterer + self : instance of TemporalFilter Returns the modified instance. - """ + """ # noqa: E501 return self def transform(self, X): @@ -831,15 +831,15 @@ def transform(self, X): Parameters ---------- - X : array, shape (n_epochs, n_channels, n_times) or shape (n_channels, n_times) # noqa + X : array, shape (n_epochs, n_channels, n_times) or shape (n_channels, n_times) The data to be filtered over the last dimension. The channels dimension can be zero when passing a 2D array. Returns ------- - X : array, shape is same as used in input. + X : array The data after filtering. - """ + """ # noqa: E501 X = np.atleast_2d(X) if X.ndim > 3: diff --git a/mne/dipole.py b/mne/dipole.py index f85bc97332c..132aa1f937f 100644 --- a/mne/dipole.py +++ b/mne/dipole.py @@ -259,7 +259,7 @@ def plot_locations(self, trans, subject, subjects_dir=None, Returns ------- - fig : instance of mlab.Figure or matplotlib Figure + fig : instance of mayavi.mlab.Figure or matplotlib.figure.Figure The mayavi figure or matplotlib Figure. Notes diff --git a/mne/epochs.py b/mne/epochs.py index bf51ac8d6cb..fb70bfe1a04 100644 --- a/mne/epochs.py +++ b/mne/epochs.py @@ -1098,7 +1098,7 @@ def drop(self, indices, reason='USER', verbose=None): Parameters ---------- - indices : array of ints or bools + indices : array of int or bool Set epochs to remove by specifying indices to remove or a boolean mask to apply (where True values get removed). Events are correspondingly modified. @@ -1596,7 +1596,7 @@ def _drop_log_stats(drop_log, ignore=('IGNORED',)): Parameters ---------- - drop_log : list of lists + drop_log : list of list Epoch drop log from Epochs.drop_log. ignore : list The drop reasons to ignore. @@ -1737,7 +1737,7 @@ class Epochs(BaseEpochs): has been dropped, this attribute would be np.array([0, 2, 3]). preload : bool Indicates whether epochs are in memory. - drop_log : list of lists + drop_log : list of list A list of the same length as the event array used to initialize the Epochs object. If the i-th original event is still part of the selection, drop_log[i] will be an empty list; otherwise it will be diff --git a/mne/event.py b/mne/event.py index b04a4c45ffb..a978d608e67 100644 --- a/mne/event.py +++ b/mne/event.py @@ -899,7 +899,7 @@ def concatenate_events(events, first_samps, last_samps): Parameters ---------- - events : list of arrays + events : list of array List of event arrays, typically each extracted from a corresponding raw file that is being concatenated. first_samps : list or array of int @@ -1062,12 +1062,14 @@ def __getitem__(self, item): Parameters ---------- - item : str or list of str + item : str | list of str Name of the category (comment field in DACQ). Returns ------- - conds : dict or list of dict, each with following keys: + conds : dict | list of dict + Each dict should have the following keys: + comment: str The comment field in DACQ. state : bool @@ -1338,7 +1340,9 @@ def get_condition(self, raw, condition=None, stim_channel=None, mask=None, Returns ------- - conds_data : dict or list of dict, each with following keys: + conds_data : dict or list of dict + Each dict has the following keys: + events : array, shape (n_epochs_out, 3) List of zero time points (t0) for the epochs matching the condition. Use as the ``events`` parameter to Epochs. Note diff --git a/mne/evoked.py b/mne/evoked.py index 8f66a6cf8db..202f433507d 100644 --- a/mne/evoked.py +++ b/mne/evoked.py @@ -393,7 +393,7 @@ def animate_topomap(self, ch_type=None, times=None, frame_rate=None, Channel type to plot. Accepted data types: 'mag', 'grad', 'eeg'. If None, first available channel type from ('mag', 'grad', 'eeg') is used. Defaults to None. - times : array of floats | None + times : array of float | None The time points to plot. If None, 10 evenly spaced samples are calculated over the evoked time series. Defaults to None. frame_rate : int | None @@ -417,9 +417,9 @@ def animate_topomap(self, ch_type=None, times=None, frame_rate=None, Returns ------- - fig : instance of matplotlib figure + fig : instance of matplotlib.figure.Figure The figure. - anim : instance of matplotlib FuncAnimation + anim : instance of matplotlib.animation.FuncAnimation Animation of the topomap. Notes @@ -513,7 +513,7 @@ def get_peak(self, ch_type=None, tmin=None, tmax=None, Parameters ---------- - ch_type : 'mag', 'grad', 'eeg', 'seeg', 'ecog', 'hbo', hbr', 'misc', None # noqa + ch_type : 'mag', 'grad', 'eeg', 'seeg', 'ecog', 'hbo', hbr', 'misc', None The channel type to use. Defaults to None. If more than one sensor Type is present in the data the channel type has to be explicitly set. @@ -549,7 +549,7 @@ def get_peak(self, ch_type=None, tmin=None, tmax=None, return_amplitude is True. .. versionadded:: 0.16 - """ + """ # noqa: E501 supported = ('mag', 'grad', 'eeg', 'seeg', 'ecog', 'misc', 'hbo', 'hbr', 'None') data_picks = _pick_data_channels(self.info, with_ref_meg=False) @@ -948,9 +948,9 @@ def read_evokeds(fname, condition=None, baseline=None, kind='average', Returns ------- - evoked : Evoked (if condition is int or str) or list of Evoked (if - condition is None or list) - The evoked dataset(s). + evoked : Evoked or list of Evoked + The evoked dataset(s); one Evoked if condition is int or str, + or list of Evoked if condition is None or list. See Also -------- diff --git a/mne/forward/_make_forward.py b/mne/forward/_make_forward.py index 8ce54bad0a7..a2bf70becdc 100644 --- a/mne/forward/_make_forward.py +++ b/mne/forward/_make_forward.py @@ -785,7 +785,7 @@ def use_coil_def(fname): Returns ------- - context : context manager + context : contextmanager The context for using the coil definition. Notes diff --git a/mne/forward/forward.py b/mne/forward/forward.py index 38e45864393..e7622304f47 100644 --- a/mne/forward/forward.py +++ b/mne/forward/forward.py @@ -1284,14 +1284,14 @@ def restrict_forward_to_stc(fwd, stc): Parameters ---------- - fwd : Forward + fwd : instance of Forward Forward operator. - stc : SourceEstimate + stc : instance of SourceEstimate Source estimate. Returns ------- - fwd_out : dict + fwd_out : instance of Forward Restricted forward operator. See Also @@ -1351,7 +1351,7 @@ def restrict_forward_to_label(fwd, labels): ---------- fwd : Forward Forward operator. - labels : label object | list + labels : instance of Label | list Label object or list of label objects. Returns diff --git a/mne/gui/__init__.py b/mne/gui/__init__.py index 1248ef2b0f3..6df0da4c01e 100644 --- a/mne/gui/__init__.py +++ b/mne/gui/__init__.py @@ -53,7 +53,7 @@ def coregistration(tabbed=False, split=True, width=None, inst=None, Raw, Epochs, and Evoked files. subject : None | str Name of the mri subject. - subjects_dir : None | path + subjects_dir : None | str Override the SUBJECTS_DIR environment variable (sys.environ['SUBJECTS_DIR']) guess_mri_subject : bool diff --git a/mne/inverse_sparse/mxne_optim.py b/mne/inverse_sparse/mxne_optim.py index 863a10f0175..a5e70e380ba 100644 --- a/mne/inverse_sparse/mxne_optim.py +++ b/mne/inverse_sparse/mxne_optim.py @@ -831,7 +831,7 @@ def norm_epsilon(Y, l1_ratio, phi): l1_ratio : float between 0 and 1 Tradeoff between L2 and L1 regularization. When it is 0, no temporal regularization is applied. - phi : Instance of _Phi + phi : instance of _Phi The TF operator. Returns diff --git a/mne/io/artemis123/artemis123.py b/mne/io/artemis123/artemis123.py index 4556d219809..7a06d0b0c4e 100644 --- a/mne/io/artemis123/artemis123.py +++ b/mne/io/artemis123/artemis123.py @@ -46,7 +46,7 @@ def read_raw_artemis123(input_fname, preload=False, verbose=None, Returns ------- - raw : Instance of Raw + raw : instance of Raw A Raw object containing the data. See Also diff --git a/mne/io/base.py b/mne/io/base.py index 0e741f7dcb1..d83195c16ad 100644 --- a/mne/io/base.py +++ b/mne/io/base.py @@ -99,7 +99,7 @@ def to_data_frame(self, picks=None, index=None, scaling_time=1e3, Returns ------- - df : instance of pandas.core.DataFrame + df : instance of pandas.DataFrame A dataframe suitable for usage with other statistical/plotting/analysis packages. Column/Index values will depend on the object type being converted, but should be @@ -744,7 +744,7 @@ def set_annotations(self, annotations, emit_warning=True): Parameters ---------- - annotations : Instance of mne.Annotations | None + annotations : instance of mne.Annotations | None Annotations to set. If None, the annotations is defined but empty. emit_warning : bool @@ -1056,7 +1056,7 @@ def apply_function(self, fun, picks=None, dtype=None, n_jobs=1, Parameters ---------- - fun : function + fun : callable A function to be applied to the channels. The first argument of fun has to be a timeseries (numpy.ndarray). The function must operate on an array of shape ``(n_times,)`` if @@ -1568,7 +1568,7 @@ def resample(self, sfreq, npad='auto', window='boxcar', stim_picks=None, ------- raw : instance of Raw The resampled version of the raw object. - events : 2D array, shape (n_events, 3) | None + events : array, shape (n_events, 3) | None If events are jointly resampled, these are returned with the raw. See Also @@ -2640,7 +2640,7 @@ def concatenate_raws(raws, preload=None, events_list=None, verbose=None): ------- raw : instance of Raw The result of the concatenation (first Raw instance passed in). - events : ndarray of int, shape (n events, 3) + events : ndarray of int, shape (n_events, 3) The events. Only returned if `event_list` is not None. """ if events_list is not None: diff --git a/mne/io/cnt/cnt.py b/mne/io/cnt/cnt.py index 3ff5011deb9..543bb7874a7 100644 --- a/mne/io/cnt/cnt.py +++ b/mne/io/cnt/cnt.py @@ -39,7 +39,7 @@ def read_raw_cnt(input_fname, montage, eog=(), misc=(), ecg=(), emg=(), ---------- input_fname : str Path to the data file. - montage : str | None | instance of montage + montage : str | None | instance of Montage Path or instance of montage containing electrode positions. If None, xy sensor locations are read from the header (``x_coord`` and ``y_coord`` in ``ELECTLOC``) and fit to a sphere. See the documentation @@ -311,7 +311,7 @@ class RawCNT(BaseRaw): ---------- input_fname : str Path to the CNT file. - montage : str | None | instance of montage + montage : str | None | instance of Montage Path or instance of montage containing electrode positions. If None, xy sensor locations are read from the header (``x_coord`` and ``y_coord`` in ``ELECTLOC``) and fit to a sphere. See the documentation diff --git a/mne/io/edf/edf.py b/mne/io/edf/edf.py index 391aee5eb4b..8550bb1b8e1 100644 --- a/mne/io/edf/edf.py +++ b/mne/io/edf/edf.py @@ -66,7 +66,7 @@ def find_edf_events(raw): Parameters ---------- - raw : Instance of RawEDF + raw : instance of RawEDF The raw object for finding the events. Returns @@ -1125,7 +1125,7 @@ def read_raw_edf(input_fname, montage=None, eog=None, misc=None, Returns ------- - raw : Instance of RawEDF + raw : instance of RawEDF A Raw object containing EDF data. Notes diff --git a/mne/io/eeglab/eeglab.py b/mne/io/eeglab/eeglab.py index 27c9cb72f29..166758cde59 100644 --- a/mne/io/eeglab/eeglab.py +++ b/mne/io/eeglab/eeglab.py @@ -143,7 +143,7 @@ def read_raw_eeglab(input_fname, montage=None, eog=(), preload=False, input_fname : str Path to the .set file. If the data is stored in a separate .fdt file, it is expected to be in the same folder as the .set file. - montage : str | None | instance of montage + montage : str | None | instance of Montage Path or instance of montage containing electrode positions. If None, sensor locations are (0,0,0). See the documentation of :func:`mne.channels.read_montage` for more information. @@ -176,7 +176,7 @@ def read_raw_eeglab(input_fname, montage=None, eog=(), preload=False, Returns ------- - raw : Instance of RawEEGLAB + raw : instance of RawEEGLAB A Raw object containing EEGLAB .set data. Notes @@ -218,7 +218,7 @@ def read_epochs_eeglab(input_fname, events=None, event_id=None, montage=None, the id as string. If a list, all events with the IDs specified in the list are used. If None, the event_id is constructed from the EEGLAB (.set) file with each descriptions copied from `eventtype`. - montage : str | None | instance of montage + montage : str | None | instance of Montage Path or instance of montage containing electrode positions. If None, sensor locations are (0,0,0). See the documentation of :func:`mne.channels.read_montage` for more information. @@ -264,7 +264,7 @@ class RawEEGLAB(BaseRaw): input_fname : str Path to the .set file. If the data is stored in a separate .fdt file, it is expected to be in the same folder as the .set file. - montage : str | None | instance of montage + montage : str | None | instance of Montage Path or instance of montage containing electrode positions. If None, sensor locations are (0,0,0). See the documentation of :func:`mne.channels.read_montage` for more information. @@ -293,11 +293,6 @@ class RawEEGLAB(BaseRaw): If not None, override default verbose level (see :func:`mne.verbose` and :ref:`Logging documentation ` for more). - Returns - ------- - raw : Instance of RawEEGLAB - A Raw object containing EEGLAB .set data. - Notes ----- .. versionadded:: 0.11.0 @@ -418,7 +413,7 @@ class EpochsEEGLAB(BaseEpochs): reject_tmax : scalar | None End of the time window used to reject epochs (with the default None, the window will end with tmax). - montage : str | None | instance of montage + montage : str | None | instance of Montage Path or instance of montage containing electrode positions. If None, sensor locations are (0,0,0). See the documentation of :func:`mne.channels.read_montage` for more information. diff --git a/mne/io/egi/egi.py b/mne/io/egi/egi.py index a0a167cbc7d..1b0df67cd5c 100644 --- a/mne/io/egi/egi.py +++ b/mne/io/egi/egi.py @@ -98,7 +98,7 @@ def read_raw_egi(input_fname, montage=None, eog=None, misc=None, input_fname : str Path to the raw file. Files with an extension .mff are automatically considered to be EGI's native MFF format files. - montage : str | None | instance of montage + montage : str | None | instance of Montage Path or instance of montage containing electrode positions. If None, sensor locations are (0,0,0). See the documentation of :func:`mne.channels.read_montage` for more information. @@ -139,7 +139,7 @@ def read_raw_egi(input_fname, montage=None, eog=None, misc=None, Returns ------- - raw : Instance of RawEGI + raw : instance of RawEGI A Raw object containing EGI data. Notes diff --git a/mne/io/egi/egimff.py b/mne/io/egi/egimff.py index ebf7cc339a7..938d881ef54 100644 --- a/mne/io/egi/egimff.py +++ b/mne/io/egi/egimff.py @@ -258,7 +258,7 @@ def _read_raw_egi_mff(input_fname, montage=None, eog=None, misc=None, Returns ------- - raw : Instance of RawMff + raw : instance of RawMff A Raw object containing EGI mff data. Notes diff --git a/mne/io/fieldtrip/fieldtrip.py b/mne/io/fieldtrip/fieldtrip.py index 944ac0b7023..d3f8034be19 100644 --- a/mne/io/fieldtrip/fieldtrip.py +++ b/mne/io/fieldtrip/fieldtrip.py @@ -40,7 +40,7 @@ def read_raw_fieldtrip(fname, info, data_name='data'): Returns ------- - raw: Instance of RawArray + raw: instance of RawArray A Raw Object containing the loaded data. """ @@ -103,7 +103,7 @@ def read_epochs_fieldtrip(fname, info, data_name='data', Returns ------- - epochs: Instance of EpochsArray + epochs: instance of EpochsArray An EpochsArray containing the loaded data. @@ -157,7 +157,7 @@ def read_evoked_fieldtrip(fname, info, comment=None, Returns ------- - evoked: Instance of EvokedArray + evoked: instance of EvokedArray An EvokedArray containing the loaded data. """ diff --git a/mne/io/kit/coreg.py b/mne/io/kit/coreg.py index a15872dee50..a6a88d71368 100644 --- a/mne/io/kit/coreg.py +++ b/mne/io/kit/coreg.py @@ -26,7 +26,7 @@ def read_mrk(fname): Returns ------- - mrk_points : numpy.array, shape = (n_points, 3) + mrk_points : ndarray, shape (n_points, 3) Marker points in MEG space [m]. """ ext = op.splitext(fname)[-1] diff --git a/mne/io/kit/kit.py b/mne/io/kit/kit.py index 27ddecc5ad3..f9e51b69977 100644 --- a/mne/io/kit/kit.py +++ b/mne/io/kit/kit.py @@ -841,7 +841,7 @@ def read_raw_kit(input_fname, mrk=None, elp=None, hsp=None, stim='>', Returns ------- - raw : Instance of RawKIT + raw : instance of RawKIT A Raw object containing KIT data. See Also diff --git a/mne/io/nicolet/nicolet.py b/mne/io/nicolet/nicolet.py index 5619a6a84dd..e193bbacd6f 100644 --- a/mne/io/nicolet/nicolet.py +++ b/mne/io/nicolet/nicolet.py @@ -29,7 +29,7 @@ def read_raw_nicolet(input_fname, ch_type, montage=None, eog=(), ecg=(), ch_type : str Channel type to designate to the data channels. Supported data types include 'eeg', 'seeg'. - montage : str | None | instance of montage + montage : str | None | instance of Montage Path or instance of montage containing electrode positions. If None, sensor locations are (0,0,0). See the documentation of :func:`mne.channels.read_montage` for more information. @@ -60,7 +60,7 @@ def read_raw_nicolet(input_fname, ch_type, montage=None, eog=(), ecg=(), Returns ------- - raw : Instance of Raw + raw : instance of Raw A Raw object containing the data. See Also diff --git a/mne/io/proj.py b/mne/io/proj.py index 58e79f60a1a..b42b168f4cf 100644 --- a/mne/io/proj.py +++ b/mne/io/proj.py @@ -100,7 +100,7 @@ def plot_topomap(self, layout=None, cmap=None, sensors=True, Returns ------- - fig : instance of matplotlib figure + fig : instance of Figure Figure distributing one image per channel across sensor topography. Notes @@ -287,12 +287,12 @@ def plot_projs_topomap(self, ch_type=None, layout=None, axes=None): Parameters ---------- - ch_type : 'mag' | 'grad' | 'planar1' | 'planar2' | 'eeg' | None | List + ch_type : 'mag' | 'grad' | 'planar1' | 'planar2' | 'eeg' | None | list The channel type to plot. For 'grad', the gradiometers are collec- ted in pairs and the RMS for each pair is plotted. If None (default), it will return all channel types present. If a list of ch_types is provided, it will return multiple figures. - layout : None | Layout | List of Layouts + layout : None | Layout | list of Layout Layout instance specifying sensor positions (does not need to be specified for Neuromag data). If possible, the correct layout file is inferred from the data; if no appropriate layout @@ -306,7 +306,7 @@ def plot_projs_topomap(self, ch_type=None, layout=None, axes=None): Returns ------- - fig : instance of matplotlib figure + fig : instance of Figure Figure distributing one image per channel across sensor topography. """ if self.info['projs'] is not None or len(self.info['projs']) != 0: diff --git a/mne/io/tests/test_raw.py b/mne/io/tests/test_raw.py index 83d1ee26286..b14ed680e12 100644 --- a/mne/io/tests/test_raw.py +++ b/mne/io/tests/test_raw.py @@ -55,7 +55,7 @@ def _test_raw_reader(reader, test_preloading=True, **kwargs): Returns ------- - raw : Instance of Raw + raw : instance of Raw A preloaded Raw object. """ tempdir = _TempDir() diff --git a/mne/label.py b/mne/label.py index 5fad2e7cbcc..55d1d64ea27 100644 --- a/mne/label.py +++ b/mne/label.py @@ -150,11 +150,11 @@ class Label(object): Parameters ---------- - vertices : array (length N) + vertices : array, shape (N,) vertex indices (0 based). - pos : array (N by 3) | None + pos : array, shape (N, 3) | None locations in meters. If None, then zeros are used. - values : array (length N) | None + values : array, shape (N,) | None values at the vertices. If None, then ones are used. hemi : 'lh' | 'rh' Hemisphere to which the label applies. @@ -183,16 +183,16 @@ class Label(object): Hemisphere. name : None | str A name for the label. It is OK to change that attribute manually. - pos : array, shape = (n_pos, 3) + pos : array, shape (N, 3) Locations in meters. subject : str | None Subject name. It is best practice to set this to the proper value on initialization, but it can also be set manually. - values : array, len = n_pos + values : array, shape (N,) Values at the vertices. verbose : bool, str, int, or None See above. - vertices : array, len = n_pos + vertices : array, shape (N,) Vertex indices (0 based) """ @@ -474,7 +474,7 @@ def smooth(self, subject=None, smooth=2, grade=None, Cannot be None here since not all vertices are used. For a grade of 5 (e.g., fsaverage), a smoothing of 2 will fill a label. - grade : int, list (of two arrays), array, or None + grade : int, list of shape (2,), array, or None Resolution of the icosahedral mesh (typically 5). If None, all vertices will be used (potentially filling the surface). If a list, values will be morphed to the set of vertices specified in grade[0] @@ -485,7 +485,7 @@ def smooth(self, subject=None, smooth=2, grade=None, computing vertex locations. If one array is used, it is assumed that all vertices belong to the hemisphere of the label. To create a label filling the surface, use None. - subjects_dir : string, or None + subjects_dir : str, or None Path to SUBJECTS_DIR if it is not set in the environment. n_jobs : int Number of jobs to run in parallel @@ -527,7 +527,7 @@ def morph(self, subject_from=None, subject_to=None, smooth=5, grade=None, smooth : int Number of iterations for the smoothing of the surface data. Cannot be None here since not all vertices are used. - grade : int, list (of two arrays), array, or None + grade : int, list of shape (2,), array, or None Resolution of the icosahedral mesh (typically 5). If None, all vertices will be used (potentially filling the surface). If a list, values will be morphed to the set of vertices specified in grade[0] @@ -538,7 +538,7 @@ def morph(self, subject_from=None, subject_to=None, smooth=5, grade=None, computing vertex locations. If one array is used, it is assumed that all vertices belong to the hemisphere of the label. To create a label filling the surface, use None. - subjects_dir : string, or None + subjects_dir : str, or None Path to SUBJECTS_DIR if it is not set in the environment. n_jobs : int Number of jobs to run in parallel. @@ -622,7 +622,7 @@ def split(self, parts=2, subject=None, subjects_dir=None, Returns ------- - labels : list of Label (len = n_parts) + labels : list of Label, shape (n_parts,) The labels, starting from the lowest to the highest end of the projection axis. @@ -774,7 +774,7 @@ class BiHemiLabel(object): Label for the right hemisphere. name : None | str name for the label - color : None | matplotlib color + color : None | color Label color and alpha (e.g., ``(1., 0., 0., 1.)`` for red). Note that due to file specification limitations, the color isn't saved to or loaded from files written to disk. @@ -1109,7 +1109,7 @@ def split_label(label, parts=2, subject=None, subjects_dir=None, Returns ------- - labels : list of Label (len = n_parts) + labels : list of Label, shape (n_parts,) The labels, starting from the lowest to the highest end of the projection axis. @@ -1293,7 +1293,7 @@ def stc_to_label(stc, src=None, smooth=True, connected=False, Returns ------- - labels : list of Labels | list of list of Labels + labels : list of Label | list of list of Label The generated labels. If connected is False, it returns a list of Labels (one per hemisphere). If no Label is available in a hemisphere, None is returned. If connected is True, @@ -2126,7 +2126,7 @@ def labels_to_stc(labels, values, tmin=0, tstep=1, subject=None, verbose=None): ---------- labels : list of Label The labels. Must not overlap. - values : ndarray, shape (len(labels), ...) + values : ndarray, shape (n_labels, ...) The values in each label. Can be 1D or 2D. tmin : float The tmin to use for the STC. diff --git a/mne/minimum_norm/psf_ctf.py b/mne/minimum_norm/psf_ctf.py index 33e79d78ca2..c831aba7421 100644 --- a/mne/minimum_norm/psf_ctf.py +++ b/mne/minimum_norm/psf_ctf.py @@ -56,7 +56,7 @@ def point_spread_function(inverse_operator, forward, labels, method='dSPM', solution will not be used in PSF computation. labels : list of Label Labels for which PSFs shall be computed. - method : 'MNE' | 'dSPM' | 'sLORETA' | eLORETA + method : 'MNE' | 'dSPM' | 'sLORETA' | 'eLORETA' Inverse method for which PSFs shall be computed (for :func:`apply_inverse`). lambda2 : float @@ -75,7 +75,7 @@ def point_spread_function(inverse_operator, forward, labels, method='dSPM', assumed to be more variable. "sub-leadfields" are the parts of the forward solutions that belong to vertices within individual labels. - n_svd_comp : integer + n_svd_comp : int Number of SVD components for which PSFs will be computed and output (irrelevant for 'sum' and 'mean'). Explained variances within sub-leadfields are shown in screen output. diff --git a/mne/minimum_norm/time_frequency.py b/mne/minimum_norm/time_frequency.py index 3037414f879..c67beca17a5 100644 --- a/mne/minimum_norm/time_frequency.py +++ b/mne/minimum_norm/time_frequency.py @@ -71,7 +71,7 @@ def source_band_induced_power(epochs, inverse_operator, bands, label=None, ---------- epochs : instance of Epochs The epochs. - inverse_operator : instance of inverse operator + inverse_operator : instance of InverseOperator The inverse operator. bands : dict Example : bands = dict(alpha=[8, 9]). @@ -91,7 +91,7 @@ def source_band_induced_power(epochs, inverse_operator, bands, label=None, Do convolutions in time or frequency domain with FFT. decim : int Temporal decimation factor. - baseline : None (default) or tuple of length 2 + baseline : None (default) or tuple, shape (2,) The time interval to apply baseline correction. 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 @@ -130,7 +130,7 @@ def source_band_induced_power(epochs, inverse_operator, bands, label=None, Returns ------- - stcs : dict with a SourceEstimate (or VolSourceEstimate) for each band + stcs : dict of SourceEstimate (or VolSourceEstimate) The estimated source space induced power estimates. """ # noqa: E501 _check_method(method) diff --git a/mne/morph.py b/mne/morph.py index 2da8a52bd3a..1e5e28d0618 100644 --- a/mne/morph.py +++ b/mne/morph.py @@ -236,10 +236,11 @@ class SourceMorph(object): ---------- subject_from : str | None Name of the subject from which to morph as named in the SUBJECTS_DIR. - subject_to : str | array | list of two arrays + subject_to : str | array | list of array Name of the subject on which to morph as named in the SUBJECTS_DIR. The default is 'fsaverage'. If morphing a volume source space, - subject_to can be the path to a MRI volume. + subject_to can be the path to a MRI volume. Can also be a list of + two arrays if morphing to hemisphere surfaces. kind : str | None Kind of source estimate. E.g. 'volume' or 'surface'. zooms : float | tuple @@ -783,7 +784,7 @@ def compute_morph_matrix(subject_from, subject_to, vertices_from, vertices_to, Name of the original subject as named in the SUBJECTS_DIR. subject_to : str Name of the subject on which to morph as named in the SUBJECTS_DIR. - vertices_from : list of arrays of int + vertices_from : list of array of int Vertices for each hemisphere (LH, RH) for subject_from. vertices_to : list of arrays of int Vertices for each hemisphere (LH, RH) for subject_to. @@ -921,7 +922,7 @@ def grade_to_vertices(subject, grade, subjects_dir=None, n_jobs=1, Returns ------- - vertices : list of arrays of int + vertices : list of array of int Vertex numbers for LH and RH """ # add special case for fsaverage for speed diff --git a/mne/preprocessing/ica.py b/mne/preprocessing/ica.py index 41b079e17d0..5c38c5001ab 100644 --- a/mne/preprocessing/ica.py +++ b/mne/preprocessing/ica.py @@ -162,7 +162,7 @@ class ICA(ContainsMixin): `n_pca_components`. This attribute allows to balance noise reduction against potential loss of features due to dimensionality reduction, independently of the number of ICA components. - noise_cov : None | instance of mne.cov.Covariance + noise_cov : None | instance of Covariance Noise covariance used for pre-whitening. If None (default), channels are scaled to unit variance ("z-standardized") prior to the whitening by PCA. @@ -925,13 +925,13 @@ def score_sources(self, inst, target=None, score_func='pearsonr', ---------- inst : instance of Raw, Epochs or Evoked The object to reconstruct the sources from. - target : array-like | ch_name | None + target : array-like | str | None Signal to which the sources shall be compared. It has to be of - the same shape as the sources. If some string is supplied, a - routine will try to find a matching channel. If None, a score + the same shape as the sources. If str, a routine will try to find + a matching channel name. If None, a score function expecting only one input-array argument must be used, for instance, scipy.stats.skew (default). - score_func : callable | str label + score_func : callable | str Callable taking as arguments either two input arrays (e.g. Pearson correlation) or one input array (e. g. skewness) and returns a float. For convenience the @@ -1618,8 +1618,9 @@ def detect_artifacts(self, raw, start_find=None, stop_find=None, sorted in descending order will be indexed accordingly. E.g. range(2) would return the two sources with the highest score. If None, this step will be skipped. - add_nodes : list of ica_nodes - Additional list if tuples carrying the following parameters: + add_nodes : list of tuple + Additional list if tuples carrying the following parameters + of ica nodes: (name : str, target : str | array, score_func : callable, criterion : float | int | list-like | slice). This parameter is a generalization of the artifact specific parameters above and has @@ -2178,7 +2179,7 @@ def run_ica(raw, n_components, max_pca_components=100, ``'n_components_'`` PCA components will be added before restoring the sensor space data. The attribute gets updated each time the according parameter for in .pick_sources_raw or .pick_sources_epochs is changed. - noise_cov : None | instance of mne.cov.Covariance + noise_cov : None | instance of Covariance Noise covariance used for whitening. If None, channels are just z-scored. random_state : None | int | instance of np.random.RandomState @@ -2249,7 +2250,7 @@ def run_ica(raw, n_components, max_pca_components=100, sorted in descending order will be indexed accordingly. E.g. range(2) would return the two sources with the highest score. If None, this step will be skipped. - add_nodes : list of ica_nodes + add_nodes : list of tuple Additional list if tuples carrying the following parameters: (name : str, target : str | array, score_func : callable, criterion : float | int | list-like | slice). This parameter is a @@ -2441,9 +2442,9 @@ def corrmap(icas, template, threshold="auto", label=None, ch_type="eeg", Returns ------- - template_fig : fig + template_fig : Figure Figure showing the template. - labelled_ics : fig + labelled_ics : Figure Figure showing the labelled ICs in all ICA decompositions. """ if not isinstance(plot, bool): diff --git a/mne/preprocessing/xdawn.py b/mne/preprocessing/xdawn.py index 4b26ed9690d..14ca9f8094f 100644 --- a/mne/preprocessing/xdawn.py +++ b/mne/preprocessing/xdawn.py @@ -351,7 +351,7 @@ class Xdawn(_XdawnTransformer): Parameters ---------- - n_components : int (default 2) + n_components : int, (default 2) The number of components to decompose the signals. signal_cov : None | Covariance | ndarray, shape (n_channels, n_channels) (default None). The signal covariance used for whitening of the data. @@ -375,9 +375,9 @@ class Xdawn(_XdawnTransformer): patterns_ : dict of ndarray If fit, the Xdawn patterns used to restore the signals for each event type, else empty. - evokeds_ : dict of evoked instance + evokeds_ : dict of Evoked If fit, the evoked response for each event type. - event_id_ : dict of event id + event_id_ : dict The event id. correct_overlap_ : bool Whether overlap correction was applied. @@ -418,14 +418,14 @@ def fit(self, epochs, y=None): Parameters ---------- - epochs : Epochs object + epochs : instance of Epochs An instance of Epoch on which Xdawn filters will be fitted. y : ndarray | None (default None) If None, used epochs.events[:, 2]. Returns ------- - self : Xdawn instance + self : instance of Xdawn The Xdawn instance. """ # Check data @@ -540,7 +540,7 @@ def apply(self, inst, event_id=None, include=None, exclude=None): Returns ------- - out : dict of instance + out : dict A dict of instance (from the same type as inst input) for each event type in event_id. """ diff --git a/mne/realtime/client.py b/mne/realtime/client.py index 2dbda051739..401e2b22f76 100644 --- a/mne/realtime/client.py +++ b/mne/realtime/client.py @@ -311,7 +311,7 @@ def unregister_receive_callback(self, callback): Parameters ---------- - callback : function + callback : callable The callback to unregister. """ if callback in self._recv_callbacks: diff --git a/mne/report.py b/mne/report.py index cb02a2a447d..2250979dc25 100644 --- a/mne/report.py +++ b/mne/report.py @@ -70,7 +70,7 @@ def _fig_to_img(fig, image_format='png', scale=None, **kwargs): # on some systems importing Mayavi raises SystemExit (!) except Exception as e: warn('Could not import mayavi (%r). Trying to render' - '`mayavi.core.scene.Scene` figure instances' + '`mayavi.core.api.Scene` figure instances' ' will throw an error.' % (e,)) if fig.scene is not None: img = mlab.screenshot(figure=fig) @@ -327,7 +327,7 @@ def open_report(fname, **params): The file containing the report, stored in the HDF5 format. If the file does not exist yet, a new report is created that will be saved to the specified file. - **params : list of parameters + **params : kwargs When creating a new report, any named parameters other than ``fname`` are passed to the ``__init__`` function of the `Report` object. When reading an existing report, the parameters are checked with the @@ -1041,7 +1041,7 @@ def add_figs_to_section(self, figs, captions, section='custom', Parameters ---------- - figs : figure | list of figures + 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 :class:`matplotlib.figure.Figure`, :class:`mayavi.core.api.Scene`, or :class:`numpy.ndarray`. diff --git a/mne/simulation/evoked.py b/mne/simulation/evoked.py index 346dea4cab2..f30c4ba87c1 100644 --- a/mne/simulation/evoked.py +++ b/mne/simulation/evoked.py @@ -41,7 +41,7 @@ def simulate_evoked(fwd, stc, info, cov, nave=30, iir_filter=None, .. versionadded:: 0.15.0 iir_filter : None | array IIR filter coefficients (denominator) e.g. [1, -1, 0.2]. - random_state : None | int | np.random.RandomState + random_state : None | int | ~numpy.random.RandomState To specify the random generator state. use_cps : bool (default True) Whether to use cortical patch statistics to define normal diff --git a/mne/simulation/raw.py b/mne/simulation/raw.py index bfa021c04f7..454953225e5 100644 --- a/mne/simulation/raw.py +++ b/mne/simulation/raw.py @@ -131,7 +131,7 @@ def simulate_raw(raw, stc, trans, src, bem, cov='simple', IIR filter coefficients (denominator) e.g. [1, -1, 0.2]. n_jobs : int Number of jobs to use. - random_state : None | int | np.random.RandomState + random_state : None | int | ~numpy.random.RandomState The random generator state used for blink, ECG, and sensor noise randomization. use_cps : None | bool (default True) diff --git a/mne/simulation/source.py b/mne/simulation/source.py index 4aa63e6b229..72d7e36fa70 100644 --- a/mne/simulation/source.py +++ b/mne/simulation/source.py @@ -21,7 +21,7 @@ def select_source_in_label(src, label, random_state=None, location='random', The source space label : Label the label (read with mne.read_label) - random_state : None | int | np.random.RandomState + random_state : None | int | ~numpy.random.RandomState To specify the random generator state. location : str The label location to choose. Can be 'random' (default) or 'center' @@ -108,9 +108,9 @@ def simulate_sparse_stc(src, n_dipoles, times, sinusoid as ``1e-7 * np.sin(20 * pi * t)``. The function should take as input the array of time samples in seconds and return an array of the same length containing the time courses. - labels : None | list of Labels + labels : None | list of Label The labels. The default is None, otherwise its size must be n_dipoles. - random_state : None | int | np.random.RandomState + random_state : None | int | ~numpy.random.RandomState To specify the random generator state. location : str The label location to choose. Can be 'random' (default) or 'center' @@ -223,15 +223,15 @@ def simulate_stc(src, labels, stc_data, tmin, tstep, value_fun=None): ---------- src : instance of SourceSpaces The source space - labels : list of Labels + labels : list of Label The labels - stc_data : array (shape: len(labels) x n_times) + stc_data : array, shape (n_labels, n_times) The waveforms tmin : float The beginning of the timeseries tstep : float The time step (1 / sampling frequency) - value_fun : function | None + value_fun : callable | None Function to apply to the label values to obtain the waveform scaling for each vertex in the label. If None (default), uniform scaling is used. diff --git a/mne/source_estimate.py b/mne/source_estimate.py index f754d2b46b2..bf71bf79140 100644 --- a/mne/source_estimate.py +++ b/mne/source_estimate.py @@ -440,12 +440,12 @@ class _BaseSourceEstimate(ToDataFrameMixin, TimeMixin): Parameters ---------- - data : array of shape (n_dipoles, n_times) | 2-tuple (kernel, sens_data) + data : array, shape (n_dipoles, n_times) | tuple, shape (2,) The data in source space. The data can either be a single array or a tuple with two arrays: "kernel" shape (n_vertices, n_sensors) and "sens_data" shape (n_sensors, n_times). In this case, the source space data corresponds to "numpy.dot(kernel, sens_data)". - vertices : array | list of two arrays + vertices : array | list of array Vertex numbers corresponding to the data. tmin : float Time point of the first sample in data. @@ -462,9 +462,9 @@ class _BaseSourceEstimate(ToDataFrameMixin, TimeMixin): ---------- subject : str | None The subject name. - times : array of shape (n_times,) + times : array, shape (n_times,) The time vector. - vertices : array or list of arrays of shape (n_dipoles,) + vertices : array | list of array of shape (n_dipoles,) The indices of the dipoles in the different source spaces. Can be an array if there is only one source space (e.g., for volumes). data : array of shape (n_dipoles, n_times) @@ -1074,7 +1074,7 @@ class _BaseSurfaceSourceEstimate(_BaseSourceEstimate): ---------- data : array The data in source space. - vertices : list of two arrays + vertices : list, shape (2,) Vertex numbers corresponding to the data. tmin : scalar Time point of the first sample in data. @@ -1093,7 +1093,7 @@ class _BaseSurfaceSourceEstimate(_BaseSourceEstimate): The subject name. times : array of shape (n_times,) The time vector. - vertices : list of two arrays of shape (n_dipoles,) + vertices : list of array, shape (2,) The indices of the dipoles in the left and right source space. data : array The data in source space. @@ -1302,12 +1302,12 @@ class SourceEstimate(_BaseSurfaceSourceEstimate): Parameters ---------- - data : array of shape (n_dipoles, n_times) | 2-tuple (kernel, sens_data) + data : array of shape (n_dipoles, n_times) | tuple, shape (2,) The data in source space. The data can either be a single array or a tuple with two arrays: "kernel" shape (n_vertices, n_sensors) and "sens_data" shape (n_sensors, n_times). In this case, the source space data corresponds to "numpy.dot(kernel, sens_data)". - vertices : list of two arrays + vertices : list of shape (2,) Vertex numbers corresponding to the data. tmin : scalar Time point of the first sample in data. @@ -1326,7 +1326,7 @@ class SourceEstimate(_BaseSurfaceSourceEstimate): The subject name. times : array of shape (n_times,) The time vector. - vertices : list of two arrays of shape (n_dipoles,) + vertices : list of shape (2,) The indices of the dipoles in the left and right source space. data : array of shape (n_dipoles, n_times) The data in source space. @@ -1439,7 +1439,7 @@ def extract_label_time_course(self, labels, src, mode='mean_flip', Returns ------- - label_tc : array, shape=(len(labels), n_times) + label_tc : array, shape=(n_labels, n_times) Extracted time course for each label. See Also @@ -1614,7 +1614,7 @@ class VolSourceEstimate(_BaseSourceEstimate): Parameters ---------- - data : array of shape (n_dipoles, n_times) | 2-tuple (kernel, sens_data) + data : array of shape (n_dipoles, n_times) | tuple, shape (2,) The data in source space. The data can either be a single array or a tuple with two arrays: "kernel" shape (n_vertices, n_sensors) and "sens_data" shape (n_sensors, n_times). In this case, the source @@ -1853,7 +1853,7 @@ class VectorSourceEstimate(_BaseSurfaceSourceEstimate): data : array of shape (n_dipoles, 3, n_times) The data in source space. Each dipole contains three vectors that denote the dipole strength in X, Y and Z directions over time. - vertices : array | list of two arrays + vertices : array | list of shape (2,) Vertex numbers corresponding to the data. tmin : float Time point of the first sample in data. @@ -1986,12 +1986,12 @@ class MixedSourceEstimate(_BaseSourceEstimate): Parameters ---------- - data : array of shape (n_dipoles, n_times) | 2-tuple (kernel, sens_data) + data : array of shape (n_dipoles, n_times) | tuple, shape (2,) The data in source space. The data can either be a single array or a tuple with two arrays: "kernel" shape (n_vertices, n_sensors) and "sens_data" shape (n_sensors, n_times). In this case, the source space data corresponds to "numpy.dot(kernel, sens_data)". - vertices : list of arrays + vertices : list of array Vertex numbers corresponding to the data. tmin : scalar Time point of the first sample in data. @@ -2010,7 +2010,7 @@ class MixedSourceEstimate(_BaseSourceEstimate): The subject name. times : array of shape (n_times,) The time vector. - vertices : list of arrays of shape (n_dipoles,) + vertices : list of array The indices of the dipoles in each source space. data : array of shape (n_dipoles, n_times) The data in source space. @@ -2087,11 +2087,11 @@ def plot_surface(self, src, subject=None, surface='inflated', hemi='lh', subjects_dir : str The path to the FreeSurfer subjects reconstructions. It corresponds to FreeSurfer environment variable SUBJECTS_DIR. - figure : instance of mayavi.core.scene.Scene | None + figure : instance of mayavi.mlab.Figure | None If None, the last figure will be cleaned and a new figure will be created. views : str | list - View to use. See surfer.Brain(). + View to use. See `surfer.Brain`. colorbar : bool If True, display colorbar on scene. clim : str | dict @@ -2099,8 +2099,8 @@ def plot_surface(self, src, subject=None, surface='inflated', hemi='lh', Returns ------- - brain : Brain - A instance of surfer.viz.Brain from PySurfer. + brain : instance of surfer.Brain + A instance of `surfer.Brain` from PySurfer. """ # extract surface source spaces surf = _ensure_src(src, kind='surf') @@ -2233,7 +2233,7 @@ def spatio_temporal_src_connectivity(src, n_times, dist=None, verbose=None): Returns ------- - connectivity : sparse COO matrix + connectivity : ~scipy.sparse.coo_matrix The connectivity matrix describing the spatio-temporal graph structure. If N is the number of vertices in the source space, the N first nodes in the graph are the @@ -2299,7 +2299,7 @@ def spatio_temporal_tris_connectivity(tris, n_times, remap_vertices=False, Returns ------- - connectivity : sparse COO matrix + connectivity : ~scipy.sparse.coo_matrix The connectivity matrix describing the spatio-temporal graph structure. If N is the number of vertices in the source space, the N first nodes in the graph are the @@ -2335,7 +2335,7 @@ def spatio_temporal_dist_connectivity(src, n_times, dist, verbose=None): Returns ------- - connectivity : sparse COO matrix + connectivity : ~scipy.sparse.coo_matrix The connectivity matrix describing the spatio-temporal graph structure. If N is the number of vertices in the source space, the N first nodes in the graph are the @@ -2374,7 +2374,7 @@ def spatial_src_connectivity(src, dist=None, verbose=None): Returns ------- - connectivity : sparse COO matrix + connectivity : ~scipy.sparse.coo_matrix The connectivity matrix describing the spatial graph structure. """ return spatio_temporal_src_connectivity(src, 1, dist) @@ -2397,7 +2397,7 @@ def spatial_tris_connectivity(tris, remap_vertices=False, verbose=None): Returns ------- - connectivity : sparse COO matrix + connectivity : ~scipy.sparse.coo_matrix The connectivity matrix describing the spatial graph structure. """ return spatio_temporal_tris_connectivity(tris, 1, remap_vertices) @@ -2421,7 +2421,7 @@ def spatial_dist_connectivity(src, dist, verbose=None): Returns ------- - connectivity : sparse COO matrix + connectivity : ~scipy.sparse.coo_matrix The connectivity matrix describing the spatial graph structure. """ return spatio_temporal_dist_connectivity(src, 1, dist) @@ -2443,7 +2443,7 @@ def spatial_inter_hemi_connectivity(src, dist, verbose=None): Returns ------- - connectivity : sparse COO matrix + connectivity : ~scipy.sparse.coo_matrix The connectivity matrix describing the spatial graph structure. Typically this should be combined (addititively) with another existing intra-hemispheric connectivity matrix, e.g. computed @@ -2688,9 +2688,9 @@ def extract_label_time_course(stcs, labels, src, mode='mean_flip', Returns ------- - label_tc : array | list (or generator) of array, shape=(len(labels), n_times) + label_tc : array | list (or generator) of array, shape (n_labels, n_times) Extracted time course for each label and source estimate. - """ # noqa: E501 + """ # convert inputs to lists if isinstance(stcs, SourceEstimate): stcs = [stcs] diff --git a/mne/source_space.py b/mne/source_space.py index f9501ea4b2a..eb786cbaede 100644 --- a/mne/source_space.py +++ b/mne/source_space.py @@ -127,7 +127,7 @@ def plot(self, head=False, brain=None, skull=None, subjects_dir=None, Returns ------- - fig : instance of mlab Figure + fig : instance of mayavi.mlab.Figure The figure. """ from .viz import plot_alignment @@ -1204,7 +1204,7 @@ def vertex_to_mni(vertices, hemis, subject, subjects_dir=None, mode=None, Returns ------- - coordinates : n_vertices x 3 array of float + coordinates : array, shape (n_vertices, 3) The MNI coordinates (in mm) of the vertices Notes diff --git a/mne/stats/cluster_level.py b/mne/stats/cluster_level.py index f082c5f1075..582c1062635 100644 --- a/mne/stats/cluster_level.py +++ b/mne/stats/cluster_level.py @@ -252,7 +252,7 @@ def _find_clusters(x, threshold, tail=0, connectivity=None, max_step=1, threshold-free cluster enhancement. tail : -1 | 0 | 1 Type of comparison - connectivity : sparse matrix in COO format, None, or list + connectivity : scipy.sparse.coo_matrix, None, or list Defines connectivity between features. The matrix is assumed to be symmetric and only the upper triangular half is used. If connectivity is a list, it is assumed that each entry stores the @@ -994,7 +994,7 @@ def permutation_cluster_test( stat_fun : callable | None Function called to calculate statistics, must accept 1d-arrays as arguments (default None uses :func:`mne.stats.f_oneway`). - connectivity : sparse matrix. + connectivity : scipy.sparse.spmatrix Defines connectivity between features. The matrix is assumed to be symmetric and only the upper triangular half is used. Default is None, i.e, a regular lattice connectivity. @@ -1104,7 +1104,7 @@ def permutation_cluster_1samp_test( stat_fun : callable | None Function used to compute the statistical map (default None will use :func:`mne.stats.ttest_1samp_no_p`). - connectivity : sparse matrix | None | False + connectivity : scipy.sparse.spmatrix | None | False Defines connectivity between features. The matrix is assumed to be symmetric and only the upper triangular half is used. This matrix must be square with dimension (n_vertices * n_times) or @@ -1244,7 +1244,7 @@ def spatio_temporal_cluster_1samp_test( stat_fun : callable | None Function used to compute the statistical map (default None will use :func:`mne.stats.ttest_1samp_no_p`). - connectivity : sparse matrix or None + connectivity : scipy.sparse.spmatrix or None Defines connectivity between features. The matrix is assumed to be symmetric and only the upper triangular half is used. This matrix must be square with dimension (n_vertices * n_times) or @@ -1361,7 +1361,7 @@ def spatio_temporal_cluster_test( stat_fun : callable | None Function called to calculate statistics, must accept 1d-arrays as arguments (default None uses :func:`mne.stats.f_oneway`). - connectivity : sparse matrix or None + connectivity : scipy.sparse.spmatrix or None Defines connectivity between features. The matrix is assumed to be symmetric and only the upper triangular half is used. Default is None, i.e, a regular lattice connectivity. @@ -1533,7 +1533,7 @@ def summarize_clusters_stc(clu, p_thresh=0.05, tstep=1e-3, tmin=0, The time of the first sample. subject : str The name of the subject. - vertices : list of arrays | None + vertices : list of array | None The vertex numbers associated with the source space locations. Defaults to None. If None, equals ```[np.arange(10242), np.arange(10242)]```. diff --git a/mne/stats/regression.py b/mne/stats/regression.py index 194a9242e45..dceee79ead5 100644 --- a/mne/stats/regression.py +++ b/mne/stats/regression.py @@ -32,7 +32,7 @@ def linear_regression(inst, design_matrix, names=None): The regressors to be used. Must be a 2d array with as many rows as the first dimension of the data. The first column of this matrix will typically consist of ones (intercept column). - names : list-like | None + names : array-like | None Optional parameter to name the regressors. If provided, the length must correspond to the number of columns present in regressors (including the intercept, if present). @@ -221,7 +221,7 @@ def linear_regression_raw(raw, events, event_id=None, tmin=-.1, tmax=1, picks : None | list List of indices of channels to be included. If None, defaults to all MEG and EEG channels. - solver : str | function + solver : str | callable Either a function which takes as its inputs the sparse predictor matrix X and the observation matrix Y, and returns the coefficient matrix b; or a string. diff --git a/mne/surface.py b/mne/surface.py index 6d6d7373c65..ef53d5347ab 100644 --- a/mne/surface.py +++ b/mne/surface.py @@ -915,7 +915,7 @@ def read_morph_map(subject_from, subject_to, subjects_dir=None, xhemi=False, Returns ------- - left_map, right_map : sparse matrix + left_map, right_map : ~scipy.sparse.csr_matrix The morph maps for the 2 hemispheres. """ subjects_dir = get_subjects_dir(subjects_dir, raise_error=True) diff --git a/mne/tests/test_filter.py b/mne/tests/test_filter.py index 340fbad87c4..215be1620eb 100644 --- a/mne/tests/test_filter.py +++ b/mne/tests/test_filter.py @@ -146,7 +146,7 @@ def test_1d_filter(): @requires_version('scipy', '0.16') def test_iir_stability(): """Test IIR filter stability check.""" - sig = np.empty(1000) + sig = np.random.RandomState(0).rand(1000) sfreq = 1000 # This will make an unstable filter, should throw RuntimeError pytest.raises(RuntimeError, filter_data, sig, sfreq, 0.6, None, diff --git a/mne/time_frequency/csd.py b/mne/time_frequency/csd.py index c7d7a0e46b6..689c42efc66 100644 --- a/mne/time_frequency/csd.py +++ b/mne/time_frequency/csd.py @@ -158,7 +158,7 @@ def sum(self, fmin=None, fmax=None): Returns ------- - csd : Instance of CrossSpectralDensity + csd : instance of CrossSpectralDensity The CSD matrix, summed across the given frequency range(s). """ if self._is_sum: @@ -224,7 +224,7 @@ def mean(self, fmin=None, fmax=None): Returns ------- - csd : Instance of CrossSpectralDensity + csd : instance of CrossSpectralDensity The CSD matrix, averaged across the given frequency range(s). """ csd = self.sum(fmin, fmax) diff --git a/mne/time_frequency/multitaper.py b/mne/time_frequency/multitaper.py index 21912509215..d93f9414b9e 100644 --- a/mne/time_frequency/multitaper.py +++ b/mne/time_frequency/multitaper.py @@ -24,12 +24,12 @@ def dpss_windows(N, half_nbw, Kmax, low_bias=True, interp_from=None, ---------- N : int Sequence length - half_nbw : float, unitless + half_nbw : float Standardized half bandwidth corresponding to 2 * half_bw = BW*f0 - = BW*N/dt but with dt taken as 1 + = BW*N/dt but with dt taken as 1. Kmax : int Number of DPSS windows to return is Kmax (orders 0 through Kmax-1) - low_bias : Bool + low_bias : bool Keep only tapers with eigenvalues > 0.9 interp_from : int (optional) The dpss can be calculated using interpolation from a set of dpss @@ -474,7 +474,7 @@ def tfr_array_multitaper(epoch_data, sfreq, freqs, n_cycles=7.0, The epochs. sfreq : float | int Sampling frequency of the data. - freqs : array-like of floats, shape (n_freqs) + freqs : array-like of float, shape (n_freqs,) The frequencies. n_cycles : float | array of float Number of cycles in the Morlet wavelet. Fixed number or one per @@ -497,7 +497,7 @@ def tfr_array_multitaper(epoch_data, sfreq, freqs, n_cycles=7.0, Decimation may create aliasing artifacts, yet decimation is done after the convolutions. - output : str, defaults to 'complex' + output : str, default 'complex' * 'complex' : single trial complex. * 'power' : single trial power. @@ -510,7 +510,7 @@ def tfr_array_multitaper(epoch_data, sfreq, freqs, n_cycles=7.0, n_jobs : int The number of epochs to process at the same time. The parallelization is implemented across channels. Defaults to 1. - verbose : bool, str, int, or None, defaults to None + verbose : bool, str, int, or None, default None If not None, override default verbose level (see :func:`mne.verbose` and :ref:`Logging documentation ` for more). diff --git a/mne/time_frequency/stft.py b/mne/time_frequency/stft.py index c75e5f64682..7532e954331 100644 --- a/mne/time_frequency/stft.py +++ b/mne/time_frequency/stft.py @@ -14,7 +14,7 @@ def stft(x, wsize, tstep=None, verbose=None): Parameters ---------- - x : 2d array of size n_signals x T + x : array, shape (n_signals, n_times) containing multi-channels signal wsize : int length of the STFT window in samples (must be a multiple of 4) @@ -27,7 +27,7 @@ def stft(x, wsize, tstep=None, verbose=None): Returns ------- - X : 3d array of shape [n_signals, wsize / 2 + 1, n_step] + X : array, shape (n_signals, wsize // 2 + 1, n_step) STFT coefficients for positive frequencies with n_step = ceil(T / tstep) @@ -108,7 +108,7 @@ def istft(X, tstep=None, Tx=None): Parameters ---------- - X : 3d array of shape [n_signals, wsize / 2 + 1, n_step] + X : array, shape (n_signals, wsize / 2 + 1, n_step) The STFT coefficients for positive frequencies tstep : int step between successive windows in samples (must be a multiple of 2, @@ -118,7 +118,7 @@ def istft(X, tstep=None, Tx=None): Returns ------- - x : 1d array of length Tx + x : array, shape (Tx,) vector containing the inverse STFT signal Examples diff --git a/mne/time_frequency/tfr.py b/mne/time_frequency/tfr.py index bc49087dd68..9c1df2d0578 100644 --- a/mne/time_frequency/tfr.py +++ b/mne/time_frequency/tfr.py @@ -45,9 +45,9 @@ def morlet(sfreq, freqs, n_cycles=7.0, sigma=None, zero_mean=False): The sampling Frequency. freqs : array frequency range of interest (1 x Frequencies) - n_cycles: float | array of float, defaults to 7.0 + n_cycles: float | array of float, default 7.0 Number of cycles. Fixed number or one per frequency. - sigma : float, defaults to None + sigma : float, default None It controls the width of the wavelet ie its temporal resolution. If sigma is None the temporal resolution is adapted with the frequency like for all wavelet transform. @@ -55,7 +55,7 @@ def morlet(sfreq, freqs, n_cycles=7.0, sigma=None, zero_mean=False): If sigma is fixed the temporal resolution is fixed like for the short time Fourier transform and the number of oscillations increases with the frequency. - zero_mean : bool, defaults to False + zero_mean : bool, default False Make sure the wavelet has a mean of zero. Returns @@ -103,14 +103,14 @@ def _make_dpss(sfreq, freqs, n_cycles=7., time_bandwidth=4.0, zero_mean=False): The sampling frequency. freqs : ndarray, shape (n_freqs,) The frequencies in Hz. - n_cycles : float | ndarray, shape (n_freqs,), defaults to 7. + n_cycles : float | ndarray, shape (n_freqs,), default 7. The number of cycles globally or for each frequency. - time_bandwidth : float, defaults to 4.0 + time_bandwidth : float, default 4.0 Time x Bandwidth product. The number of good tapers (low-bias) is chosen automatically based on this to equal floor(time_bandwidth - 1). Default is 4.0, giving 3 good tapers. - zero_mean : bool | None, , defaults to False + zero_mean : bool | None, , default False Make sure the wavelet has a mean of zero. @@ -172,7 +172,7 @@ def _cwt(X, Ws, mode="same", decim=1, use_fft=True): Wavelets time series. mode : {'full', 'valid', 'same'} See numpy.convolve. - decim : int | slice, defaults to 1 + decim : int | slice, default 1 To reduce memory usage, decimation factor after time-frequency decomposition. If `int`, returns tfr[..., ::decim]. @@ -180,7 +180,7 @@ def _cwt(X, Ws, mode="same", decim=1, use_fft=True): .. note:: Decimation may create aliasing artifacts. - use_fft : bool, defaults to True + use_fft : bool, default True Use the FFT for convolutions or not. Returns @@ -270,26 +270,26 @@ def _compute_tfr(epoch_data, freqs, sfreq=1.0, method='morlet', The epochs. freqs : array-like of floats, shape (n_freqs) The frequencies. - sfreq : float | int, defaults to 1.0 + sfreq : float | int, default 1.0 Sampling frequency of the data. - method : 'multitaper' | 'morlet', defaults to 'morlet' + method : 'multitaper' | 'morlet', default 'morlet' The time-frequency method. 'morlet' convolves a Morlet wavelet. 'multitaper' uses Morlet wavelets windowed with multiple DPSS multitapers. - n_cycles : float | array of float, defaults to 7.0 + n_cycles : float | array of float, default 7.0 Number of cycles in the Morlet wavelet. Fixed number or one per frequency. - zero_mean : bool | None, defaults to None + zero_mean : bool | None, default None None means True for method='multitaper' and False for method='morlet'. If True, make sure the wavelets have a mean of zero. - time_bandwidth : float, defaults to None + time_bandwidth : float, default None If None and method=multitaper, will be set to 4.0 (3 tapers). Time x (Full) Bandwidth product. Only applies if method == 'multitaper'. The number of good tapers (low-bias) is chosen automatically based on this to equal floor(time_bandwidth - 1). - use_fft : bool, defaults to True + use_fft : bool, default True Use the FFT for convolutions or not. - decim : int | slice, defaults to 1 + decim : int | slice, default 1 To reduce memory usage, decimation factor after time-frequency decomposition. If `int`, returns tfr[..., ::decim]. @@ -299,7 +299,7 @@ def _compute_tfr(epoch_data, freqs, sfreq=1.0, method='morlet', Decimation may create aliasing artifacts, yet decimation is done after the convolutions. - output : str, defaults to 'complex' + output : str, default 'complex' * 'complex' : single trial complex. * 'power' : single trial power. @@ -309,10 +309,10 @@ def _compute_tfr(epoch_data, freqs, sfreq=1.0, method='morlet', * 'avg_power_itc' : average of single trial power and inter-trial coherence across trials. - n_jobs : int, defaults to 1 + n_jobs : int, default 1 The number of epochs to process at the same time. The parallelization is implemented across channels. - verbose : bool, str, int, or None, defaults to None + verbose : bool, str, int, or None, default None If not None, override default verbose level (see :func:`mne.verbose` and :ref:`Logging documentation ` for more). @@ -660,12 +660,12 @@ def tfr_morlet(inst, freqs, n_cycles, use_fft=False, return_itc=True, decim=1, The frequencies in Hz. n_cycles : float | ndarray, shape (n_freqs,) The number of cycles globally or for each frequency. - use_fft : bool, defaults to False + use_fft : bool, default False The fft based convolution or not. - return_itc : bool, defaults to True + return_itc : bool, default True Return inter-trial coherence (ITC) as well as averaged power. Must be ``False`` for evoked data. - decim : int | slice, defaults to 1 + decim : int | slice, default 1 To reduce memory usage, decimation factor after time-frequency decomposition. If `int`, returns tfr[..., ::decim]. @@ -673,16 +673,16 @@ def tfr_morlet(inst, freqs, n_cycles, use_fft=False, return_itc=True, decim=1, .. note:: Decimation may create aliasing artifacts. - n_jobs : int, defaults to 1 + n_jobs : int, default 1 The number of jobs to run in parallel. - picks : array-like of int | None, defaults to None + picks : array-like of int | None, default None The indices of the channels to decompose. If None, all available good data channels are decomposed. - zero_mean : bool, defaults to True + zero_mean : bool, default True Make sure the wavelet has a mean of zero. .. versionadded:: 0.13.0 - average : bool, defaults to True + average : bool, default True If True average across Epochs. .. versionadded:: 0.13.0 @@ -691,7 +691,7 @@ def tfr_morlet(inst, freqs, n_cycles, use_fft=False, return_itc=True, decim=1, average must be False. .. versionadded:: 0.15.0 - verbose : bool, str, int, or None, defaults to None + verbose : bool, str, int, or None, default None If not None, override default verbose level (see :func:`mne.verbose` and :ref:`Logging documentation ` for more). @@ -731,18 +731,18 @@ def tfr_array_morlet(epoch_data, sfreq, freqs, n_cycles=7.0, The epochs. sfreq : float | int Sampling frequency of the data. - freqs : array-like of floats, shape (n_freqs) + freqs : array-like of float, shape (n_freqs,) The frequencies. - n_cycles : float | array of float, defaults to 7.0 + n_cycles : float | array of float, default 7.0 Number of cycles in the Morlet wavelet. Fixed number or one per frequency. zero_mean : bool | False - If True, make sure the wavelets have a mean of zero. Defaults to False. + If True, make sure the wavelets have a mean of zero. default False. use_fft : bool - Use the FFT for convolutions or not. Defaults to True. + Use the FFT for convolutions or not. default True. decim : int | slice To reduce memory usage, decimation factor after time-frequency - decomposition. Defaults to 1 + decomposition. default 1 If `int`, returns tfr[..., ::decim]. If `slice`, returns tfr[..., decim]. @@ -750,7 +750,7 @@ def tfr_array_morlet(epoch_data, sfreq, freqs, n_cycles=7.0, Decimation may create aliasing artifacts, yet decimation is done after the convolutions. - output : str, defaults to 'complex' + output : str, default 'complex' * 'complex' : single trial complex. * 'power' : single trial power. @@ -762,8 +762,8 @@ def tfr_array_morlet(epoch_data, sfreq, freqs, n_cycles=7.0, n_jobs : int The number of epochs to process at the same time. The parallelization - is implemented across channels. Defaults to 1 - verbose : bool, str, int, or None, defaults to None + is implemented across channels. default 1 + verbose : bool, str, int, or None, default None If not None, override default verbose level (see :func:`mne.verbose` and :ref:`Logging documentation ` for more). @@ -810,19 +810,19 @@ def tfr_multitaper(inst, freqs, n_cycles, time_bandwidth=4.0, n_cycles : float | ndarray, shape (n_freqs,) The number of cycles globally or for each frequency. The time-window length is thus T = n_cycles / freq. - time_bandwidth : float, (optional), defaults to 4.0 (3 good tapers). + time_bandwidth : float, (optional), default 4.0 (n_tapers=3). Time x (Full) Bandwidth product. Should be >= 2.0. Choose this along with n_cycles to get desired frequency resolution. The number of good tapers (least leakage from far away frequencies) is chosen automatically based on this to floor(time_bandwidth - 1). E.g., With freq = 20 Hz and n_cycles = 10, we get time = 0.5 s. If time_bandwidth = 4., then frequency smoothing is (4 / time) = 8 Hz. - use_fft : bool, defaults to True + use_fft : bool, default True The fft based convolution or not. - return_itc : bool, defaults to True + return_itc : bool, default True Return inter-trial coherence (ITC) as well as averaged (or single-trial) power. - decim : int | slice, defaults to 1 + decim : int | slice, default 1 To reduce memory usage, decimation factor after time-frequency decomposition. If `int`, returns tfr[..., ::decim]. @@ -830,16 +830,16 @@ def tfr_multitaper(inst, freqs, n_cycles, time_bandwidth=4.0, .. note:: Decimation may create aliasing artifacts. - n_jobs : int, defaults to 1 + n_jobs : int, default 1 The number of jobs to run in parallel. - picks : array-like of int | None, defaults to None + picks : array-like of int | None, default None The indices of the channels to decompose. If None, all available good data channels are decomposed. - average : bool, defaults to True + average : bool, default True If True average across Epochs. .. versionadded:: 0.13.0 - verbose : bool, str, int, or None, defaults to None + verbose : bool, str, int, or None, default None If not None, override default verbose level (see :func:`mne.verbose` and :ref:`Logging documentation ` for more). @@ -917,7 +917,7 @@ def apply_baseline(self, baseline, mode='mean', verbose=None): Parameters ---------- - baseline : tuple or list of length 2 + baseline : array-like, shape (2,) The time interval to apply rescaling / baseline correction. If None do not apply it. If baseline is (a, b) the interval is between "a (s)" and "b (s)". @@ -960,7 +960,7 @@ def save(self, fname, overwrite=False): fname : str The file name, which should end with -tfr.h5 . overwrite : bool - If True, overwrite file (if it exists). Defaults to false + If True, overwrite file (if it exists). Defaults to False """ write_tfrs(fname, self, overwrite=overwrite) @@ -983,9 +983,9 @@ class AverageTFR(_BaseTFR): The frequencies in Hz. nave : int The number of averaged TFRs. - comment : str | None, defaults to None + comment : str | None, default None Comment on the data, e.g., the experimental condition. - method : str | None, defaults to None + method : str | None, default None Comment on the method used to compute the data, e.g., morlet wavelet. verbose : bool, str, int, or None If not None, override default verbose level (see :func:`mne.verbose` @@ -995,26 +995,19 @@ class AverageTFR(_BaseTFR): ---------- info : instance of Info Measurement info. - ch_names : list The names of the channels. - nave : int Number of averaged epochs. - data : ndarray, shape (n_channels, n_freqs, n_times) The data array. - times : ndarray, shape (n_times,) The time values in seconds. - freqs : ndarray, shape (n_freqs,) The frequencies in Hz. - - comment : string + comment : str Comment on dataset. Can be the condition. - - method : str | None, defaults to None + method : str | None, default None Comment on the method used to compute the data, e.g., morlet wavelet. """ @@ -1057,7 +1050,7 @@ def plot(self, picks=None, baseline=None, mode='mean', tmin=None, picks : None | array-like of int The indices of the channels to plot, one figure per channel. If None, plot the across-channel average. - baseline : None (default) or tuple of length 2 + baseline : None (default) or tuple, shape (2,) The time interval to apply baseline correction. If None do not apply it. If baseline is (a, b) the interval is between "a (s)" and "b (s)". @@ -1278,7 +1271,7 @@ def plot_joint(self, timefreqs=None, picks=None, baseline=None, Parameters ---------- - timefreqs : None | list of tuples | dict of tuples + timefreqs : None | list of tuple | dict of tuple The time-frequency point(s) for which topomaps will be plotted. See Notes. picks : None | array-like of int @@ -1721,12 +1714,12 @@ def plot_topo(self, picks=None, baseline=None, mode='mean', tmin=None, Call pyplot.show() at the end. border : str matplotlib borders style to be used for each sensor plot. - fig_facecolor : str | obj + fig_facecolor : color The figure face color. Defaults to black. fig_background : None | array A background image for the figure. This must be a valid input to `matplotlib.pyplot.imshow`. Defaults to None. - font_color: str | obj + font_color: color The color of tick labels in the colorbar. Defaults to white. yscale : 'auto' (default) | 'linear' | 'log' The scale of y (frequency) axis. 'linear' gives linear y axis, @@ -1971,9 +1964,9 @@ class EpochsTFR(_BaseTFR, GetEpochsMixin): The time values in seconds. freqs : ndarray, shape (n_freqs,) The frequencies in Hz. - comment : str | None, defaults to None + comment : str | None, default None Comment on the data, e.g., the experimental condition. - method : str | None, defaults to None + method : str | None, default None Comment on the method used to compute the data, e.g., morlet wavelet. events : ndarray, shape (n_events, 3) | None The events as stored in the Epochs class. If None (default), all event @@ -2004,13 +1997,13 @@ class EpochsTFR(_BaseTFR, GetEpochsMixin): The frequencies in Hz. comment : string Comment on dataset. Can be the condition. - method : str | None, defaults to None + method : str | None, default None Comment on the method used to compute the data, e.g., morlet wavelet. events : ndarray, shape (n_events, 3) | None Array containing sample information as event_id event_id : dict | None Names of conditions correspond to event_ids - metadata : DataFrame, shape (n_events, n_cols) | None + metadata : pandas.DataFrame, shape (n_events, n_cols) | None DataFrame containing pertinent information for each trial Notes ----- diff --git a/mne/utils/_logging.py b/mne/utils/_logging.py index e536552b976..ff6d8a5f794 100644 --- a/mne/utils/_logging.py +++ b/mne/utils/_logging.py @@ -32,12 +32,12 @@ def verbose(function, *args, **kwargs): Parameters ---------- - function : function + function : callable Function to be decorated by setting the verbosity level. Returns ------- - dec : function + dec : callable The decorated function Examples diff --git a/mne/utils/check.py b/mne/utils/check.py index 7ca32489b9d..d51d343bdcf 100644 --- a/mne/utils/check.py +++ b/mne/utils/check.py @@ -297,7 +297,7 @@ def _validate_type(item, types=None, item_name=None, type_name=None): Parameters ---------- - item : obj + item : object The thing to be checked. types : type | tuple of types | str The types to be checked against. If str, must be one of 'str', 'int', diff --git a/mne/utils/numerics.py b/mne/utils/numerics.py index 643482dbc6b..922aeb0131f 100644 --- a/mne/utils/numerics.py +++ b/mne/utils/numerics.py @@ -494,7 +494,7 @@ def grand_average(all_inst, interpolate_bads=True, drop_bads=True): Parameters ---------- - all_inst : list of Evoked or AverageTFR data + all_inst : list of Evoked or AverageTFR The evoked datasets. interpolate_bads : bool If True, bad MEG and EEG channels are interpolated. Ignored for diff --git a/mne/viz/_3d.py b/mne/viz/_3d.py index 614096bd781..62940955090 100644 --- a/mne/viz/_3d.py +++ b/mne/viz/_3d.py @@ -89,7 +89,7 @@ def plot_head_positions(pos, mode='traces', cmap='viridis', direction='z', Can be 'traces' (default) to show position and quaternion traces, or 'field' to show the position as a vector field over time. The 'field' mode requires matplotlib 1.4+. - cmap : matplotlib Colormap + cmap : colormap Colormap to use for the trace plot, default is "viridis". direction : str Can be any combination of "x", "y", or "z" (default: "z") to show @@ -120,7 +120,7 @@ def plot_head_positions(pos, mode='traces', cmap='viridis', direction='z', Returns ------- - fig : Instance of matplotlib.figure.Figure + fig : instance of matplotlib.figure.Figure The figure. """ from ..chpi import head_pos_to_trans_rot_t @@ -327,7 +327,7 @@ def plot_evoked_field(evoked, surf_maps, time=None, time_label='t = %0.0f ms', Returns ------- - fig : instance of mlab.Figure + fig : instance of mayavi.mlab.Figure The mayavi figure. """ types = [t for t in ['eeg', 'grad', 'mag'] if t in evoked] @@ -463,7 +463,7 @@ def _plot_mri_contours(mri_fname, surf_fnames, orientation='coronal', Returns ------- - fig : Instance of matplotlib.figure.Figure | list + fig : instance of matplotlib.figure.Figure | list The figure. Will instead be a list of png images if img_output is a tuple. """ @@ -615,7 +615,7 @@ def plot_alignment(info, trans=None, subject=None, subjects_dir=None, Plot MRI fiducials (default False). If ``True``, look for a file with the canonical name (``bem/{subject}-fiducials.fif``). If ``str`` it should provide the full path to the fiducials file. - bem : list of dict | Instance of ConductorModel | None + bem : list of dict | instance of ConductorModel | None Can be either the BEM surfaces (list of dict), a BEM solution or a sphere model. If None, we first try loading `'$SUBJECTS_DIR/$SUBJECT/bem/$SUBJECT-$SOURCE.fif'`, and then look for @@ -632,8 +632,8 @@ def plot_alignment(info, trans=None, subject=None, subjects_dir=None, * MEG in blue (if MEG sensors are present) .. versionadded:: 0.16 - fig : mayavi figure object | None - Mayavi Scene (instance of mlab.Figure) in which to plot the alignment. + fig : mayavi.mlab.Figure | None + Mayavi Scene in which to plot the alignment. If ``None``, creates a new 600x600 pixel figure with black background. .. versionadded:: 0.16 @@ -648,7 +648,7 @@ def plot_alignment(info, trans=None, subject=None, subjects_dir=None, Returns ------- - fig : instance of mlab.Figure + fig : instance of mayavi.mlab.Figure The mayavi figure. See Also @@ -1591,7 +1591,7 @@ def plot_source_estimates(stc, subject=None, surface='inflated', hemi='lh', foreground="white", initial_time=None, time_unit='s', backend='auto', spacing='oct6', title=None, verbose=None): - """Plot SourceEstimates with PySurfer. + """Plot SourceEstimate with PySurfer. By default this function uses :mod:`mayavi.mlab` to plot the source estimates. If Mayavi is not installed, the plotting is done with @@ -1599,7 +1599,7 @@ def plot_source_estimates(stc, subject=None, surface='inflated', hemi='lh', Parameters ---------- - stc : SourceEstimates + stc : SourceEstimate The source estimates to plot. subject : str | None The subject name corresponding to FreeSurfer environment @@ -1630,14 +1630,14 @@ def plot_source_estimates(stc, subject=None, surface='inflated', hemi='lh', subjects_dir : str The path to the freesurfer subjects reconstructions. It corresponds to Freesurfer environment variable SUBJECTS_DIR. - figure : instance of mayavi.core.scene.Scene | instance of matplotlib.figure.Figure | list | int | None + figure : instance of mayavi.core.api.Scene | instance of matplotlib.figure.Figure | list | int | None If None, a new figure will be created. If multiple views or a split view is requested, this must be a list of the appropriate length. If int is provided it will be used to identify the Mayavi figure by it's id or create a new figure with the given id. If an instance of matplotlib figure, mpl backend is used for plotting. views : str | list - View to use. See surfer.Brain(). Supported views: ['lat', 'med', 'ros', + View to use. See `surfer.Brain`. Supported views: ['lat', 'med', 'ros', 'cau', 'dor' 'ven', 'fro', 'par']. Using multiple views is not supported for mpl backend. colorbar : bool @@ -1663,7 +1663,7 @@ def plot_source_estimates(stc, subject=None, surface='inflated', hemi='lh', 'classic', 'bone', 'low_contrast', or 'high_contrast'), or the name of mayavi colormap, or a tuple with values (colormap, min, max, reverse) to fully specify the curvature colors. Has no effect with mpl backend. - size : float or pair of floats + size : float or tuple of float The size of the window, in pixels. can be one number to specify a square window, or the (width, height) of a rectangular window. Has no effect with mpl backend. @@ -1702,7 +1702,7 @@ def plot_source_estimates(stc, subject=None, surface='inflated', hemi='lh', Returns ------- - figure : surfer.viz.Brain | matplotlib.figure.Figure + figure : instance of surfer.Brain | matplotlib.figure.Figure An instance of :class:`surfer.Brain` from PySurfer or matplotlib figure. """ # noqa: E501 @@ -2141,7 +2141,7 @@ def plot_vector_source_estimates(stc, subject=None, hemi='lh', colormap='hot', size=800, background='black', foreground='white', initial_time=None, time_unit='s'): - """Plot VectorSourceEstimates with PySurfer. + """Plot VectorSourceEstimate with PySurfer. A "glass brain" is drawn and all dipoles defined in the source estimate are shown using arrows, depicting the direction and magnitude of the @@ -2185,13 +2185,13 @@ def plot_vector_source_estimates(stc, subject=None, hemi='lh', colormap='hot', subjects_dir : str The path to the freesurfer subjects reconstructions. It corresponds to Freesurfer environment variable SUBJECTS_DIR. - figure : instance of mayavi.core.scene.Scene | list | int | None + figure : instance of mayavi.core.api.Scene | list | int | None If None, a new figure will be created. If multiple views or a split view is requested, this must be a list of the appropriate length. If int is provided it will be used to identify the Mayavi figure by it's id or create a new figure with the given id. views : str | list - View to use. See surfer.Brain(). + View to use. See `surfer.Brain`. colorbar : bool If True, display colorbar on scene. clim : str | dict @@ -2211,7 +2211,7 @@ def plot_vector_source_estimates(stc, subject=None, hemi='lh', colormap='hot', 'classic', 'bone', 'low_contrast', or 'high_contrast'), or the name of mayavi colormap, or a tuple with values (colormap, min, max, reverse) to fully specify the curvature colors. - size : float or pair of floats + size : float or tuple of float The size of the window, in pixels. can be one number to specify a square window, or the (width, height) of a rectangular window. background : matplotlib color @@ -2227,7 +2227,7 @@ def plot_vector_source_estimates(stc, subject=None, hemi='lh', colormap='hot', Returns ------- - brain : Brain + brain : surfer.Brain A instance of :class:`surfer.Brain` from PySurfer. Notes @@ -2338,11 +2338,11 @@ def plot_sparse_source_estimates(src, stcs, colors=None, linewidth=2, Show figures if True. high_resolution : bool If True, plot on the original (non-downsampled) cortical mesh. - fig_name : + fig_name : str Mayavi figure name. - fig_number : + fig_number : int Matplotlib figure number. - labels : ndarray or list of ndarrays + labels : ndarray or list of ndarray Labels to show sources in clusters. Sources with the same label and the waveforms within each cluster are presented in the same color. labels should be a list of ndarrays when @@ -2360,7 +2360,7 @@ def plot_sparse_source_estimates(src, stcs, colors=None, linewidth=2, Returns ------- - surface : instance of mlab Surface + surface : instance of mayavi.mlab.pipeline.surface The triangular mesh surface. """ mlab = _import_mlab() @@ -2561,7 +2561,7 @@ def plot_dipole_locations(dipoles, trans, subject, subjects_dir=None, Returns ------- - fig : instance of mlab.Figure or matplotlib Figure + fig : instance of mayavi.mlab.Figure or matplotlib.figure.Figure The mayavi figure or matplotlib Figure. Notes @@ -2588,12 +2588,13 @@ def snapshot_brain_montage(fig, montage, hide_sensors=True): Parameters ---------- - fig : instance of Mayavi Scene + fig : instance of ~mayavi.core.api.Scene The figure on which you've plotted electrodes using :func:`mne.viz.plot_alignment`. - montage : instance of `DigMontage` or `Info` | dict of ch: xyz mappings. + montage : instance of DigMontage or Info | dict The digital montage for the electrodes plotted in the scene. If `Info`, channel positions will be pulled from the `loc` field of `chs`. + dict should have ch:xyz mappings. hide_sensors : bool Whether to remove the spheres in the scene before taking a snapshot. diff --git a/mne/viz/circle.py b/mne/viz/circle.py index 87ef7aa50dd..e4c43c647a8 100644 --- a/mne/viz/circle.py +++ b/mne/viz/circle.py @@ -41,7 +41,7 @@ def circular_layout(node_names, node_order, start_pos=90, start_between=True, Returns ------- - node_angles : array, shape=(len(node_names,)) + node_angles : array, shape=(n_node_names,) Node angles in degrees. """ n_nodes = len(node_names) @@ -139,19 +139,19 @@ def plot_connectivity_circle(con, node_names, indices=None, n_lines=None, indices. node_names : list of str Node names. The order corresponds to the order in con. - indices : tuple of arrays | None + indices : tuple of array | None Two arrays with indices of connections for which the connections strengths are defined in con. Only needed if con is a 1D array. n_lines : int | None If not None, only the n_lines strongest connections (strength=abs(con)) are drawn. - node_angles : array, shape=(len(node_names,)) | None + node_angles : array, shape (n_node_names,) | None Array with node positions in degrees. If None, the nodes are equally spaced on the circle. See mne.viz.circular_layout. node_width : float | None Width of each node in degrees. If None, the minimum angle between any two nodes is used as the width. - node_colors : list of tuples | list of str + node_colors : list of tuple | list of str List with the color to use for each node. If fewer colors than nodes are provided, the colors will be repeated. Any color supported by matplotlib can be used, e.g., RGBA tuples, named colors. @@ -175,7 +175,7 @@ def plot_connectivity_circle(con, node_names, indices=None, n_lines=None, The figure title. colorbar_size : float Size of the colorbar. - colorbar_pos : 2-tuple + colorbar_pos : tuple, shape (2,) Position of the colorbar. fontsize_title : int Font size to use for title. @@ -185,10 +185,10 @@ def plot_connectivity_circle(con, node_names, indices=None, n_lines=None, Font size to use for colorbar. padding : float Space to add around figure to accommodate long labels. - fig : None | instance of matplotlib.pyplot.Figure + fig : None | instance of matplotlib.figure.Figure The figure to use. If None, a new figure with the specified background color will be created. - subplot : int | 3-tuple + subplot : int | tuple, shape (3,) Location of the subplot when creating figures with multiple plots. E.g. 121 or (1, 2, 1) for 1 row, 2 columns, plot 1. See matplotlib.pyplot.subplot. @@ -202,9 +202,9 @@ def plot_connectivity_circle(con, node_names, indices=None, n_lines=None, Returns ------- - fig : instance of matplotlib.pyplot.Figure + fig : instance of matplotlib.figure.Figure The figure handle. - axes : instance of matplotlib.axes.PolarAxesSubplot + axes : instance of matplotlib.projections.polar.PolarAxes The subplot handle. Notes diff --git a/mne/viz/epochs.py b/mne/viz/epochs.py index 1b7d06b9f8f..166c5946439 100644 --- a/mne/viz/epochs.py +++ b/mne/viz/epochs.py @@ -76,7 +76,7 @@ def plot_epochs_image(epochs, picks=None, sigma=0., vmin=None, The scalings of the channel types to be applied for plotting. If None, defaults to `scalings=dict(eeg=1e6, grad=1e13, mag=1e15, eog=1e6)`. - cmap : None | matplotlib colormap | (colormap, bool) | 'interactive' + cmap : None | colormap | (colormap, bool) | 'interactive' Colormap. If tuple, the first value indicates the colormap to use and the second value is a boolean defining interactivity. In interactive mode the colors are adjustable by clicking and dragging the colorbar @@ -86,11 +86,11 @@ def plot_epochs_image(epochs, picks=None, sigma=0., vmin=None, colormap. If 'interactive', translates to ('RdBu_r', True). If None, "RdBu_r" is used, unless the data is all positive, in which case "Reds" is used. - fig : matplotlib figure | None + fig : Figure | None Figure instance to draw the image to. Figure must contain two axes for drawing the single trials and evoked responses. If None a new figure is created. Defaults to None. - axes : list of matplotlib axes | dict of lists of matplotlib Axes | None + axes : list of Axes | dict of list of Axes | None List of axes instances to draw the image, erp and colorbar to. Must be of length three if colorbar is True (with the last list element being the colorbar axes) or two if colorbar is False. If both fig and @@ -132,7 +132,7 @@ def plot_epochs_image(epochs, picks=None, sigma=0., vmin=None, If not None, combine must not be None. Defaults to `None` if picks are provided, otherwise 'type'. - evoked : Bool + evoked : bool Draw the ER[P/F] below the image or not. ts_args : dict Arguments passed to a call to `mne.viz.plot_compare_evoked` to style @@ -146,7 +146,7 @@ def plot_epochs_image(epochs, picks=None, sigma=0., vmin=None, Returns ------- - figs : lists of matplotlib figures + figs : list of Figure One figure per channel displayed. """ units = _handle_default('units', units) @@ -552,7 +552,7 @@ def plot_drop_log(drop_log, threshold=0, n_max_plot=20, subject='Unknown', Parameters ---------- - drop_log : list of lists + drop_log : list of list Epoch drop log from Epochs.drop_log. threshold : float The percentage threshold to use to decide whether or not to @@ -572,7 +572,7 @@ def plot_drop_log(drop_log, threshold=0, n_max_plot=20, subject='Unknown', Returns ------- - fig : Instance of matplotlib.figure.Figure + fig : instance of matplotlib.figure.Figure The figure. """ import matplotlib.pyplot as plt @@ -781,7 +781,7 @@ def plot_epochs(epochs, picks=None, scalings=None, n_epochs=20, n_channels=20, Returns ------- - fig : Instance of matplotlib.figure.Figure + fig : instance of matplotlib.figure.Figure The figure. Notes @@ -865,7 +865,7 @@ def plot_epochs_psd(epochs, fmin=0, fmax=np.inf, tmin=None, tmax=None, the signal (as in nitime). picks : array-like of int | None List of channels to use. - ax : instance of matplotlib Axes | None + ax : instance of Axes | None Axes to plot into. If None, axes will be created. color : str | tuple A matplotlib-compatible color to use. @@ -888,7 +888,7 @@ def plot_epochs_psd(epochs, fmin=0, fmax=np.inf, tmin=None, tmax=None, Returns ------- - fig : instance of matplotlib figure + fig : instance of Figure Figure distributing one image per channel across sensor topography. """ from .raw import _set_psd_plot_params, _convert_psds diff --git a/mne/viz/evoked.py b/mne/viz/evoked.py index 7f70c064681..022c728566f 100644 --- a/mne/viz/evoked.py +++ b/mne/viz/evoked.py @@ -651,7 +651,7 @@ def plot_evoked(evoked, picks=None, exclude='bads', unit=True, show=True, If true SSP projections are applied before display. If 'interactive', a check box for reversible selection of SSP projection vectors will be shown. - hline : list of floats | None + hline : list of float | None The values at which to show an horizontal line. units : dict | None The units of the channel types used for axes labels. If None, @@ -662,7 +662,7 @@ def plot_evoked(evoked, picks=None, exclude='bads', unit=True, show=True, titles : dict | None The titles associated with the channels. If None, defaults to `dict(eeg='EEG', grad='Gradiometers', mag='Magnetometers')`. - axes : instance of Axis | list | None + axes : instance of Axes | list | None The axes to plot to. If list, the list must be a list of Axes of the same length as the number of channel types. If instance of Axes, there must be only one channel type plotted. @@ -756,7 +756,7 @@ def plot_evoked_topo(evoked, layout=None, layout_scale=0.945, color=None, layout_scale: float Scaling factor for adjusting the relative size of the layout on the canvas - color : list of color objects | color object | None + color : list of color | color | None Everything matplotlib accepts to specify colors. If not list-like, the color specified will be repeated. If None, colors are automatically drawn. @@ -777,9 +777,9 @@ def plot_evoked_topo(evoked, layout=None, layout_scale=0.945, color=None, If true SSP projections are applied before display. If 'interactive', a check box for reversible selection of SSP projection vectors will be shown. - vline : list of floats | None + vline : list of float | None The values at which to show a vertical line. - fig_background : None | numpy ndarray + fig_background : None | ndarray A background image for the figure. This must work with a call to plt.imshow. Defaults to None. merge_grads : bool @@ -795,7 +795,7 @@ def plot_evoked_topo(evoked, layout=None, layout_scale=0.945, color=None, See matplotlib documentation for more details. axes : instance of matplotlib Axes | None Axes to plot into. If None, axes will be created. - background_color : str | obj + background_color : color Background color. Typically 'k' (black) or 'w' (white; default). .. versionadded:: 0.15.0 @@ -890,7 +890,7 @@ def plot_evoked_image(evoked, picks=None, exclude='bads', unit=True, titles : dict | None The titles associated with the channels. If None, defaults to ``dict(eeg='EEG', grad='Gradiometers', mag='Magnetometers')``. - axes : instance of Axis | list | dict | None + axes : instance of Axes | list | dict | None The axes to plot to. If list, the list must be a list of Axes of the same length as the number of channel types. If instance of Axes, there must be only one channel type plotted. @@ -1277,7 +1277,7 @@ def plot_evoked_joint(evoked, times="peaks", title='', picks=None, ---------- evoked : instance of Evoked The evoked instance. - times : float | array of floats | "auto" | "peaks" + times : float | array of float | "auto" | "peaks" The time point(s) to plot. If "auto", 5 evenly spaced topographies between the first and last time instant will be shown. If "peaks", finds time points automatically by checking for 3 local maxima in @@ -1825,7 +1825,7 @@ def plot_compare_evokeds(evokeds, picks=None, gfp=False, colors=None, Returns ------- - fig : Figure | list of Figures + fig : Figure | list of Figure The figure(s) in which the plot is drawn. When plotting multiple channel types, a list of figures, one for each channel type is returned. diff --git a/mne/viz/ica.py b/mne/viz/ica.py index 2cb8857c80c..87b0910d0c2 100644 --- a/mne/viz/ica.py +++ b/mne/viz/ica.py @@ -44,10 +44,10 @@ def plot_ica_sources(ica, inst, picks=None, exclude=None, start=None, The ICA solution. inst : instance of mne.io.Raw, mne.Epochs, mne.Evoked The object to plot the sources from. - picks : int | array_like of int | None. + picks : int | array-like of int | None The components to be displayed. If None, plot will show the sources in the order as fitted. - exclude : array_like of int + exclude : array-like of int The components marked for exclusion. If None (default), ICA.exclude will be used. start : int @@ -68,7 +68,7 @@ def plot_ica_sources(ica, inst, picks=None, exclude=None, start=None, Returns ------- - fig : instance of pyplot.Figure + fig : instance of Figure The figure. Notes @@ -272,7 +272,7 @@ def plot_ica_properties(ica, inst, picks=None, axes=None, dB=True, psd_args : dict | None Dictionary of arguments to ``psd_multitaper``. If None, doesn't pass any additional arguments. Defaults to None. - figsize : array-like of size (2,) | None + figsize : array-like, shape (2,) | None Allows to control size of the figure. If None, the figure size defaults to [7., 6.]. show : bool @@ -393,10 +393,10 @@ def _plot_ica_sources_evoked(evoked, picks, exclude, title, show, ica, ---------- evoked : instance of mne.Evoked The Evoked to be used. - picks : int | array_like of int | None. + picks : int | array-like of int | None. The components to be displayed. If None, plot will show the sources in the order as fitted. - exclude : array_like of int + exclude : array-like of int The components marked for exclusion. If None (default), ICA.exclude will be used. title : str @@ -508,9 +508,9 @@ def plot_ica_scores(ica, scores, exclude=None, labels=None, axhline=None, ---------- ica : instance of mne.preprocessing.ICA The ICA object. - scores : array_like of float, shape (n ica components) | list of arrays + scores : array-like of float, shape (n_ica_components,) | list of array Scores based on arbitrary metric to characterize ICA components. - exclude : array_like of int + exclude : array-like of int The components marked for exclusion. If None (default), ICA.exclude will be used. labels : str | list | 'ecg' | 'eog' | None @@ -530,7 +530,7 @@ def plot_ica_scores(ica, scores, exclude=None, labels=None, axhline=None, Returns ------- - fig : instance of matplotlib.pyplot.Figure + fig : instance of Figure The figure object """ import matplotlib.pyplot as plt @@ -611,7 +611,7 @@ def plot_ica_overlay(ica, inst, exclude=None, picks=None, start=None, sources will be canceled out this display is sensitive to artifacts. If evoked input, butterfly plots for clean and raw signals will be superimposed. - exclude : array_like of int | None (default) + exclude : array-like of int | None (default) The components marked for exclusion. If None (default), ICA.exclude will be used. picks : array-like of int | None (default) @@ -628,7 +628,7 @@ def plot_ica_overlay(ica, inst, exclude=None, picks=None, start=None, Returns ------- - fig : instance of pyplot.Figure + fig : instance of Figure The figure. """ # avoid circular imports @@ -687,7 +687,7 @@ def _plot_ica_overlay_raw(data, data_cln, times, title, ch_types_used, show): Returns ------- - fig : instance of pyplot.Figure + fig : instance of Figure """ import matplotlib.pyplot as plt # Restore sensor space data and keep all PCA components @@ -730,7 +730,7 @@ def _plot_ica_overlay_evoked(evoked, evoked_cln, title, show): Returns ------- - fig : instance of pyplot.Figure + fig : instance of Figure """ import matplotlib.pyplot as plt ch_types_used = [c for c in ['mag', 'grad', 'eeg'] if c in evoked] diff --git a/mne/viz/misc.py b/mne/viz/misc.py index 747099c4ea4..21ca96832fe 100644 --- a/mne/viz/misc.py +++ b/mne/viz/misc.py @@ -61,9 +61,9 @@ def plot_cov(cov, info, exclude=[], colorbar=True, proj=False, show_svd=True, Returns ------- - fig_cov : instance of matplotlib.pyplot.Figure + fig_cov : instance of matplotlib.figure.Figure The covariance plot. - fig_svd : instance of matplotlib.pyplot.Figure | None + fig_svd : instance of matplotlib.figure.Figure | None The SVD spectra plot of the covariance. """ if exclude == 'bads': @@ -376,7 +376,7 @@ def plot_bem(subject=None, subjects_dir=None, orientation='coronal', Returns ------- - fig : Instance of matplotlib.figure.Figure + fig : instance of matplotlib.figure.Figure The figure. See Also @@ -463,7 +463,7 @@ def plot_events(events, sfreq=None, first_samp=0, color=None, event_id=None, Dictionary of event label (e.g. 'aud_l') and its associated event_id value. Label used to plot a legend. If None, no legend is drawn. - axes : instance of matplotlib.axes.AxesSubplot + axes : instance of Axes The subplot handle. equal_spacing : bool Use equal spacing between events in y-axis. @@ -579,9 +579,9 @@ def plot_dipole_amplitudes(dipoles, colors=None, show=True): Parameters ---------- - dipoles : list of instance of Dipoles + dipoles : list of instance of Dipole The dipoles whose amplitudes should be shown. - colors: list of colors | None + colors: list of color | None Color to plot with each dipole. If None default colors are used. show : bool Show figure if True. @@ -803,7 +803,7 @@ def plot_ideal_filter(freq, gain, axes=None, title='', flim=None, fscale='log', The ideal response frequencies to plot (must be in ascending order). gain : array-like or None The ideal response gains to plot. - axes : instance of matplotlib.axes.AxesSubplot | None + axes : instance of Axes | None The subplot handle. With None (default), axes are created. title : str The title to use, (default: ''). @@ -825,7 +825,7 @@ def plot_ideal_filter(freq, gain, axes=None, title='', flim=None, fscale='log', Returns ------- - fig : Instance of matplotlib.figure.Figure + fig : instance of matplotlib.figure.Figure The figure. See Also @@ -947,7 +947,7 @@ def plot_csd(csd, info=None, mode='csd', colorbar=True, cmap=None, Returns ------- - fig : list of matplotlib figures + fig : list of Figure The figures created by this function. """ import matplotlib.pyplot as plt diff --git a/mne/viz/montage.py b/mne/viz/montage.py index 021c39199fb..56a90fdf726 100644 --- a/mne/viz/montage.py +++ b/mne/viz/montage.py @@ -24,7 +24,7 @@ def plot_montage(montage, scale_factor=20, show_names=True, kind='topomap', Returns ------- - fig : Instance of matplotlib.figure.Figure + fig : instance of matplotlib.figure.Figure The figure object. """ from scipy.spatial.distance import cdist diff --git a/mne/viz/raw.py b/mne/viz/raw.py index f61f15fa5cc..7861eca44fc 100644 --- a/mne/viz/raw.py +++ b/mne/viz/raw.py @@ -232,7 +232,7 @@ def plot_raw(raw, events=None, duration=10.0, start=0.0, n_channels=20, Returns ------- - fig : Instance of matplotlib.figure.Figure + fig : instance of matplotlib.figure.Figure Raw traces. Notes @@ -670,7 +670,7 @@ def plot_raw_psd(raw, tmin=0., tmax=np.inf, fmin=0, fmax=np.inf, proj=False, Parameters ---------- - raw : instance of io.Raw + raw : instance of Raw The raw instance to use. tmin : float Start time for calculations. @@ -746,7 +746,7 @@ def plot_raw_psd(raw, tmin=0., tmax=np.inf, fmin=0, fmax=np.inf, proj=False, Returns ------- - fig : instance of matplotlib figure + fig : instance of Figure Figure with frequency spectra of the data channels. """ from matplotlib.ticker import ScalarFormatter @@ -1157,7 +1157,7 @@ def plot_raw_psd_topo(raw, tmin=0., tmax=None, fmin=0., fmax=100., proj=False, Returns ------- - fig : instance of matplotlib figure + fig : instance of matplotlib.figure.Figure Figure distributing one image per channel across sensor topography. """ if layout is None: diff --git a/mne/viz/topo.py b/mne/viz/topo.py index 076f50141ce..9d338710740 100644 --- a/mne/viz/topo.py +++ b/mne/viz/topo.py @@ -49,11 +49,11 @@ def iter_topography(info, layout=None, on_pick=None, fig=None, fig : matplotlib.figure.Figure | None The figure object to be considered. If None, a new figure will be created. - fig_facecolor : str | obj + fig_facecolor : color The figure face color. Defaults to black. - axis_facecolor : str | obj + axis_facecolor : color The axis face color. Defaults to black. - axis_spinecolor : str | obj + axis_spinecolor : color The axis spine color. Defaults to black. In other words, the color of the axis' edge lines. layout_scale: float | None @@ -583,14 +583,14 @@ def _plot_evoked_topo(evoked, layout=None, layout_scale=0.945, color=None, The values at which to show a vertical line. hline : list of floats | None The values at which to show a horizontal line. - fig_facecolor : str | obj + fig_facecolor : color The figure face color. Defaults to black. fig_background : None | array A background image for the figure. This must be a valid input to `matplotlib.pyplot.imshow`. Defaults to None. - axis_facecolor : str | obj + axis_facecolor : color The face color to be used for each sensor plot. Defaults to black. - font_color : str | obj + font_color : color The color of text in the colorbar and title. Defaults to white. merge_grads : bool Whether to use RMS value of gradiometer pairs. Only works for Neuromag @@ -616,7 +616,7 @@ def _plot_evoked_topo(evoked, layout=None, layout_scale=0.945, color=None, Returns ------- - fig : Instance of matplotlib.figure.Figure + fig : instance of matplotlib.figure.Figure Images of evoked responses at sensor locations """ import matplotlib.pyplot as plt @@ -826,7 +826,7 @@ def plot_topo_image_epochs(epochs, layout=None, sigma=0., vmin=None, the number of good epochs. If it's a callable the arguments passed are the times vector and the data as 2d array (data.shape[1] == len(times)). - cmap : instance of matplotlib.pyplot.colormap + cmap : colormap Colors to be mapped to the values. layout_scale: float scaling factor for adjusting the relative size of the layout @@ -838,19 +838,19 @@ def plot_topo_image_epochs(epochs, layout=None, sigma=0., vmin=None, None, defaults to `dict(eeg=1e6, grad=1e13, mag=1e15)`. border : str matplotlib borders style to be used for each sensor plot. - fig_facecolor : str | obj + fig_facecolor : color The figure face color. Defaults to black. fig_background : None | array A background image for the figure. This must be a valid input to `matplotlib.pyplot.imshow`. Defaults to None. - font_color : str | obj + font_color : color The color of tick labels in the colorbar. Defaults to white. show : bool Show figure if True. Returns ------- - fig : instance of matplotlib figure + fig : instance of matplotlib.figure.Figure Figure distributing one image per channel across sensor topography. """ scalings = _handle_default('scalings', scalings) diff --git a/mne/viz/topomap.py b/mne/viz/topomap.py index 23b7748a3fc..09ef02bebc8 100644 --- a/mne/viz/topomap.py +++ b/mne/viz/topomap.py @@ -241,7 +241,7 @@ def plot_projs_topomap(projs, layout=None, cmap=None, sensors=True, Returns ------- - fig : instance of matplotlib figure + fig : instance of matplotlib.figure.Figure Figure distributing one image per channel across sensor topography. Notes @@ -1093,7 +1093,7 @@ def plot_ica_components(ica, picks=None, ch_type=None, res=64, Returns ------- - fig : instance of matplotlib.pyplot.Figure or list + fig : instance of matplotlib.figure.Figure or list The figure object(s). Notes @@ -1308,7 +1308,7 @@ def plot_tfr_topomap(tfr, tmin=None, tmax=None, fmin=None, fmax=None, significant sensors will be shown. title : str | None Plot title. If None (default), no title is displayed. - axes : instance of Axis | None + axes : instance of Axes | None The axes to plot to. If None the axes is defined automatically. show : bool Show figure if True. @@ -1442,7 +1442,7 @@ def plot_evoked_topomap(evoked, times="auto", ch_type=None, layout=None, ---------- evoked : Evoked The Evoked object. - times : float | array of floats | "auto" | "peaks" | "interactive" + times : float | array of float | "auto" | "peaks" | "interactive" The time point(s) to plot. If "auto", the number of ``axes`` determines the amount of time point(s). If ``axes`` is also None, at most 10 topographies will be shown with a regular time spacing between the @@ -1941,7 +1941,7 @@ def plot_epochs_psd_topomap(epochs, bands=None, vmin=None, vmax=None, masking options, either directly or as a function that returns patches (required for multi-axis plots). If None, nothing will be drawn. Defaults to 'head'. - axes : list of axes | None + axes : list of Axes | None List of axes to plot consecutive topographies to. If None the axes will be created automatically. Defaults to None. show : bool @@ -1952,7 +1952,7 @@ def plot_epochs_psd_topomap(epochs, bands=None, vmin=None, vmax=None, Returns ------- - fig : instance of matplotlib figure + fig : instance of Figure Figure distributing one image per channel across sensor topography. """ from ..channels import _get_ch_type @@ -2048,7 +2048,7 @@ def plot_psds_topomap( Returns ------- - fig : instance of matplotlib figure + fig : instance of matplotlib.figure.Figure Figure distributing one image per channel across sensor topography. """ import matplotlib.pyplot as plt @@ -2109,7 +2109,7 @@ def plot_layout(layout, picks=None, show=True): Returns ------- - fig : instance of matplotlib figure + fig : instance of Figure Figure containing the sensor topography. Notes @@ -2392,7 +2392,7 @@ def _topomap_animation(evoked, ch_type='mag', times=None, frame_rate=None, Channel type to plot. Accepted data types: 'mag', 'grad', 'eeg'. If None, first available channel type from ('mag', 'grad', 'eeg') is used. Defaults to None. - times : array of floats | None + times : array of float | None The time points to plot. If None, 10 evenly spaced samples are calculated over the evoked time series. Defaults to None. frame_rate : int | None diff --git a/mne/viz/utils.py b/mne/viz/utils.py index 740974a1708..21bdb9283e5 100644 --- a/mne/viz/utils.py +++ b/mne/viz/utils.py @@ -194,7 +194,7 @@ def mne_analyze_colormap(limits=[5, 10, 15], format='mayavi'): Returns ------- - cmap : instance of matplotlib.pyplot.colormap | array + cmap : instance of colormap | array A teal->blue->gray->red->yellow colormap. Notes @@ -1150,7 +1150,7 @@ def onclick(self, event): Parameters ---------- - event : matplotlib event object + event : matplotlib.backend_bases.Event The matplotlib object that we use to get x/y position. """ mouseevent = event.mouseevent @@ -1227,12 +1227,11 @@ def add_background_image(fig, im, set_ratios=None): be done with topo plots, though it could work for any plot. - Note: This modifies the figure and/or axes - in place. + .. note:: This modifies the figure and/or axes in place. Parameters ---------- - fig : plt.figure + fig : Figure The figure you wish to add a bg image to. im : array, shape (M, N, {3, 4}) A background image for the figure. This must be a valid input to @@ -1244,8 +1243,8 @@ def add_background_image(fig, im, set_ratios=None): Returns ------- - ax_im : instance of the created matplotlib axis object - corresponding to the image you added. + ax_im : instance of Axes + Axes created corresponding to the image you added. Notes ----- @@ -1324,7 +1323,7 @@ def plot_sensors(info, kind='topomap', ch_type=None, title=None, Parameters ---------- - info : Instance of Info + info : instance of Info Info structure containing the channel locations. kind : str Whether to plot the sensors as 3d, topomap or as an interactive @@ -1344,7 +1343,7 @@ def plot_sensors(info, kind='topomap', ch_type=None, title=None, show_names : bool | array of str Whether to display all channel names. If an array, only the channel names in the array are shown. Defaults to False. - ch_groups : 'position' | array of shape (ch_groups, picks) | None + ch_groups : 'position' | array of shape (n_ch_groups, n_picks) | None Channel groups for coloring the sensors. If None (default), default coloring scheme is used. If 'position', the sensors are divided into 8 regions. See ``order`` kwarg of :func:`mne.viz.plot_raw`. If @@ -1376,7 +1375,7 @@ def plot_sensors(info, kind='topomap', ch_type=None, title=None, Returns ------- - fig : instance of matplotlib figure + fig : instance of Figure Figure containing the sensor topography. selection : list A list of selected channels. Only returned if ``kind=='select'``. @@ -1803,9 +1802,9 @@ class SelectFromCollection(object): Parameters ---------- - ax : Instance of Axes + ax : instance of Axes Axes to interact with. - collection : Instance of matplotlib collection + collection : instance of matplotlib collection Collection you want to select from. alpha_other : 0 <= float <= 1 To highlight a selection, this tool sets all selected points to an