Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changes/dev/14100.other.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Move default values out of parameter type descriptions and remove ``optional`` from docstrings, by `Daria Agafonova`_.
4 changes: 2 additions & 2 deletions mne/_fiff/pick.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,9 +944,9 @@ def pick_channels_cov(
----------
orig : Covariance
A covariance.
include : list of str, (optional)
include : list of str
List of channels to include (if empty, include all available).
exclude : list of str, (optional) | 'bads'
exclude : list of str | 'bads'
Channels to exclude (if empty, do not exclude any). Defaults to 'bads'.
%(ordered)s
copy : bool
Expand Down
2 changes: 1 addition & 1 deletion mne/bem.py
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ def read_bem_surfaces(
----------
fname : path-like
The name of the file containing the surfaces.
patch_stats : bool, optional (default False)
patch_stats : bool
Calculate and add cortical patch statistics to the surfaces.
s_id : int | None
If int, only read and return the surface with the given ``s_id``.
Expand Down
78 changes: 39 additions & 39 deletions mne/cov.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,15 +606,15 @@ def compute_raw_covariance(
Raw data.
tmin : float
Beginning of time interval in seconds. Defaults to 0.
tmax : float | None (default None)
tmax : float | None
End of time interval in seconds. If None (default), use the end of the
recording.
tstep : float (default 0.2)
tstep : float
Length of data chunks for artifact rejection in seconds.
Can also be None to use a single epoch of (tmax - tmin)
duration. This can use a lot of memory for large ``Raw``
instances.
reject : dict | None (default None)
reject : dict | None
Rejection parameters based on peak-to-peak amplitude.
Valid keys are 'grad' | 'mag' | 'eeg' | 'eog' | 'ecg'.
If reject is None then no rejection is done. Example::
Expand All @@ -625,7 +625,7 @@ def compute_raw_covariance(
eog=250e-6 # V (EOG channels)
)

flat : dict | None (default None)
flat : dict | None
Rejection parameters based on flatness of signal.
Valid keys are 'grad' | 'mag' | 'eeg' | 'eog' | 'ecg', and values
are floats that set the minimum acceptable peak-to-peak amplitude.
Expand All @@ -637,23 +637,23 @@ def compute_raw_covariance(
covariance or rank estimates.

.. versionadded:: 1.11
method : str | list | None (default 'empirical')
method : str | list | None
The method used for covariance estimation.
See :func:`mne.compute_covariance`.

.. versionadded:: 0.12
method_params : dict | None (default None)
method_params : dict | None
Additional parameters to the estimation procedure.
See :func:`mne.compute_covariance`.

.. versionadded:: 0.12
cv : int | sklearn.model_selection object (default 3)
cv : int | sklearn.model_selection object
The cross validation method. Defaults to 3, which will
internally trigger by default :class:`sklearn.model_selection.KFold`
with 3 splits.

.. versionadded:: 0.12
scalings : dict | None (default None)
scalings : dict | None
Defaults to ``dict(mag=1e15, grad=1e13, eeg=1e6)``.
These defaults will scale magnetometers and gradiometers
at the same unit.
Expand All @@ -662,7 +662,7 @@ def compute_raw_covariance(
%(n_jobs)s

.. versionadded:: 0.12
return_estimators : bool (default False)
return_estimators : bool
Whether to return all estimators or the best. Only considered if
method equals 'auto' or is a list of str. Defaults to False.

Expand Down Expand Up @@ -911,17 +911,17 @@ def compute_covariance(
----------
epochs : instance of Epochs, or list of Epochs
The epochs.
keep_sample_mean : bool (default True)
keep_sample_mean : bool
If False, the average response over epochs is computed for
each event type and subtracted during the covariance
computation. This is useful if the evoked response from a
previous stimulus extends into the baseline period of the next.
Note. This option is only implemented for method='empirical'.
tmin : float | None (default None)
tmin : float | None
Start time for baseline. If None start at first sample.
tmax : float | None (default None)
tmax : float | None
End time for baseline. If None end at last sample.
projs : list of Projection | None (default None)
projs : list of Projection | None
List of projectors to use in covariance calculation, or None
to indicate that the projectors from the epochs should be
inherited. If None, then projectors from all epochs must match.
Expand All @@ -931,7 +931,7 @@ def compute_covariance(
covariance or rank estimates.

.. versionadded:: 1.11
method : str | list | None (default 'empirical')
method : str | list | None
The method used for covariance estimation. If 'empirical' (default),
the sample covariance will be computed. A list can be passed to
perform estimates using multiple methods.
Expand All @@ -949,7 +949,7 @@ def compute_covariance(
segments of data, since computation can take a long time.

.. versionadded:: 0.9.0
method_params : dict | None (default None)
method_params : dict | None
Additional parameters to the estimation procedure. Only considered if
method is not None. Keys must correspond to the value(s) of ``method``.
If None (default), expands to the following (with the addition of
Expand All @@ -962,16 +962,16 @@ def compute_covariance(
'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
The cross validation method. Defaults to 3, which will
internally trigger by default :class:`sklearn.model_selection.KFold`
with 3 splits.
scalings : dict | None (default None)
scalings : dict | None
Defaults to ``dict(mag=1e15, grad=1e13, eeg=1e6)``.
These defaults will scale data to roughly the same order of
magnitude.
%(n_jobs)s
return_estimators : bool (default False)
return_estimators : bool
Whether to return all estimators or the best. Only considered if
method equals 'auto' or is a list of str. Defaults to False.
on_mismatch : str
Expand Down Expand Up @@ -1986,45 +1986,45 @@ def regularize(
cov : Covariance
The noise covariance matrix.
%(info_not_none)s (Used to get channel types and bad channels).
mag : float (default 0.1)
mag : float
Regularization factor for MEG magnetometers.
grad : float (default 0.1)
grad : float
Regularization factor for MEG gradiometers. Must be the same as
``mag`` if data have been processed with SSS.
eeg : float (default 0.1)
eeg : float
Regularization factor for EEG.
exclude : list | 'bads' (default 'bads')
exclude : list | '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
Apply projections to keep rank of data.
seeg : float (default 0.1)
seeg : float
Regularization factor for sEEG signals.
ecog : float (default 0.1)
ecog : float
Regularization factor for ECoG signals.
hbo : float (default 0.1)
hbo : float
Regularization factor for HBO signals.
hbr : float (default 0.1)
hbr : float
Regularization factor for HBR signals.
fnirs_cw_amplitude : float (default 0.1)
fnirs_cw_amplitude : float
Regularization factor for fNIRS CW raw signals.
fnirs_fd_ac_amplitude : float (default 0.1)
fnirs_fd_ac_amplitude : float
Regularization factor for fNIRS FD AC raw signals.
fnirs_fd_phase : float (default 0.1)
fnirs_fd_phase : float
Regularization factor for fNIRS raw phase signals.
fnirs_od : float (default 0.1)
fnirs_od : float
Regularization factor for fNIRS optical density signals.
fnirs_td_gated_amplitude : float (default 0.1)
fnirs_td_gated_amplitude : float
Regularization factor for fNIRS time domain gated amplitude signals.
fnirs_td_moments_intensity : float (default 0.1)
fnirs_td_moments_intensity : float
Regularization factor for fNIRS time domain moments amplitude signals.
fnirs_td_moments_mean : float (default 0.1)
fnirs_td_moments_mean : float
Regularization factor for fNIRS time domain moments mean signals.
fnirs_td_moments_variance : float (default 0.1)
fnirs_td_moments_variance : float
Regularization factor for fNIRS time domain moments variance signals.
csd : float (default 0.1)
csd : float
Regularization factor for EEG-CSD signals.
dbs : float (default 0.1)
dbs : float
Regularization factor for DBS signals.
%(rank_none)s

Expand Down Expand Up @@ -2375,13 +2375,13 @@ def whiten_evoked(
noise_cov : instance of Covariance
The noise covariance.
%(picks_good_data)s
diag : bool (default False)
diag : bool
If True, whiten using only the diagonal of the covariance.
%(rank_none)s

.. versionadded:: 0.18
Support for 'info' mode.
scalings : dict | None (default None)
scalings : dict | None
To achieve reliable rank estimation on multiple sensors,
sensors have to be rescaled. This parameter controls the
rescaling. If dict, it will override the
Expand Down
10 changes: 5 additions & 5 deletions mne/decoding/_fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ def validate_data(
The estimator to validate the input for.

X : {array-like, sparse matrix, dataframe} of shape \
(n_samples, n_features), default='no validation'
(n_samples, n_features) | 'no_validation'
The input samples.
If `'no_validation'`, no validation is performed on `X`. This is
useful for meta-estimator which can delegate input validation to
their underlying estimator(s). In that case `y` must be passed and
the only accepted `check_params` are `multi_output` and
`y_numeric`.

y : array-like of shape (n_samples,), default='no_validation'
y : array-like of shape (n_samples,) | None | 'no_validation'
The targets.

- If `None`, :func:`~sklearn.utils.check_array` is called on `X`. If
Expand All @@ -54,7 +54,7 @@ def validate_data(
either :func:`~sklearn.utils.check_array` or
:func:`~sklearn.utils.check_X_y` depending on `validate_separately`.

reset : bool, default=True
reset : bool
Whether to reset the `n_features_in_` attribute.
If False, the input will be checked for consistency with data
provided when reset was last True.
Expand All @@ -65,7 +65,7 @@ def validate_data(
call to `partial_fit`. All other methods that validate `X`
should set `reset=False`.

validate_separately : False or tuple of dicts, default=False
validate_separately : False | tuple of dicts
Only used if `y` is not `None`.
If `False`, call :func:`~sklearn.utils.check_X_y`. Else, it must be a tuple
of kwargs to be used for calling :func:`~sklearn.utils.check_array` on `X`
Expand All @@ -74,7 +74,7 @@ def validate_data(
`estimator=self` is automatically added to these dicts to generate
more informative error message in case of invalid input data.

skip_check_array : bool, default=False
skip_check_array : bool
If `True`, `X` and `y` are unchanged and only `feature_names_in_` and
`n_features_in_` are checked. Otherwise, :func:`~sklearn.utils.check_array`
is called on `X` and `y`.
Expand Down
4 changes: 2 additions & 2 deletions mne/decoding/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,9 +842,9 @@ def cross_val_multiscore(
other cases, :class:`sklearn.model_selection.KFold` is used.
%(n_jobs)s
%(verbose)s
fit_params : dict, optional
fit_params : dict
Parameters to pass to the fit method of the estimator.
pre_dispatch : int, or str, optional
pre_dispatch : int | str
Controls the number of jobs that get dispatched during parallel
execution. Reducing this number can be useful to avoid an
explosion of memory consumption when more jobs get dispatched
Expand Down
22 changes: 11 additions & 11 deletions mne/decoding/csp.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,28 @@ class CSP(_GEDTransformer):

Parameters
----------
n_components : int (default 4)
n_components : int
The number of components to decompose M/EEG signals. This number should
be set by cross-validation.
reg : float | str | None (default None)
reg : float | str | None
If not None (same as ``'empirical'``, default), allow regularization
for covariance estimation. If float (between 0 and 1), shrinkage is
used. For str values, ``reg`` will be passed as ``method`` to
:func:`mne.compute_covariance`.
log : None | bool (default None)
log : None | bool
If ``transform_into`` equals ``'average_power'`` and ``log`` is None or
True, then apply a log transform to standardize features, else features
are z-scored. If ``transform_into`` is ``'csp_space'``, ``log`` must be
None.
cov_est : 'concat' | 'epoch' (default 'concat')
cov_est : 'concat' | 'epoch'
If ``'concat'``, covariance matrices are estimated on concatenated
epochs for each class. If ``'epoch'``, covariance matrices are
estimated on each epoch separately and then averaged over each class.
transform_into : 'average_power' | 'csp_space' (default 'average_power')
transform_into : 'average_power' | 'csp_space'
If 'average_power' then ``self.transform`` will return the average
power of each spatial filter. If ``'csp_space'``, ``self.transform``
will return the data in CSP space.
norm_trace : bool (default False)
norm_trace : bool
Normalize class covariance by its trace. Trace normalization is a step
of the original CSP algorithm :footcite:`KolesEtAl1990` to eliminate
magnitude variations in the EEG between individuals. It is not applied
Expand Down Expand Up @@ -89,7 +89,7 @@ class CSP(_GEDTransformer):
%(rank_none)s

.. versionadded:: 0.17
component_order : 'mutual_info' | 'alternate' (default 'mutual_info')
component_order : 'mutual_info' | 'alternate'
If ``'mutual_info'`` order components by decreasing mutual information
(in the two-class case this uses a simplification which orders
components by decreasing absolute deviation of the eigenvalues from 0.5
Expand Down Expand Up @@ -611,9 +611,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, default 1e-6
eps : float
The tolerance for stopping criterion.
max_iter : int, default 1000
max_iter : int
The maximum number of iteration to reach convergence.

Returns
Expand Down Expand Up @@ -705,13 +705,13 @@ class SPoC(CSP):
----------
n_components : int
The number of components to decompose M/EEG signals.
reg : float | str | None (default None)
reg : float | str | None
If not None (same as ``'empirical'``, default), allow
regularization for covariance estimation.
If float, shrinkage is used (0 <= shrinkage <= 1).
For str options, ``reg`` will be passed to ``method`` to
:func:`mne.compute_covariance`.
log : None | bool (default None)
log : None | bool
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.
Expand Down
4 changes: 2 additions & 2 deletions mne/decoding/ems.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ def compute_ems(
----------
epochs : instance of mne.Epochs
The epochs.
conditions : list of str | None, default None
conditions : list of str | 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_good_data)s
%(n_jobs)s
cv : cross-validation object | str | None, default LeaveOneOut
cv : cross-validation object | str | None
The cross-validation scheme.
%(verbose)s

Expand Down
Loading
Loading