Skip to content
Closed
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/13798.newfeature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add :term:`epochs` glossary cross-references to docstrings in ``mne/epochs.py`` (:gh:`13798`).
33 changes: 17 additions & 16 deletions mne/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _pack_reject_params(epochs):


def _save_split(epochs, split_fnames, part_idx, n_parts, fmt, overwrite):
"""Split epochs.
"""Split :term:`epochs`.

Anything new added to this function also needs to be added to
BaseEpochs.save to account for new file sizes.
Expand Down Expand Up @@ -692,7 +692,7 @@ def __init__(
self.set_annotations(annotations, on_missing="ignore")

def _check_consistency(self):
"""Check invariants of epochs object."""
"""Check invariants of :term:`epochs` object."""
if hasattr(self, "events"):
assert len(self.selection) == len(self.events)
assert len(self.drop_log) >= len(self.events)
Expand All @@ -716,10 +716,11 @@ def reset_drop_log_selection(self):
self.reset_index()

def reset_index(self):
"""Reset the epochs index.
"""Reset the :term:`epochs` index.

This resets the epochs indexing and drop log so that ``self.selection`` becomes
a simple increasing sequence starting at zero and ``self.drop_log`` becomes a
This resets the :term:`epochs` indexing and drop log so that
``self.selection`` becomes a simple increasing sequence starting at zero
and ``self.drop_log`` becomes a
tuple of empty tuples of the same length. The operation is in-place and is
useful when creating epochs from a subset of events (using ``event_id``) and the
original event indexes are not relevant anymore.
Expand Down Expand Up @@ -756,7 +757,7 @@ def load_data(self):

@verbose
def apply_baseline(self, baseline=(None, 0), *, verbose=None):
"""Baseline correct epochs.
"""Baseline correct :term:`epochs`.

Parameters
----------
Expand Down Expand Up @@ -967,9 +968,9 @@ def _detrend_offset_decim(self, epoch, picks, verbose=None):
return epoch

def iter_evoked(self, copy=False):
"""Iterate over epochs as a sequence of Evoked objects.
"""Iterate over :term:`epochs` as a sequence of Evoked objects.

The Evoked objects yielded will each contain a single epoch (i.e., no
The Evoked objects yielded will each contain a single :term:`epochs` (i.e., no
averaging is performed).

This method resets the object iteration state to the first epoch.
Expand Down Expand Up @@ -1079,7 +1080,7 @@ def subtract_evoked(self, evoked=None):

@fill_doc
def average(self, picks=None, method="mean", by_event_type=False):
"""Compute an average over epochs.
"""Compute an average over :term:`epochs`.

Parameters
----------
Expand Down Expand Up @@ -1145,7 +1146,7 @@ def standard_error(self, picks=None, by_event_type=False):
return self.average(picks=picks, method="std", by_event_type=by_event_type)

def _compute_aggregate(self, picks, mode="mean"):
"""Compute the mean, median, or std over epochs and return Evoked."""
"""Compute the mean, median, or std over :term:`epochs` and return Evoked."""
# if instance contains ICA channels they won't be included unless picks
# is specified
if picks is None:
Expand Down Expand Up @@ -1391,7 +1392,7 @@ def plot_topo_image(

@verbose
def drop_bad(self, reject="existing", flat="existing", verbose=None):
"""Drop bad epochs without retaining the epochs data.
"""Drop bad :term:`epochs` without retaining the :term:`epochs` data.

Should be used before slicing operations.

Expand Down Expand Up @@ -1898,7 +1899,7 @@ def get_data(
copy=True,
verbose=None,
):
"""Get all epochs as a 3D array.
"""Get all :term:`epochs` as a 3D array.

Parameters
----------
Expand Down Expand Up @@ -1943,8 +1944,8 @@ def get_data(
Returns
-------
data : array of shape (n_epochs, n_channels, n_times)
The epochs data. Will be a copy when ``copy=True`` and will be a view
when possible when ``copy=False``.
The :term:`epochs` data. Will be a copy when ``copy=True`` and
will be a view when possible when ``copy=False``.
"""
return self._get_data(
picks=picks, item=item, units=units, tmin=tmin, tmax=tmax, copy=copy
Expand Down Expand Up @@ -2948,14 +2949,14 @@ def _drop_log_stats(drop_log, ignore=("IGNORED",)):
Parameters
----------
drop_log : list of list
Epoch drop log from Epochs.drop_log.
:term:`epochs` drop log from Epochs.drop_log.
ignore : list
The drop reasons to ignore.

Returns
-------
perc : float
Total percentage of epochs dropped.
Total percentage of :term:`epochs` dropped.
"""
if (
not isinstance(drop_log, tuple)
Expand Down