-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathdocs.py
More file actions
5705 lines (4858 loc) · 208 KB
/
docs.py
File metadata and controls
5705 lines (4858 loc) · 208 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
"""The documentation functions."""
# Authors: The MNE-Python contributors.
# License: BSD-3-Clause
# Copyright the MNE-Python contributors.
import inspect
import os
import os.path as op
import re
import sys
import webbrowser
from copy import deepcopy
from decorator import FunctionMaker
from ..defaults import HEAD_SIZE_DEFAULT
from ._bunch import BunchConst
# # # WARNING # # #
# This list must also be updated in doc/_templates/autosummary/class.rst if it
# is changed here!
_doc_special_members = (
"__contains__",
"__getitem__",
"__iter__",
"__len__",
"__add__",
"__sub__",
"__mul__",
"__div__",
"__neg__",
)
def _reflow_param_docstring(docstring, has_first_line=True, width=75):
"""Reflow text to a nice width for terminals.
WARNING: does not handle gracefully things like .. versionadded::
"""
maxsplit = docstring.count("\n") - 1 if has_first_line else -1
merged = " ".join(
line.strip() for line in docstring.rsplit("\n", maxsplit=maxsplit)
)
reflowed = "\n ".join(re.findall(rf".{{1,{width}}}(?:\s+|$)", merged))
if has_first_line:
reflowed = reflowed.replace("\n \n", "\n", 1)
return reflowed
##############################################################################
# Define our standard documentation entries
#
# To reduce redundancy across functions, please standardize the format to
# ``argument_optional_keywords``. For example ``tmin_raw`` for an entry that
# is specific to ``raw`` and since ``tmin`` is used other places, needs to
# be disambiguated. This way the entries will be easy to find since they
# are alphabetized (you can look up by the name of the argument). This way
# the same ``docdict`` entries are easier to reuse.
docdict = BunchConst()
# %%
# A
tfr_arithmetics_return_template = """
Returns
-------
tfr : instance of RawTFR | instance of EpochsTFR | instance of AverageTFR
{}
"""
tfr_add_sub_template = """
Parameters
----------
other : instance of RawTFR | instance of EpochsTFR | instance of AverageTFR
The TFR instance to {}. Must have the same type as ``self``, and matching
``.times`` and ``.freqs`` attributes.
{}
"""
tfr_mul_truediv_template = """
Parameters
----------
num : int | float
The number to {} by.
{}
"""
tfr_arithmetics_return = tfr_arithmetics_return_template.format(
"A new TFR instance, of the same type as ``self``."
)
tfr_inplace_arithmetics_return = tfr_arithmetics_return_template.format(
"The modified TFR instance."
)
docdict["__add__tfr"] = tfr_add_sub_template.format("add", tfr_arithmetics_return)
docdict["__iadd__tfr"] = tfr_add_sub_template.format(
"add", tfr_inplace_arithmetics_return
)
docdict["__imul__tfr"] = tfr_mul_truediv_template.format(
"multiply", tfr_inplace_arithmetics_return
)
docdict["__isub__tfr"] = tfr_add_sub_template.format(
"subtract", tfr_inplace_arithmetics_return
)
docdict["__itruediv__tfr"] = tfr_mul_truediv_template.format(
"divide", tfr_inplace_arithmetics_return
)
docdict["__mul__tfr"] = tfr_mul_truediv_template.format(
"multiply", tfr_arithmetics_return
)
docdict["__sub__tfr"] = tfr_add_sub_template.format("subtract", tfr_arithmetics_return)
docdict["__truediv__tfr"] = tfr_mul_truediv_template.format(
"divide", tfr_arithmetics_return
)
docdict["accept"] = """
accept : bool
If True (default False), accept the license terms of this dataset.
"""
docdict["add_ch_type_export_params"] = """
add_ch_type : bool
Whether to incorporate the channel type into the signal label (e.g. whether
to store channel "Fz" as "EEG Fz"). Only used for EDF format. Default is
``False``.
"""
docdict["add_data_kwargs"] = """
add_data_kwargs : dict | None
Additional arguments to brain.add_data (e.g.,
``dict(time_label_size=10)``).
"""
docdict["add_frames"] = """
add_frames : int | None
If int, enable (>=1) or disable (0) the printing of stack frame
information using formatting. Default (None) does not change the
formatting. This can add overhead so is meant only for debugging.
"""
docdict["adjacency_clust"] = """
adjacency : scipy.sparse.spmatrix | None | False
Defines adjacency between locations in the data, where "locations" can be
spatial vertices, frequency bins, time points, etc. For spatial vertices
(i.e. sensor space data), see :func:`mne.channels.find_ch_adjacency` or
:func:`mne.spatial_inter_hemi_adjacency`. For source space data, see
:func:`mne.spatial_src_adjacency` or
:func:`mne.spatio_temporal_src_adjacency`. If ``False``, assumes
no adjacency (each location is treated as independent and unconnected).
If ``None``, a regular lattice adjacency is assumed, connecting
each {sp} location to its neighbor(s) along the last dimension
of {{eachgrp}} ``{{x}}``{lastdim}.
If ``adjacency`` is a matrix, it is assumed to be symmetric (only the
upper triangular half is used) and must be square with dimension equal to
``{{x}}.shape[-1]`` {parone} or ``{{x}}.shape[-1] * {{x}}.shape[-2]``
{partwo} or (optionally)
``{{x}}.shape[-1] * {{x}}.shape[-2] * {{x}}.shape[-3]``
{parthree}.{memory}
"""
mem = (
" If spatial adjacency is uniform in time, it is recommended to use "
"a square matrix with dimension ``{x}.shape[-1]`` (n_vertices) to save "
"memory and computation, and to use ``max_step`` to define the extent "
"of temporal adjacency to consider when clustering."
)
comb = " The function `mne.stats.combine_adjacency` may be useful for 4D data."
st = dict(
sp="spatial",
lastdim="",
parone="(n_vertices)",
partwo="(n_times * n_vertices)",
parthree="(n_times * n_freqs * n_vertices)",
memory=mem,
)
tf = dict(
sp="",
lastdim=" (or the last two dimensions if ``{x}`` is 2D)",
parone="(for 2D data)",
partwo="(for 3D data)",
parthree="(for 4D data)",
memory=comb,
)
nogroups = dict(eachgrp="", x="X")
groups = dict(eachgrp="each group ", x="X[k]")
docdict["adjacency_clust_1"] = (
docdict["adjacency_clust"].format(**tf).format(**nogroups)
)
docdict["adjacency_clust_n"] = docdict["adjacency_clust"].format(**tf).format(**groups)
docdict["adjacency_clust_st1"] = (
docdict["adjacency_clust"].format(**st).format(**nogroups)
)
docdict["adjacency_clust_stn"] = (
docdict["adjacency_clust"].format(**st).format(**groups)
)
docdict["adjust_dig_chpi"] = """
adjust_dig : bool
If True, adjust the digitization locations used for fitting based on
the positions localized at the start of the file.
"""
docdict["agg_fun_psd_topo"] = """
agg_fun : callable
The function used to aggregate over frequencies. Defaults to
:func:`numpy.sum` if ``normalize=True``, else :func:`numpy.mean`.
"""
docdict["align_view"] = """
align : bool
If True, consider view arguments relative to canonical MRI
directions (closest to MNI for the subject) rather than native MRI
space. This helps when MRIs are not in standard orientation (e.g.,
have large rotations).
"""
docdict["allow_2d"] = """
allow_2d : bool
If True, allow 2D data as input (i.e. n_samples, n_features).
"""
docdict["allow_empty_eltc"] = """
allow_empty : bool | str
``False`` (default) will emit an error if there are labels that have no
vertices in the source estimate. ``True`` and ``'ignore'`` will return
all-zero time courses for labels that do not have any vertices in the
source estimate, and True will emit a warning while and "ignore" will
just log a message.
.. versionchanged:: 0.21.0
Support for "ignore".
"""
docdict["alpha"] = """
alpha : float in [0, 1]
Alpha level to control opacity.
"""
docdict["anonymize_info_notes"] = """
Removes potentially identifying information if it exists in ``info``.
Specifically for each of the following we use:
- meas_date, file_id, meas_id
A default value, or as specified by ``daysback``.
- subject_info
Default values, except for 'birthday', which is adjusted to maintain the subject
age. If ``keep_his`` is not ``False``, then the fields 'his_id', 'sex', and
'hand' are not anonymized, depending on the value of ``keep_his``.
- experimenter, proj_name, description
Default strings.
- utc_offset
``None``.
- proj_id
Zeros.
- proc_history
Dates use the ``meas_date`` logic, and experimenter a default string.
- helium_info, device_info
Dates use the ``meas_date`` logic, meta info uses defaults.
If ``info['meas_date']`` is ``None``, it will remain ``None`` during processing
the above fields.
Operates in place.
"""
# raw/epochs/evoked apply_function method
# apply_function method summary
applyfun_summary = """\
The function ``fun`` is applied to the {applies_to} defined in ``picks``.
The {data_type} object's data is modified in-place. If the function returns a different
data type (e.g. :py:obj:`numpy.complex128`) it must be specified
using the ``dtype`` parameter, which causes the data type of **all** the data
to change (even if the function is only applied to {applies_to} in
``picks``).{preload}
.. note:: If ``n_jobs`` > 1, more memory is required as
``len(picks) * n_times`` additional time points need to
be temporarily stored in memory.
.. note:: If the data type changes (``dtype != None``), more memory is
required since the original and the converted data needs
to be stored in memory.
"""
applyfun_preload = (
" The object has to have the data loaded e.g. with "
"``preload=True`` or ``self.load_data()``."
)
docdict["applyfun_summary_epochs"] = applyfun_summary.format(
applies_to="channels", data_type="epochs", preload=applyfun_preload
)
docdict["applyfun_summary_evoked"] = applyfun_summary.format(
applies_to="channels", data_type="evoked", preload=""
)
docdict["applyfun_summary_raw"] = applyfun_summary.format(
applies_to="channels", data_type="raw", preload=applyfun_preload
)
docdict["applyfun_summary_stc"] = applyfun_summary.format(
applies_to="vertices", data_type="source estimate", preload=""
)
docdict["area_alpha_plot_psd"] = """\
area_alpha : float
Alpha for the area.
"""
docdict["area_mode_plot_psd"] = """\
area_mode : str | None
Mode for plotting area. If 'std', the mean +/- 1 STD (across channels)
will be plotted. If 'range', the min and max (across channels) will be
plotted. Bad channels will be excluded from these calculations.
If None, no area will be plotted. If average=False, no area is plotted.
"""
docdict["aseg"] = """
aseg : str
The anatomical segmentation file. Default ``auto`` uses ``aparc+aseg``
if available and ``wmparc`` if not. This may be any anatomical
segmentation file in the mri subdirectory of the Freesurfer subject
directory.
.. versionchanged:: 1.8
Added support for the new default ``'auto'``.
"""
docdict["average_plot_evoked_topomap"] = """
average : float | array-like of float, shape (n_times,) | None
The time window (in seconds) around a given time point to be used for
averaging. For example, 0.2 would translate into a time window that
starts 0.1 s before and ends 0.1 s after the given time point. If the
time window exceeds the duration of the data, it will be clipped.
Different time windows (one per time point) can be provided by
passing an ``array-like`` object (e.g., ``[0.1, 0.2, 0.3]``). If
``None`` (default), no averaging will take place.
.. versionchanged:: 1.1
Support for ``array-like`` input.
"""
docdict["average_plot_psd"] = """\
average : bool
If False, the PSDs of all channels is displayed. No averaging
is done and parameters area_mode and area_alpha are ignored. When
False, it is possible to paint an area (hold left mouse button and
drag) to plot a topomap.
"""
docdict["average_psd"] = """\
average : str | None
How to average the segments. If ``mean`` (default), calculate the
arithmetic mean. If ``median``, calculate the median, corrected for
its bias relative to the mean. If ``None``, returns the unaggregated
segments.
"""
docdict["average_tfr"] = """
average : bool, default True
If ``False`` return an `EpochsTFR` containing separate TFRs for each
epoch. If ``True`` return an `AverageTFR` containing the average of all
TFRs across epochs.
.. note::
Using ``average=True`` is functionally equivalent to using
``average=False`` followed by ``EpochsTFR.average()``, but is
more memory efficient.
.. versionadded:: 0.13.0
"""
_axes_base = """\
{param} : instance of Axes | {allowed}None
The axes to plot into. If ``None``, a new :class:`~matplotlib.figure.Figure`
will be created{created}. {list_extra}{extra}Default is ``None``.
"""
_axes_list = _axes_base.format(
param="{param}",
allowed="list of Axes | ",
created=" with the correct number of axes",
list_extra="""If :class:`~matplotlib.axes.Axes`
are provided (either as a single instance or a :class:`list` of axes),
the number of axes provided must {must}. """,
extra="{extra}",
)
_match_chtypes_present_in = "match the number of channel types present in the {}object."
docdict["ax_plot_psd"] = _axes_list.format(
param="ax", must=_match_chtypes_present_in.format(""), extra=""
)
docdict["axes_cov_plot_topomap"] = _axes_list.format(
param="axes", must="be length 1", extra=""
)
docdict["axes_evoked_plot_topomap"] = _axes_list.format(
param="axes",
must="match the number of ``times`` provided (unless ``times`` is ``None``)",
extra="",
)
docdict["axes_montage"] = """
axes : instance of Axes | instance of Axes3D | None
Axes to draw the sensors to. If ``kind='3d'``, axes must be an instance
of Axes3D. If None (default), a new axes will be created.
"""
docdict["axes_plot_projs_topomap"] = _axes_list.format(
param="axes",
must="match the number of projectors",
extra="",
)
docdict["axes_plot_topomap"] = _axes_base.format(
param="axes",
allowed="",
created="",
list_extra="",
extra="",
)
docdict["axes_spectrum_plot"] = _axes_list.format(
param="axes",
must=_match_chtypes_present_in.format(":class:`~mne.time_frequency.Spectrum` "),
extra="",
)
docdict["axes_spectrum_plot_topo"] = _axes_list.format(
param="axes",
must="be length 1 (for efficiency, subplots for each channel are simulated "
"within a single :class:`~matplotlib.axes.Axes` object)",
extra="",
)
docdict["axes_spectrum_plot_topomap"] = _axes_list.format(
param="axes", must="match the length of ``bands``", extra=""
)
docdict["axes_tfr_plot"] = _axes_list.format(
param="axes",
must="match the number of picks",
extra="""If ``combine`` is not None,
``axes`` must either be an instance of Axes, or a list of length 1. """,
)
docdict["axis_facecolor"] = """\
axis_facecolor : str | tuple
A matplotlib-compatible color to use for the axis background.
Defaults to black.
"""
docdict["azimuth"] = """
azimuth : float
The azimuthal angle of the camera rendering the view in degrees.
"""
# %%
# B
docdict["bad_condition_maxwell_cond"] = """
bad_condition : str
How to deal with ill-conditioned SSS matrices. Can be ``"error"``
(default), ``"warning"``, ``"info"``, or ``"ignore"``.
"""
docdict["bands_psd_topo"] = """
bands : None | dict | list of tuple
The frequencies or frequency ranges to plot. If a :class:`dict`, keys will
be used as subplot titles and values should be either a single frequency
(e.g., ``{'presentation rate': 6.5}``) or a length-two sequence of lower
and upper frequency band edges (e.g., ``{'theta': (4, 8)}``). If a single
frequency is provided, the plot will show the frequency bin that is closest
to the requested value. If ``None`` (the default), expands to::
bands = {'Delta (0-4 Hz)': (0, 4), 'Theta (4-8 Hz)': (4, 8),
'Alpha (8-12 Hz)': (8, 12), 'Beta (12-30 Hz)': (12, 30),
'Gamma (30-45 Hz)': (30, 45)}
.. note::
For backwards compatibility, :class:`tuples<tuple>` of length 2 or 3 are
also accepted, where the last element of the tuple is the subplot title
and the other entries are frequency values (a single value or band
edges). New code should use :class:`dict` or ``None``.
.. versionchanged:: 1.2
Allow passing a dict and discourage passing tuples.
"""
docdict["base_estimator"] = """
base_estimator : object
The base estimator to iteratively fit on a subset of the dataset.
"""
_baseline_rescale_base = """
baseline : None | tuple of length 2
The time interval to consider as "baseline" when applying baseline
correction. If ``None``, do not apply baseline correction.
If a tuple ``(a, b)``, the interval is between ``a`` and ``b``
(in seconds), including the endpoints.
If ``a`` is ``None``, the **beginning** of the data is used; and if ``b``
is ``None``, it is set to the **end** of the data.
If ``(None, None)``, the entire time interval is used.
.. note::
The baseline ``(a, b)`` includes both endpoints, i.e. all timepoints ``t``
such that ``a <= t <= b``.
"""
docdict["baseline_epochs"] = f"""{_baseline_rescale_base}
Correction is applied **to each epoch and channel individually** in the
following way:
1. Calculate the mean signal of the baseline period.
2. Subtract this mean from the **entire** epoch.
"""
docdict["baseline_evoked"] = f"""{_baseline_rescale_base}
Correction is applied **to each channel individually** in the following
way:
1. Calculate the mean signal of the baseline period.
2. Subtract this mean from the **entire** ``Evoked``.
"""
docdict["baseline_report"] = f"""{_baseline_rescale_base}
Correction is applied in the following way **to each channel:**
1. Calculate the mean signal of the baseline period.
2. Subtract this mean from the **entire** time period.
For `~mne.Epochs`, this algorithm is run **on each epoch individually.**
"""
docdict["baseline_rescale"] = _baseline_rescale_base
docdict["baseline_stc"] = f"""{_baseline_rescale_base}
Correction is applied **to each source individually** in the following
way:
1. Calculate the mean signal of the baseline period.
2. Subtract this mean from the **entire** source estimate data.
.. note:: Baseline correction is appropriate when signal and noise are
approximately additive, and the noise level can be estimated from
the baseline interval. This can be the case for non-normalized
source activities (e.g. signed and unsigned MNE), but it is not
the case for normalized estimates (e.g. signal-to-noise ratios,
dSPM, sLORETA).
"""
docdict["baseline_tfr_attr"] = """
baseline : array-like, shape (2,)
The start and end times of the baseline period, in seconds."""
docdict["block"] = """\
block : bool
Whether to halt program execution until the figure is closed.
May not work on all systems / platforms. Defaults to ``False``.
"""
docdict["border_topo"] = """
border : str
Matplotlib border style to be used for each sensor plot.
"""
docdict["border_topomap"] = """
border : float | 'mean'
Value to extrapolate to on the topomap borders. If ``'mean'`` (default),
then each extrapolated point has the average value of its neighbours.
"""
docdict["brain_kwargs"] = """
brain_kwargs : dict | None
Additional arguments to the :class:`mne.viz.Brain` constructor (e.g.,
``dict(silhouette=True)``).
"""
docdict["brain_update"] = """
update : bool
Force an update of the plot. Defaults to True.
"""
docdict["browser"] = """
fig : matplotlib.figure.Figure | mne_qt_browser.figure.MNEQtBrowser
Browser instance.
"""
docdict["buffer_size_clust"] = """
buffer_size : int | None
Block size to use when computing test statistics. This can significantly
reduce memory usage when ``n_jobs > 1`` and memory sharing between
processes is enabled (see :func:`mne.set_cache_dir`), because ``X`` will be
shared between processes and each process only needs to allocate space for
a small block of locations at a time.
"""
docdict["by_event_type"] = """
by_event_type : bool
When ``False`` (the default) all epochs are processed together and a single
:class:`~mne.Evoked` object is returned. When ``True``, epochs are first
grouped by event type (as specified using the ``event_id`` parameter) and a
list is returned containing a separate :class:`~mne.Evoked` object for each
event type. The ``.comment`` attribute is set to the label of the event
type.
.. versionadded:: 0.24.0
"""
# %%
# C
docdict["calibration_maxwell_cal"] = """
calibration : str | None
Path to the ``'.dat'`` file with fine calibration coefficients.
File can have 1D or 3D gradiometer imbalance correction.
This file is machine/site-specific.
"""
docdict["cbar_fmt_topomap"] = """\
cbar_fmt : str
Formatting string for colorbar tick labels. See :ref:`formatspec` for
details.
"""
docdict["cbar_fmt_topomap_psd"] = (
docdict["cbar_fmt_topomap"]
+ """\
If ``'auto'``, is equivalent to '%0.3f' if ``dB=False`` and '%0.1f' if
``dB=True``. Defaults to ``'auto'``.
"""
)
docdict["center"] = """
center : float or None
If not None, center of a divergent colormap, changes the meaning of
fmin, fmax and fmid.
"""
docdict["ch_name_ecg"] = """
ch_name : None | str
The name of the channel to use for ECG peak detection.
If ``None`` (default), ECG channel is used if present. If ``None`` and
**no** ECG channel is present, a synthetic ECG channel is created from
the cross-channel average. This synthetic channel can only be created from
MEG channels.
"""
docdict["ch_name_eog"] = """
ch_name : str | list of str | None
The name of the channel(s) to use for EOG peak detection. If a string,
can be an arbitrary channel. This doesn't have to be a channel of
``eog`` type; it could, for example, also be an ordinary EEG channel
that was placed close to the eyes, like ``Fp1`` or ``Fp2``.
Multiple channel names can be passed as a list of strings.
If ``None`` (default), use the channel(s) in ``raw`` with type ``eog``.
"""
docdict["ch_names_annot"] = """
ch_names : list | None
List of lists of channel names associated with the annotations.
Empty entries are assumed to be associated with no specific channel,
i.e., with all channels or with the time slice itself. None (default) is
the same as passing all empty lists. For example, this creates three
annotations, associating the first with the time interval itself, the
second with two channels, and the third with a single channel::
Annotations(onset=[0, 3, 10], duration=[1, 0.25, 0.5],
description=['Start', 'BAD_flux', 'BAD_noise'],
ch_names=[[], ['MEG0111', 'MEG2563'], ['MEG1443']])
"""
docdict["ch_names_tfr_attr"] = """
ch_names : list
The channel names."""
docdict["ch_type_set_eeg_reference"] = """
ch_type : list of str | str
The name of the channel type to apply the reference to.
Valid channel types are ``'auto'``, ``'eeg'``, ``'ecog'``, ``'seeg'``,
``'dbs'``. If ``'auto'``, the first channel type of eeg, ecog, seeg or dbs
that is found (in that order) will be selected.
.. versionadded:: 0.19
.. versionchanged:: 1.2
``list-of-str`` is now supported with ``projection=True``.
"""
_ch_type_topomap_base = """\
ch_type : 'mag' | 'grad' | 'planar1' | 'planar2' | 'eeg' | None{}
The channel type to plot. For ``'grad'``, the gradiometers are
collected in pairs and the {} for each pair is plotted. If
``None`` {}. {}Defaults to ``None``.
"""
_ch_type_topomap = _ch_type_topomap_base.format(
"{}", "{}", "the first available channel type from order shown above is used", "{}"
)
docdict["ch_type_topomap"] = _ch_type_topomap.format("", "RMS", "")
docdict["ch_type_topomap_proj"] = _ch_type_topomap_base.format(
" | list",
"RMS",
"it will return all channel types present.",
"If a list of ch_types is provided, it will return multiple figures. ",
)
docdict["ch_type_topomap_psd"] = _ch_type_topomap.format("", "mean", "")
chwise = """
channel_wise : bool
Whether to apply the function to each channel {}individually. If ``False``,
the function will be applied to all {}channels at once. Default ``True``.
"""
docdict["channel_wise_applyfun"] = chwise.format("", "")
docdict["channel_wise_applyfun_epo"] = chwise.format("in each epoch ", "epochs and ")
docdict["check_disjoint_clust"] = """
check_disjoint : bool
Whether to check if the connectivity matrix can be separated into disjoint
sets before clustering. This may lead to faster clustering, especially if
the second dimension of ``X`` (usually the "time" dimension) is large.
"""
docdict["chpi_amplitudes"] = """
chpi_amplitudes : dict
The time-varying cHPI coil amplitudes, with entries
"times", "proj", and "slopes".
"""
docdict["chpi_locs"] = """
chpi_locs : dict
The time-varying cHPI coils locations, with entries
"times", "rrs", "moments", and "gofs".
"""
docdict["clim"] = """
clim : str | dict
Colorbar properties specification. If 'auto', set clim automatically
based on data percentiles. If dict, should contain:
``kind`` : 'value' | 'percent'
Flag to specify type of limits.
``lims`` : list | np.ndarray | tuple of float, 3 elements
Lower, middle, and upper bounds for colormap.
``pos_lims`` : list | np.ndarray | tuple of float, 3 elements
Lower, middle, and upper bound for colormap. Positive values
will be mirrored directly across zero during colormap
construction to obtain negative control points.
.. note:: Only one of ``lims`` or ``pos_lims`` should be provided.
Only sequential colormaps should be used with ``lims``, and
only divergent colormaps should be used with ``pos_lims``.
"""
docdict["clim_onesided"] = """
clim : str | dict
Colorbar properties specification. If 'auto', set clim automatically
based on data percentiles. If dict, should contain:
``kind`` : 'value' | 'percent'
Flag to specify type of limits.
``lims`` : list | np.ndarray | tuple of float, 3 elements
Lower, middle, and upper bound for colormap.
Unlike :meth:`stc.plot <mne.SourceEstimate.plot>`, it cannot use
``pos_lims``, as the surface plot must show the magnitude.
"""
_cmap_template = """
cmap : matplotlib colormap | str{allowed}
The :class:`~matplotlib.colors.Colormap` to use. If a :class:`str`, must be a
valid Matplotlib colormap name. Default is {default}.
"""
docdict["cmap"] = _cmap_template.format(
allowed=" | None",
default="``None``, which will use the Matplotlib default colormap",
)
docdict["cmap_tfr_plot_topo"] = _cmap_template.format(
allowed="", default='``"RdBu_r"``'
)
docdict["cmap_topomap"] = """\
cmap : matplotlib colormap | (colormap, bool) | 'interactive' | None
Colormap to use. If :class:`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 with left and right mouse button. Left mouse button moves the
scale up and down and right mouse button adjusts the range. Hitting
space bar resets the range. Up and down arrows can be used to change
the colormap. If ``None``, ``'Reds'`` is used for data that is either
all-positive or all-negative, and ``'RdBu_r'`` is used otherwise.
``'interactive'`` is equivalent to ``(None, True)``. Defaults to ``None``.
.. warning:: Interactive mode works smoothly only for a small amount
of topomaps. Interactive mode is disabled by default for more than
2 topomaps.
"""
docdict["cmap_topomap_simple"] = """
cmap : matplotlib colormap | None
Colormap to use. If None, 'Reds' is used for all positive data,
otherwise defaults to 'RdBu_r'.
"""
docdict["cnorm"] = """
cnorm : matplotlib.colors.Normalize | None
How to normalize the colormap. If ``None``, standard linear normalization
is performed. If not ``None``, ``vmin`` and ``vmax`` will be ignored.
See :ref:`Matplotlib docs <matplotlib:colormapnorms>`
for more details on colormap normalization, and
:ref:`the ERDs example<cnorm-example>` for an example of its use.
"""
docdict["color_matplotlib"] = """
color : color
A list of anything matplotlib accepts: string, RGB, hex, etc.
"""
docdict["color_plot_psd"] = """\
color : str | tuple
A matplotlib-compatible color to use. Has no effect when
spatial_colors=True.
"""
docdict["color_spectrum_plot_topo"] = """\
color : str | tuple
A matplotlib-compatible color to use for the curves. Defaults to
white.
"""
docdict["colorbar"] = """\
colorbar : bool
Whether to add a colorbar to the plot. Default is ``True``.
"""
docdict["colorbar_tfr_plot_joint"] = """
colorbar : bool
Whether to add a colorbar to the plot (for the topomap annotations). Not compatible
with user-defined ``axes``. Default is ``True``.
"""
docdict["colorbar_topomap"] = """
colorbar : bool
Plot a colorbar in the rightmost column of the figure.
"""
docdict["colormap"] = """
colormap : str | matplotlib.colors.Colormap
Name of colormap to use or a custom Matplotlib colormap instance. If passing
a custom colormap, it must be an instance of :class:`matplotlib.colors.Colormap`
(e.g., :class:`matplotlib.colors.ListedColormap`).
"""
_combine_template = """
combine : 'mean' | {literals} | callable{none}
How to aggregate across channels. {none_sentence}If a string,
``"mean"`` uses :func:`numpy.mean`, {other_string}.
If :func:`callable`, it must operate on an :class:`array <numpy.ndarray>`
of shape ``({shape})`` and return an array of shape
``({return_shape})``. {example}{notes}Defaults to {default}.
"""
_example = """For example::
combine = lambda data: np.median(data, axis=1)
""" # ← the 4 trailing spaces are intentional here!
_median_std_gfp = """``"median"`` computes the `marginal median
<https://en.wikipedia.org/wiki/Median#Marginal_median>`__, ``"std"``
uses :func:`numpy.std`, and ``"gfp"`` computes global field power
for EEG channels and RMS amplitude for MEG channels"""
_none_default = dict(none=" | None", default="``None``")
docdict["combine_plot_compare_evokeds"] = _combine_template.format(
literals="'median' | 'std' | 'gfp'",
**_none_default,
none_sentence="""If ``None``, channels are combined by
computing GFP/RMS, unless ``picks`` is a single channel (not channel type)
or ``axes="topo"``, in which cases no combining is performed. """,
other_string=_median_std_gfp,
shape="n_evokeds, n_channels, n_times",
return_shape="n_evokeds, n_times",
example=_example,
notes="",
)
docdict["combine_plot_epochs_image"] = _combine_template.format(
literals="'median' | 'std' | 'gfp'",
**_none_default,
none_sentence="""If ``None``, channels are combined by
computing GFP/RMS, unless ``group_by`` is also ``None`` and ``picks`` is a
list of specific channels (not channel types), in which case no combining
is performed and each channel gets its own figure. """,
other_string=_median_std_gfp,
shape="n_epochs, n_channels, n_times",
return_shape="n_epochs, n_times",
example=_example,
notes="See Notes for further details. ",
)
docdict["combine_tfr_plot"] = _combine_template.format(
literals="'rms'",
**_none_default,
none_sentence="If ``None``, plot one figure per selected channel. ",
shape="n_channels, n_freqs, n_times",
return_shape="n_freqs, n_times",
other_string='``"rms"`` computes the root-mean-square',
example="",
notes="",
)
docdict["combine_tfr_plot_joint"] = _combine_template.format(
literals="'rms'",
none="",
none_sentence="",
shape="n_channels, n_freqs, n_times",
return_shape="n_freqs, n_times",
other_string='``"rms"`` computes the root-mean-square',
example="",
notes="",
default='``"mean"``',
)
_comment_template = """
comment : str{or_none}
Comment on the data, e.g., the experimental condition(s){avgd}.{extra}"""
docdict["comment_averagetfr"] = _comment_template.format(
or_none=" | None",
avgd="averaged",
extra="""Default is ``None``
which is replaced with ``inst.comment`` (for :class:`~mne.Evoked` instances)
or a comma-separated string representation of the keys in ``inst.event_id``
(for :class:`~mne.Epochs` instances).""",
)
docdict["comment_averagetfr_attr"] = _comment_template.format(
or_none="", avgd=" averaged", extra=""
)
docdict["comment_tfr_attr"] = _comment_template.format(or_none="", avgd="", extra="")
docdict["compute_proj_ecg"] = """This function will:
#. Filter the ECG data channel.
#. Find ECG R wave peaks using :func:`mne.preprocessing.find_ecg_events`.
#. Filter the raw data.
#. Create `~mne.Epochs` around the R wave peaks, capturing the heartbeats.
#. Optionally average the `~mne.Epochs` to produce an `~mne.Evoked` if
``average=True`` was passed (default).
#. Calculate SSP projection vectors on that data to capture the artifacts."""
docdict["compute_proj_eog"] = """This function will:
#. Filter the EOG data channel.
#. Find the peaks of eyeblinks in the EOG data using
:func:`mne.preprocessing.find_eog_events`.
#. Filter the raw data.
#. Create `~mne.Epochs` around the eyeblinks.
#. Optionally average the `~mne.Epochs` to produce an `~mne.Evoked` if
``average=True`` was passed (default).
#. Calculate SSP projection vectors on that data to capture the artifacts."""
docdict["compute_ssp"] = """This function aims to find those SSP vectors that
will project out the ``n`` most prominent signals from the data for each
specified sensor type. Consequently, if the provided input data contains high
levels of noise, the produced SSP vectors can then be used to eliminate that
noise from the data.
"""
docdict["contours_topomap"] = """
contours : int | array-like
The number of contour lines to draw. If ``0``, no contours will be drawn.
If a positive integer, that number of contour levels are chosen using the
matplotlib tick locator (may sometimes be inaccurate, use array for
accuracy). If array-like, the array values are used as the contour levels.
The values should be in µV for EEG, fT for magnetometers and fT/m for
gradiometers. If ``colorbar=True``, the colorbar will have ticks
corresponding to the contour levels. Default is ``6``.
"""
docdict["coord_frame_maxwell"] = """
coord_frame : str
The coordinate frame that the ``origin`` is specified in, either
``'meg'`` or ``'head'``. For empty-room recordings that do not have
a head<->meg transform ``info['dev_head_t']``, the MEG coordinate
frame should be used.
"""
docdict["copy_df"] = """
copy : bool
If ``True``, data will be copied. Otherwise data may be modified in place.
Defaults to ``True``.
"""
docdict["create_ecg_epochs"] = """This function will:
#. Filter the ECG data channel.
#. Find ECG R wave peaks using :func:`mne.preprocessing.find_ecg_events`.
#. Create `~mne.Epochs` around the R wave peaks, capturing the heartbeats.
"""
docdict["create_eog_epochs"] = """This function will:
#. Filter the EOG data channel.