mne.extract_label_time_course

mne.extract_label_time_course(stcs, labels, src, mode='mean_flip', allow_empty=False, return_generator=False, verbose=None)[source]

Extract label time course for lists of labels and source estimates.

This function will extract one time course for each label and source estimate. The way the time courses are extracted depends on the mode parameter (see Notes).

Parameters
stcsSourceEstimate | list (or generator) of SourceEstimate

The source estimates from which to extract the time course.

labelsLabel | BiHemiLabel | list of Label or BiHemiLabel

The labels for which to extract the time course.

srclist

Source spaces for left and right hemisphere.

modestr

Extraction mode, see explanation above.

allow_emptybool

Instead of emitting an error, return all-zero time courses for labels that do not have any vertices in the source estimate.

return_generatorbool

If True, a generator instead of a list is returned.

verbosebool, str, int, or None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

Returns
label_tcarray | list (or generator) of array, shape (n_labels, n_times)

Extracted time course for each label and source estimate.

Notes

Valid values for mode are:

'mean'

Average within each label.

'mean_flip'

Average within each label with sign flip depending on source orientation.

'pca_flip'

Apply an SVD to the time courses within each label and use the scaled and sign-flipped first right-singular vector as the label time course. The scaling is performed such that the power of the label time course is the same as the average per-vertex time course power within the label. The sign of the resulting time course is adjusted by multiplying it with “sign(dot(u, flip))” where u is the first left-singular vector, and flip is a sing-flip vector based on the vertex normals. This procedure assures that the phase does not randomly change by 180 degrees from one stc to the next.

'max'

Max value within each label.

If encountering a ValueError due to mismatch between number of source points in the subject source space and computed stc object set src argument to fwd['src'] to ensure the source space is compatible between forward and inverse routines.