extract_label_time_course(stcs, labels, src, mode='mean_flip', allow_empty=False, return_generator=False, verbose=None)¶
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).
list(or generator) of
The source estimates from which to extract the time course.
The labels for which to extract the time course.
Source spaces for left and right hemisphere.
Extraction mode, see Notes.
Instead of emitting an error, return all-zero time courses for labels that do not have any vertices in the source estimate. Default is
If True, a generator instead of a list is returned.
Valid values for
Maximum value across vertices at each time point within each label.
Average across vertices at each time point within each label. Ignores orientation of sources.
Finds the dominant direction of source space normal vector orientations within each label, applies a sign-flip 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.
Applies singular value decomposition to the time courses within each label, and uses the first right-singular vector as the representative label time course. This signal is scaled so that its power matches the average (per-vertex) power within the label, and sign-flipped by multiplying by
np.sign(u @ flip), where
uis the first left-singular vector and
flipis the same sign-flip vector used when
mode='mean_flip'. This sign-flip ensures that extracting time courses from the same label in similar STCs does not result in 180° direction/phase changes.
If encountering a
ValueErrordue to mismatch between number of source points in the subject source space and computed
fwd['src']to ensure the source space is compatible between forward and inverse routines.