Skip to content

Commit de7cfa9

Browse files
larsonerjeythekey
authored andcommitted
MRG: Better class doc (mne-tools#6152)
1 parent c92495d commit de7cfa9

File tree

15 files changed

+62
-83
lines changed

15 files changed

+62
-83
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
PYTHON ?= python
66
PYTESTS ?= py.test
77
CTAGS ?= ctags
8-
CODESPELL_SKIPS ?= "*.fif,*.eve,*.gz,*.tgz,*.zip,*.mat,*.stc,*.label,*.w,*.bz2,*.annot,*.sulc,*.log,*.local-copy,*.orig_avg,*.inflated_avg,*.gii,*.pyc,*.doctree,*.pickle,*.inv,*.png,*.edf,*.touch,*.thickness,*.nofix,*.volume,*.defect_borders,*.mgh,lh.*,rh.*,COR-*,FreeSurferColorLUT.txt,*.examples,.xdebug_mris_calc,bad.segments,BadChannels,*.hist,empty_file,*.orig,*.js,*.map,*.ipynb,searchindex.dat,install_mne_c.rst,plot_*.rst,*.rst.txt,c_EULA.rst*,*.html"
8+
CODESPELL_SKIPS ?= "*.fif,*.eve,*.gz,*.tgz,*.zip,*.mat,*.stc,*.label,*.w,*.bz2,*.annot,*.sulc,*.log,*.local-copy,*.orig_avg,*.inflated_avg,*.gii,*.pyc,*.doctree,*.pickle,*.inv,*.png,*.edf,*.touch,*.thickness,*.nofix,*.volume,*.defect_borders,*.mgh,lh.*,rh.*,COR-*,FreeSurferColorLUT.txt,*.examples,.xdebug_mris_calc,bad.segments,BadChannels,*.hist,empty_file,*.orig,*.js,*.map,*.ipynb,searchindex.dat,install_mne_c.rst,plot_*.rst,*.rst.txt,c_EULA.rst*,*.html,gdf_encodes.txt"
99
CODESPELL_DIRS ?= mne/ doc/ tutorials/ examples/
1010
all: clean inplace test test-doc
1111

doc/_static/style.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,7 @@ dl.cmd-list dt, dl.cmd-list dd {
351351
dl.cmd-list dt::after {
352352
visibility: hidden;
353353
}
354+
/* Attributes / methods not taking up entire width ends up looking odd */
355+
dd table.align-center {
356+
width: 100%;
357+
}

doc/_templates/autosummary/class.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55

66
.. autoclass:: {{ objname }}
77
:special-members: __contains__,__getitem__,__iter__,__len__,__add__,__sub__,__mul__,__div__,__neg__,__hash__
8-
9-
{% block methods %}
10-
{% endblock %}
8+
:members:
119

1210
.. include:: {{module}}.{{objname}}.examples

doc/conf.py

Lines changed: 41 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -420,86 +420,58 @@ def reset_warnings(gallery_conf, fname):
420420
# XXX This hack defines what extra methods numpydoc will document
421421
docscrape.ClassDoc.extra_public_methods = mne.utils._doc_special_members
422422
numpydoc_class_members_toctree = False
423+
numpydoc_attributes_as_param_list = False
423424
numpydoc_xref_param_type = True
424425
numpydoc_xref_aliases = {
425-
'None': ':data:`python:None`',
426-
'bool': ':ref:`bool <python:bltin-boolean-values>`',
427-
'boolean': ':ref:`bool <python:bltin-boolean-values>`',
428-
'True': ':data:`python:True`',
429-
'False': ':data:`python:False`',
430-
'list': ':class:`python:list`',
431-
'tuple': ':class:`python:tuple`',
432-
'str': ':class:`python:str`',
433-
'string': ':class:`python:str`',
434-
'dict': ':class:`python:dict`',
435-
'float': ':class:`python:float`',
436-
'int': ':class:`python:int`',
437-
'callable': ':func:`callable <python:callable>`',
438-
'iterable': ':term:`python:iterable`',
439-
'contextmanager': ':func:`python:contextlib.contextmanager`',
440-
'namedtuple': ':func:`python:collections.namedtuple`',
441-
'generator': ':term:`python:generator`',
442-
# NumPy
443-
'array': '~numpy.ndarray',
444-
'ndarray': '~numpy.ndarray',
445-
'np.ndarray': '~numpy.ndarray',
446-
'array-like': ':term:`numpy:array_like`',
447-
'array_like': ':term:`numpy:array_like`',
448-
'scalar': ':ref:`scalar <numpy:arrays.scalars>`',
449-
'RandomState': '~numpy.random.RandomState',
450-
'np.random.RandomState': '~numpy.random.RandomState',
451-
'np.inf': ':data:`~numpy.inf`',
452-
# 'numpy': ':mod:`numpy`',
453426
# Matplotlib
454427
'colormap': ':doc:`colormap <matplotlib:tutorials/colors/colormaps>`',
455428
'color': ':doc:`color <matplotlib:api/colors_api>`',
456429
'collection': ':doc:`collections <matplotlib:api/collections_api>`',
457-
'Axes': '~matplotlib.axes.Axes',
458-
'Figure': '~matplotlib.figure.Figure',
459-
'Axes3D': '~mpl_toolkits.mplot3d.axes3d.Axes3D',
430+
'Axes': 'matplotlib.axes.Axes',
431+
'Figure': 'matplotlib.figure.Figure',
432+
'Axes3D': 'mpl_toolkits.mplot3d.axes3d.Axes3D',
460433
# Mayavi
461434
'mayavi.mlab.Figure': 'mayavi.core.api.Scene',
462435
'mlab.Figure': 'mayavi.core.api.Scene',
463436
# sklearn
464-
'LeaveOneOut': '~sklearn.model_selection.LeaveOneOut',
465-
'sklearn.model_selection': ':mod:`sklearn.model_selection`',
437+
'LeaveOneOut': 'sklearn.model_selection.LeaveOneOut',
466438
# nibabel
467-
'Nifti1Image': '~nibabel.nifti1.Nifti1Image',
468-
'Nifti2Image': '~nibabel.nifti2.Nifti2Image',
439+
'Nifti1Image': 'nibabel.nifti1.Nifti1Image',
440+
'Nifti2Image': 'nibabel.nifti2.Nifti2Image',
469441
# MNE
470-
'Label': '~mne.Label', 'Forward': '~mne.Forward', 'Evoked': '~mne.Evoked',
471-
'Info': '~mne.Info', 'SourceSpaces': '~mne.SourceSpaces',
472-
'Epochs': '~mne.Epochs', 'Layout': '~mne.channels.Layout',
473-
'EvokedArray': '~mne.EvokedArray', 'BiHemiLabel': '~mne.BiHemiLabel',
474-
'AverageTFR': '~mne.time_frequency.AverageTFR',
475-
'EpochsTFR': '~mne.time_frequency.EpochsTFR',
476-
'Raw': '~mne.io.Raw', 'ICA': '~mne.preprocessing.ICA',
477-
'Covariance': '~mne.Covariance', 'Annotations': '~mne.Annotations',
478-
'Montage': '~mne.channels.Montage',
479-
'DigMontage': '~mne.channels.DigMontage',
480-
'VectorSourceEstimate': '~mne.VectorSourceEstimate',
481-
'VolSourceEstimate': '~mne.VolSourceEstimate',
482-
'VolVectorSourceEstimate': '~mne.VolVectorSourceEstimate',
483-
'MixedSourceEstimate': '~mne.MixedSourceEstimate',
484-
'SourceEstimate': '~mne.SourceEstimate', 'Projection': '~mne.Projection',
485-
'ConductorModel': '~mne.bem.ConductorModel',
486-
'Dipole': '~mne.Dipole', 'DipoleFixed': '~mne.DipoleFixed',
487-
'InverseOperator': '~mne.minimum_norm.InverseOperator',
488-
'CrossSpectralDensity': '~mne.time_frequency.CrossSpectralDensity',
489-
'RtEpochs': '~mne.realtime.RtEpochs',
490-
'SourceMorph': '~mne.SourceMorph',
491-
'Xdawn': '~mne.preprocessing.Xdawn',
492-
'Report': '~mne.Report', 'Forward': '~mne.Forward',
493-
'TimeDelayingRidge': '~mne.decoding.TimeDelayingRidge',
494-
'Vectorizer': '~mne.decoding.Vectorizer',
495-
'UnsupervisedSpatialFilter': '~mne.decoding.UnsupervisedSpatialFilter',
496-
'TemporalFilter': '~mne.decoding.TemporalFilter',
497-
'Scaler': '~mne.decoding.Scaler', 'SPoC': '~mne.decoding.SPoC',
498-
'PSDEstimator': '~mne.decoding.PSDEstimator',
499-
'LinearModel': '~mne.decoding.LinearModel',
500-
'FilterEstimator': '~mne.decoding.FilterEstimator',
501-
'EMS': '~mne.decoding.EMS', 'CSP': '~mne.decoding.CSP',
502-
'Beamformer': '~mne.beamformer.Beamformer',
442+
'Label': 'mne.Label', 'Forward': 'mne.Forward', 'Evoked': 'mne.Evoked',
443+
'Info': 'mne.Info', 'SourceSpaces': 'mne.SourceSpaces',
444+
'Epochs': 'mne.Epochs', 'Layout': 'mne.channels.Layout',
445+
'EvokedArray': 'mne.EvokedArray', 'BiHemiLabel': 'mne.BiHemiLabel',
446+
'AverageTFR': 'mne.time_frequency.AverageTFR',
447+
'EpochsTFR': 'mne.time_frequency.EpochsTFR',
448+
'Raw': 'mne.io.Raw', 'ICA': 'mne.preprocessing.ICA',
449+
'Covariance': 'mne.Covariance', 'Annotations': 'mne.Annotations',
450+
'Montage': 'mne.channels.Montage',
451+
'DigMontage': 'mne.channels.DigMontage',
452+
'VectorSourceEstimate': 'mne.VectorSourceEstimate',
453+
'VolSourceEstimate': 'mne.VolSourceEstimate',
454+
'VolVectorSourceEstimate': 'mne.VolVectorSourceEstimate',
455+
'MixedSourceEstimate': 'mne.MixedSourceEstimate',
456+
'SourceEstimate': 'mne.SourceEstimate', 'Projection': 'mne.Projection',
457+
'ConductorModel': 'mne.bem.ConductorModel',
458+
'Dipole': 'mne.Dipole', 'DipoleFixed': 'mne.DipoleFixed',
459+
'InverseOperator': 'mne.minimum_norm.InverseOperator',
460+
'CrossSpectralDensity': 'mne.time_frequency.CrossSpectralDensity',
461+
'RtEpochs': 'mne.realtime.RtEpochs',
462+
'SourceMorph': 'mne.SourceMorph',
463+
'Xdawn': 'mne.preprocessing.Xdawn',
464+
'Report': 'mne.Report', 'Forward': 'mne.Forward',
465+
'TimeDelayingRidge': 'mne.decoding.TimeDelayingRidge',
466+
'Vectorizer': 'mne.decoding.Vectorizer',
467+
'UnsupervisedSpatialFilter': 'mne.decoding.UnsupervisedSpatialFilter',
468+
'TemporalFilter': 'mne.decoding.TemporalFilter',
469+
'Scaler': 'mne.decoding.Scaler', 'SPoC': 'mne.decoding.SPoC',
470+
'PSDEstimator': 'mne.decoding.PSDEstimator',
471+
'LinearModel': 'mne.decoding.LinearModel',
472+
'FilterEstimator': 'mne.decoding.FilterEstimator',
473+
'EMS': 'mne.decoding.EMS', 'CSP': 'mne.decoding.CSP',
474+
'Beamformer': 'mne.beamformer.Beamformer',
503475
}
504476
numpydoc_xref_ignore = {
505477
# words
@@ -516,7 +488,7 @@ def reset_warnings(gallery_conf, fname):
516488
'n_parts', 'n_features_new', 'n_components', 'n_labels', 'n_events_in',
517489
'n_splits', 'n_scores', 'n_outputs', 'n_trials', 'n_estimators', 'n_tasks',
518490
'nd_features', 'n_classes', 'n_targets', 'n_slices', 'n_hpi', 'n_fids',
519-
'n_elp', 'n_pts', 'n_tris', 'n_nodes', 'n_nonzero',
491+
'n_elp', 'n_pts', 'n_tris', 'n_nodes', 'n_nonzero', 'n_events_out',
520492
# Undocumented (on purpose)
521493
'RawKIT', 'RawEximia', 'RawEGI', 'RawEEGLAB', 'RawEDF', 'RawCTF', 'RawBTi',
522494
'RawBrainVision',

doc/whats_new.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1506,7 +1506,7 @@ API
15061506

15071507
- Weighted addition and subtraction of :class:`Evoked` as ``ev1 + ev2`` and ``ev1 - ev2`` have been deprecated, use explicit :func:`mne.combine_evoked(..., weights='nave') <mne.combine_evoked>` instead by `Eric Larson`_
15081508

1509-
- Deprecated support for passing a lits of filenames to :class:`mne.io.Raw` constructor, use :func:`mne.io.read_raw_fif` and :func:`mne.concatenate_raws` instead by `Eric Larson`_
1509+
- Deprecated support for passing a list of filenames to :class:`mne.io.Raw` constructor, use :func:`mne.io.read_raw_fif` and :func:`mne.concatenate_raws` instead by `Eric Larson`_
15101510

15111511
- Added options for setting data and date formats manually in :func:`mne.io.read_raw_cnt` by `Jaakko Leppakangas`_
15121512

ignore_words.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ thes
2020
ba
2121
ist
2222
theses
23+
od
24+
fo
25+
files'

mne/bem.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,8 +1339,10 @@ def read_bem_solution(fname, verbose=None):
13391339
13401340
See Also
13411341
--------
1342-
write_bem_solution, read_bem_surfaces, write_bem_surfaces,
1342+
read_bem_surfaces
1343+
write_bem_surfaces
13431344
make_bem_solution
1345+
write_bem_solution
13441346
"""
13451347
# mirrors fwd_bem_load_surfaces from fwd_bem_model.c
13461348
logger.info('Loading surfaces...')

mne/channels/layout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def make_eeg_layout(info, radius=0.5, width=None, height=None, exclude='bads'):
227227
this will be the maximum width possible without axes overlapping.
228228
height : float | None
229229
Height of sensor axes as a fraction of main figure height. By default,
230-
this will be the maximum height possible withough axes overlapping.
230+
this will be the maximum height possible without axes overlapping.
231231
exclude : list of string | str
232232
List of channels to exclude. If empty do not exclude any.
233233
If 'bads', exclude channels in info['bads'] (default).

mne/decoding/csp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ def fit(self, X, y):
771771
if len(np.unique(y)) < 2:
772772
raise ValueError("y must have at least two distinct values.")
773773

774-
# The following code is direclty copied from pyRiemann
774+
# The following code is directly copied from pyRiemann
775775

776776
# Normalize target variable
777777
target = y.astype(np.float64)

mne/event.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ def merge_events(events, ids, new_id, replace_events=True):
749749
750750
Returns
751751
-------
752-
new_events: array, shape (n_events_out, 3)
752+
new_events : array, shape (n_events_out, 3)
753753
The new events
754754
755755
Examples

mne/forward/_lead_dots.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def _get_legen_table(ch_type, volume_integral=False, n_coeff=100,
5656
raise RuntimeError('n_interp must be even')
5757
fname = op.join(_get_extra_data_path(), 'tables')
5858
if not op.isdir(fname):
59-
# Updated due to API chang (GH 1167)
59+
# Updated due to API change (GH 1167)
6060
os.makedirs(fname)
6161
if ch_type == 'meg':
6262
fname = op.join(fname, 'legder_%s_%s.bin' % (n_coeff, n_interp))

mne/io/meas_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ class Info(dict):
298298
unit : int
299299
The unit to use, e.g. ``FIFF_UNIT_T_M``.
300300
unit_mul : int
301-
Unit multipliers, most commontly ``FIFF_UNITM_NONE``.
301+
Unit multipliers, most commonly ``FIFF_UNITM_NONE``.
302302
303303
* ``comps`` list of dict:
304304

mne/minimum_norm/tests/test_inverse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ def test_make_inverse_operator_fixed(evoked, noise_cov):
511511

512512
# now compare to C solution
513513
# note that the forward solution must not be surface-oriented
514-
# to get equivalency (surf_ori=True changes the normals)
514+
# to get equivalence (surf_ori=True changes the normals)
515515
with catch_logging() as log:
516516
inv_op = make_inverse_operator( # test depth=0. alias for depth=None
517517
evoked.info, fwd, noise_cov, depth=0., fixed=True,

mne/tests/test_report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def test_open_report():
330330
# Exiting the context block should have triggered saving to HDF5
331331
assert op.exists(hdf5)
332332

333-
# Load the HDF5 version of the report and check equivalency
333+
# Load the HDF5 version of the report and check equivalence
334334
report2 = open_report(hdf5)
335335
assert report2._fname == hdf5
336336
assert report2.subjects_dir == report.subjects_dir

tutorials/plot_background_filtering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@
284284
# sample at each time point :math:`t` is filtered using samples that come
285285
# after (:math:`t + \Delta t`) *and* before (:math:`t - \Delta t`) :math:`t`.
286286
# In this sense, each sample is influenced by samples that come both before
287-
# and after it. This is useful in many cases, espcially because it does not
287+
# and after it. This is useful in many cases, especially because it does not
288288
# delay the timing of events.
289289
#
290290
# However, sometimes it can be beneficial to use *causal* filtering,

0 commit comments

Comments
 (0)