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
 stcs
SourceEstimate
list
(or generator) ofSourceEstimate
The source estimates from which to extract the time course.
 labels
Label
BiHemiLabel
list
ofLabel
orBiHemiLabel
The labels for which to extract the time course.
 src
list
Source spaces for left and right hemisphere.
 mode
str
Extraction mode, see Notes.
 allow_emptybool
Instead of emitting an error, return allzero time courses for labels that do not have any vertices in the source estimate. Default is
False
. return_generatorbool
If True, a generator instead of a list is returned.
 verbosebool,
str
,int
, orNone
If not None, override default verbose level (see
mne.verbose()
and Logging documentation for more).
 stcs
 Returns
Notes
Valid values for
mode
are:'max'
Maximum value across vertices at each time point within each label.
'mean'
Average across vertices at each time point within each label. Ignores orientation of sources.
'mean_flip'
Finds the dominant direction of source space normal vector orientations within each label, applies a signflip to time series at vertices whose orientation is more than 180° different from the dominant direction, and then averages across vertices at each time point within each label.
'pca_flip'
Applies singular value decomposition to the time courses within each label, and uses the first rightsingular vector as the representative label time course. This signal is scaled so that its power matches the average (pervertex) power within the label, and signflipped by multiplying by
np.sign(u @ flip)
, whereu
is the first leftsingular vector andflip
is the same signflip vector used whenmode='mean_flip'
. This signflip ensures that extracting time courses from the same label in similar STCs does not result in 180° direction/phase changes.
If encountering a
ValueError
due to mismatch between number of source points in the subject source space and computedstc
object setsrc
argument tofwd['src']
to ensure the source space is compatible between forward and inverse routines.