Skip to content

Commit d7fe748

Browse files
authored
MRG: Add links for parameters (#5840)
* ENH: Add links for parameters * FIX: Heisenbug
1 parent 014f87c commit d7fe748

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+540
-431
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
5757
- run:
5858
name: Get Anaconda running
59+
# pip install --user --upgrade --progress-bar off https://api.github.com/repos/larsoner/numpydoc/zipball/xref-param-type
5960
command: |
6061
wget -q http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh;
6162
chmod +x ~/miniconda.sh;

doc/_static/style.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,10 @@ h4.list-group-item-heading {
284284
.skinnytable thead {
285285
border-bottom: 1px solid black;
286286
}
287+
/* Unify color of refs and classes in parameter lists */
288+
span.classifier a span.xref {
289+
color: #2c3e50;
290+
}
291+
span.classifier a code.docutils.literal.notranslate {
292+
color: #2c3e50;
293+
}

doc/conf.py

Lines changed: 114 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020

2121
import sphinx_gallery
2222
from sphinx_gallery.sorting import FileNameSortKey
23-
import sphinx_bootstrap_theme
24-
from numpydoc import numpydoc, docscrape # noqa
25-
import sphinx_fontawesome
23+
from numpydoc import docscrape
2624
import mne
2725
from mne.utils import linkcode_resolve # noqa, analysis:ignore
2826

@@ -45,9 +43,6 @@
4543
# If your documentation needs a minimal Sphinx version, state it here.
4644
needs_sphinx = '1.5'
4745

48-
# XXX This hack defines what extra methods numpydoc will document
49-
docscrape.ClassDoc.extra_public_methods = mne.utils._doc_special_members
50-
5146
# Add any Sphinx extension module names here, as strings. They can be
5247
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
5348

@@ -64,6 +59,7 @@
6459
'sphinx_fontawesome',
6560
'numpydoc',
6661
'gen_commands',
62+
'sphinx_bootstrap_theme',
6763
]
6864

6965
linkcheck_ignore = [
@@ -176,9 +172,6 @@
176172
],
177173
}
178174

179-
# Add any paths that contain custom themes here, relative to this directory.
180-
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
181-
182175
# The name for this set of Sphinx documents. If None, it defaults to
183176
# "<project> v<release> documentation".
184177
#html_title = None
@@ -308,6 +301,9 @@
308301
'dipy': ('http://nipy.org/dipy', None),
309302
}
310303

304+
##############################################################################
305+
# sphinx-gallery
306+
311307
examples_dirs = ['../examples', '../tutorials']
312308
gallery_dirs = ['auto_examples', 'auto_tutorials']
313309

@@ -386,4 +382,113 @@ def reset_warnings(gallery_conf, fname):
386382
'within_subsection_order': FileNameSortKey,
387383
}
388384

385+
##############################################################################
386+
# numpydoc
387+
388+
# XXX This hack defines what extra methods numpydoc will document
389+
docscrape.ClassDoc.extra_public_methods = mne.utils._doc_special_members
389390
numpydoc_class_members_toctree = False
391+
numpydoc_xref_param_type = True
392+
numpydoc_xref_aliases = {
393+
'None': ':data:`python:None`',
394+
'bool': ':ref:`bool <python:bltin-boolean-values>`',
395+
'boolean': ':ref:`bool <python:bltin-boolean-values>`',
396+
'True': ':data:`python:True`',
397+
'False': ':data:`python:False`',
398+
'list': ':class:`python:list`',
399+
'tuple': ':class:`python:tuple`',
400+
'str': ':class:`python:str`',
401+
'string': ':class:`python:str`',
402+
'dict': ':class:`python:dict`',
403+
'float': ':class:`python:float`',
404+
'int': ':class:`python:int`',
405+
'callable': ':func:`callable <python:callable>`',
406+
'iterable': ':term:`python:iterable`',
407+
'contextmanager': ':func:`python:contextlib.contextmanager`',
408+
'namedtuple': ':func:`python:collections.namedtuple`',
409+
'generator': ':term:`python:generator`',
410+
# NumPy
411+
'array': '~numpy.ndarray',
412+
'ndarray': '~numpy.ndarray',
413+
'np.ndarray': '~numpy.ndarray',
414+
'array-like': ':term:`numpy:array_like`',
415+
'array_like': ':term:`numpy:array_like`',
416+
'scalar': ':ref:`scalar <numpy:arrays.scalars>`',
417+
'RandomState': '~numpy.random.RandomState',
418+
'np.random.RandomState': '~numpy.random.RandomState',
419+
'np.inf': ':data:`~numpy.inf`',
420+
# 'numpy': ':mod:`numpy`',
421+
# Matplotlib
422+
'colormap': ':doc:`colormap <matplotlib:tutorials/colors/colormaps>`',
423+
'color': ':doc:`color <matplotlib:api/colors_api>`',
424+
'collection': ':doc:`collections <matplotlib:api/collections_api>`',
425+
'Axes': '~matplotlib.axes.Axes',
426+
'Figure': '~matplotlib.figure.Figure',
427+
'Axes3D': '~mpl_toolkits.mplot3d.axes3d.Axes3D',
428+
# Mayavi
429+
'mayavi.mlab.Figure': 'mayavi.core.api.Scene',
430+
'mlab.Figure': 'mayavi.core.api.Scene',
431+
# sklearn
432+
'LeaveOneOut': '~sklearn.model_selection.LeaveOneOut',
433+
'sklearn.model_selection': ':mod:`sklearn.model_selection`',
434+
# nibabel
435+
'Nifti1Image': '~nibabel.nifti1.Nifti1Image',
436+
'Nifti2Image': '~nibabel.nifti2.Nifti2Image',
437+
# MNE
438+
'Label': '~mne.Label', 'Forward': '~mne.Forward', 'Evoked': '~mne.Evoked',
439+
'Info': '~mne.Info', 'SourceSpaces': '~mne.SourceSpaces',
440+
'Epochs': '~mne.Epochs', 'Layout': '~mne.channels.Layout',
441+
'EvokedArray': '~mne.EvokedArray', 'BiHemiLabel': '~mne.BiHemiLabel',
442+
'AverageTFR': '~mne.time_frequency.AverageTFR',
443+
'EpochsTFR': '~mne.time_frequency.EpochsTFR',
444+
'Raw': '~mne.io.Raw', 'ICA': '~mne.preprocessing.ICA',
445+
'Covariance': '~mne.Covariance', 'Annotations': '~mne.Annotations',
446+
'Montage': '~mne.channels.Montage',
447+
'DigMontage': '~mne.channels.DigMontage',
448+
'VectorSourceEstimate': '~mne.VectorSourceEstimate',
449+
'VolSourceEstimate': '~mne.VolSourceEstimate',
450+
'MixedSourceEstimate': '~mne.MixedSourceEstimate',
451+
'SourceEstimate': '~mne.SourceEstimate', 'Projection': '~mne.Projection',
452+
'ConductorModel': '~mne.bem.ConductorModel',
453+
'Dipole': '~mne.Dipole', 'DipoleFixed': '~mne.DipoleFixed',
454+
'InverseOperator': '~mne.minimum_norm.InverseOperator',
455+
'CrossSpectralDensity': '~mne.time_frequency.CrossSpectralDensity',
456+
'RtEpochs': '~mne.realtime.RtEpochs',
457+
'SourceMorph': '~mne.SourceMorph',
458+
'Xdawn': '~mne.preprocessing.Xdawn',
459+
'Report': '~mne.Report', 'Forward': '~mne.Forward',
460+
'TimeDelayingRidge': '~mne.decoding.TimeDelayingRidge',
461+
'Vectorizer': '~mne.decoding.Vectorizer',
462+
'UnsupervisedSpatialFilter': '~mne.decoding.UnsupervisedSpatialFilter',
463+
'TemporalFilter': '~mne.decoding.TemporalFilter',
464+
'Scaler': '~mne.decoding.Scaler', 'SPoC': '~mne.decoding.SPoC',
465+
'PSDEstimator': '~mne.decoding.PSDEstimator',
466+
'LinearModel': '~mne.decoding.LinearModel',
467+
'FilterEstimator': '~mne.decoding.FilterEstimator',
468+
'EMS': '~mne.decoding.EMS', 'CSP': '~mne.decoding.CSP',
469+
'Beamformer': '~mne.beamformer.Beamformer',
470+
}
471+
numpydoc_xref_ignore = {
472+
# words
473+
'instance', 'instances', 'of', 'default', 'shape', 'or',
474+
'with', 'length', 'pair', 'matplotlib', 'optional', 'kwargs', 'in',
475+
'dtype', 'object', 'self.verbose',
476+
# shapes
477+
'n_vertices', 'n_faces', 'n_channels', 'm', 'n', 'n_events', 'n_colors',
478+
'n_times', 'obj', 'n_chan', 'n_epochs', 'n_picks', 'n_ch_groups',
479+
'n_dipoles', 'n_ica_components', 'n_pos', 'n_node_names', 'n_tapers',
480+
'n_signals', 'n_step', 'n_freqs', 'wsize', 'Tx', 'M', 'N', 'p', 'q',
481+
'n_observations', 'n_regressors', 'n_cols', 'n_frequencies', 'n_tests',
482+
'n_samples', 'n_permutations', 'nchan', 'n_points', 'n_features',
483+
'n_parts', 'n_features_new', 'n_components', 'n_labels', 'n_events_in',
484+
'n_splits', 'n_scores', 'n_outputs', 'n_trials', 'n_estimators', 'n_tasks',
485+
'nd_features', 'n_classes', 'n_targets', 'n_slices', 'n_hpi', 'n_fids',
486+
'n_elp', 'n_pts', 'n_tris',
487+
# Undocumented (on purpose)
488+
'RawKIT', 'RawEximia', 'RawEGI', 'RawEEGLAB', 'RawEDF', 'RawCTF', 'RawBTi',
489+
'RawBrainVision',
490+
# sklearn subclasses
491+
'mapping', 'to', 'any',
492+
# unlinkable
493+
'mayavi.mlab.pipeline.surface',
494+
}

mne/annotations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Annotations(object):
3737
Array of strings containing description for each annotation. If a
3838
string, all the annotations are given the same description. To reject
3939
epochs, use description starting with keyword 'bad'. See example above.
40-
orig_time : float | int | instance of datetime | array of int | None | str
40+
orig_time : float | int | instance of datetime.datetime | array of int | None | str
4141
A POSIX Timestamp, datetime or an array containing the timestamp as the
4242
first element and microseconds as the second element. Determines the
4343
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,
764764
----------
765765
raw : instance of Raw
766766
The raw data for which Annotations are defined.
767-
event_id : dict | Callable | None
767+
event_id : dict | callable | None
768768
Dictionary of string keys and integer values as used in mne.Epochs
769769
to map annotation descriptions to integer event codes. Only the
770770
keys present will be mapped and the annotations with other descriptions

mne/beamformer/_dics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -641,11 +641,11 @@ def tf_dics(epochs, forward, noise_csds, tmin, tmax, tstep, win_lengths,
641641
tf source grid. Defaults to False.
642642
mode : 'fourier' | 'multitaper' | 'cwt_morlet'
643643
Spectrum estimation mode. Defaults to 'fourier'.
644-
freq_bins : list of tuples of float
644+
freq_bins : list of tuple of float
645645
Start and end point of frequency bins of interest.
646646
Only used in 'multitaper' or 'fourier' mode. For 'cwt_morlet' mode, use
647647
the ``frequencies`` parameter instead.
648-
frequencies : list of float | list of lists of float
648+
frequencies : list of float | list of list of float
649649
The frequencies to compute the source power for. If you want to compute
650650
the average power for multiple frequency bins, specify a list of
651651
lists: each list containing the frequencies for the corresponding bin.

mne/beamformer/_lcmv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def tf_lcmv(epochs, forward, noise_covs, tmin, tmax, tstep, win_lengths,
531531
win_lengths : list of float
532532
Time window lengths in seconds. One time window length should be
533533
provided for each frequency bin.
534-
freq_bins : list of tuples of float
534+
freq_bins : list of tuple of float
535535
Start and end point of frequency bins of interest.
536536
subtract_evoked : bool
537537
If True, subtract the averaged evoked response prior to computing the

mne/channels/channels.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ def plot_sensors(self, kind='topomap', ch_type=None, title=None,
524524
show_names : bool | array of str
525525
Whether to display all channel names. If an array, only the channel
526526
names in the array are shown. Defaults to False.
527-
ch_groups : 'position' | array of shape (ch_groups, picks) | None
527+
ch_groups : 'position' | array of shape (n_ch_groups, n_picks) | None
528528
Channel groups for coloring the sensors. If None (default), default
529529
coloring scheme is used. If 'position', the sensors are divided
530530
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,
556556
557557
Returns
558558
-------
559-
fig : instance of matplotlib figure
559+
fig : instance of Figure
560560
Figure containing the sensor topography.
561561
selection : list
562562
A list of selected channels. Only returned if ``kind=='select'``.
@@ -1053,7 +1053,7 @@ def read_ch_connectivity(fname, picks=None):
10531053
10541054
Returns
10551055
-------
1056-
ch_connectivity : scipy.sparse matrix, shape (n_channels, n_channels)
1056+
ch_connectivity : scipy.sparse.csr_matrix, shape (n_channels, n_channels)
10571057
The connectivity matrix.
10581058
ch_names : list
10591059
The list of channel names present in connectivity matrix.
@@ -1161,7 +1161,7 @@ def find_ch_connectivity(info, ch_type):
11611161
11621162
Returns
11631163
-------
1164-
ch_connectivity : scipy.sparse matrix, shape (n_channels, n_channels)
1164+
ch_connectivity : scipy.sparse.csr_matrix, shape (n_channels, n_channels)
11651165
The connectivity matrix.
11661166
ch_names : list
11671167
The list of channel names present in connectivity matrix.
@@ -1388,7 +1388,7 @@ def make_1020_channel_selections(info, midline="z"):
13881388
13891389
Parameters
13901390
----------
1391-
info : instance of info
1391+
info : instance of Info
13921392
Where to obtain the channel names from. The picks will
13931393
be in relation to the position in `info["ch_names"]`. If possible, this
13941394
lists will be sorted by y value position of the channel locations,

mne/channels/layout.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def plot(self, picks=None, show=True):
101101
102102
Returns
103103
-------
104-
fig : instance of matplotlib figure
104+
fig : instance of matplotlib.figure.Figure
105105
Figure containing the sensor topography.
106106
107107
Notes
@@ -913,7 +913,7 @@ def generate_2d_layout(xy, w=.07, h=.05, pad=.02, ch_names=None,
913913
914914
Parameters
915915
----------
916-
xy : ndarray (N x 2)
916+
xy : ndarray, shape (N, 2)
917917
The xy coordinates of sensor locations.
918918
w : float
919919
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,
928928
ch_indices : list
929929
Index of each channel - must be a collection of unique integers,
930930
one index per channel.
931-
name : string
931+
name : str
932932
The name of this layout type.
933933
bg_image : str | ndarray
934934
The image over which sensor axes will be plotted. Either a path to an

mne/connectivity/effective.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,20 @@ def phase_slope_index(data, indices=None, sfreq=2 * np.pi,
4949
e.g., data = [(arr_0, stc_0), (arr_1, stc_1), (arr_2, stc_2)],
5050
corresponds to 3 epochs, and arr_* could be an array with the same
5151
number of time points as stc_*.
52-
indices : tuple of arrays | None
52+
indices : tuple of array | None
5353
Two arrays with indices of connections for which to compute
5454
connectivity. If None, all connections are computed.
5555
sfreq : float
5656
The sampling frequency.
5757
mode : str
5858
Spectrum estimation mode can be either: 'multitaper', 'fourier', or
5959
'cwt_morlet'.
60-
fmin : float | tuple of floats
60+
fmin : float | tuple of float
6161
The lower frequency of interest. Multiple bands are defined using
6262
a tuple, e.g., (8., 20.) for two bands with 8Hz and 20Hz lower freq.
6363
If None the frequency corresponding to an epoch length of 5 cycles
6464
is used.
65-
fmax : float | tuple of floats
65+
fmax : float | tuple of float
6666
The upper frequency of interest. Multiple bands are dedined using
6767
a tuple, e.g. (13., 30.) for two band with 13Hz and 30Hz upper freq.
6868
tmin : float | None

mne/connectivity/spectral.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,20 +649,20 @@ def spectral_connectivity(data, method='coh', indices=None, sfreq=2 * np.pi,
649649
or a list/generator of SourceEstimate or VolSourceEstimate objects.
650650
method : string | list of string
651651
Connectivity measure(s) to compute.
652-
indices : tuple of arrays | None
652+
indices : tuple of array | None
653653
Two arrays with indices of connections for which to compute
654654
connectivity. If None, all connections are computed.
655655
sfreq : float
656656
The sampling frequency.
657657
mode : str
658658
Spectrum estimation mode can be either: 'multitaper', 'fourier', or
659659
'cwt_morlet'.
660-
fmin : float | tuple of floats
660+
fmin : float | tuple of float
661661
The lower frequency of interest. Multiple bands are defined using
662662
a tuple, e.g., (8., 20.) for two bands with 8Hz and 20Hz lower freq.
663663
If None the frequency corresponding to an epoch length of 5 cycles
664664
is used.
665-
fmax : float | tuple of floats
665+
fmax : float | tuple of float
666666
The upper frequency of interest. Multiple bands are dedined using
667667
a tuple, e.g. (13., 30.) for two band with 13Hz and 30Hz upper freq.
668668
fskip : int
@@ -707,7 +707,7 @@ def spectral_connectivity(data, method='coh', indices=None, sfreq=2 * np.pi,
707707
708708
Returns
709709
-------
710-
con : array | list of arrays
710+
con : array | list of array
711711
Computed connectivity measure(s). The shape of each array is either
712712
(n_signals, n_signals, n_freqs) mode: 'multitaper' or 'fourier'
713713
(n_signals, n_signals, n_freqs, n_times) mode: 'cwt_morlet'

mne/connectivity/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def seed_target_indices(seeds, targets):
2828
2929
Returns
3030
-------
31-
indices : tuple of arrays
31+
indices : tuple of array
3232
The indices parameter used for connectivity computation.
3333
"""
3434
# make them arrays

mne/cov.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def compute_raw_covariance(raw, tmin=0, tmax=None, tstep=0.2, reject=None,
374374
See :func:`mne.compute_covariance`.
375375
376376
.. versionadded:: 0.12
377-
cv : int | sklearn model_selection object (default 3)
377+
cv : int | sklearn.model_selection object (default 3)
378378
The cross validation method. Defaults to 3, which will
379379
internally trigger by default :class:`sklearn.model_selection.KFold`
380380
with 3 splits.
@@ -605,7 +605,7 @@ def compute_covariance(epochs, keep_sample_mean=True, tmin=None, tmax=None,
605605
606606
Parameters
607607
----------
608-
epochs : instance of Epochs, or a list of Epochs objects
608+
epochs : instance of Epochs, or list of Epochs
609609
The epochs.
610610
keep_sample_mean : bool (default True)
611611
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,
651651
'pca': {'iter_n_components': None},
652652
'factor_analysis': {'iter_n_components': None}}
653653
654-
cv : int | sklearn model_selection object (default 3)
654+
cv : int | sklearn.model_selection object (default 3)
655655
The cross validation method. Defaults to 3, which will
656656
internally trigger by default :class:`sklearn.model_selection.KFold`
657657
with 3 splits.
@@ -1532,7 +1532,7 @@ def regularize(cov, info, mag=0.1, grad=0.1, eeg=0.1, exclude='bads',
15321532
exclude : list | 'bads' (default 'bads')
15331533
List of channels to mark as bad. If 'bads', bads channels
15341534
are extracted from both info['bads'] and cov['bads'].
1535-
proj : bool (default true)
1535+
proj : bool (default True)
15361536
Apply projections to keep rank of data.
15371537
seeg : float (default 0.1)
15381538
Regularization factor for sEEG signals.

0 commit comments

Comments
 (0)