roiextract.pipeline.MeanAggregation#

class roiextract.pipeline.MeanAggregation(flip=False)#

Averaging-based aggregation of reconstructed source time courses within the ROI. Optionally, a sign flip can be applied before averaging to reduce potential cancellation of activity. This pipeline step corresponds to the mne.extract_label_time_course() function with mode="mean" or mode="mean_flip".

Parameters:
flipbool, default=False

Whether to apply a sign flip before averaging. Sign flip is determined based on the singular value decomposition of the leadfield, as performed in mne.label_sign_flip().

Methods

fit(data, src, labels)

Fit the aggregation step to the provided data, source space, and labels.

fit_transform(data, src, labels)

Fit the aggregation step to the provided data, source space, and labels, and apply the aggregation to extract the ROI time courses.

get_names()

Label names are used as names for rows of the weight matrix.

get_params()

Get the single flip parameter of the aggregation step as a dictionary.

get_weights()

Weight matrix corresponding to the resulting aggregation transformation.

transform(data)

Apply the fitted aggregation to the provided data.

fit(data, src, labels)#

Fit the aggregation step to the provided data, source space, and labels.

Parameters:
dataSourceEstimate

The source estimate containing the reconstructed source time courses.

srcSourceSpaces

The definition of the considered source space for inverse modeling.

labelsLabel | list of Label

The label or list of labels defining the ROIs for which time courses should be extracted.

Returns:
selfMeanAggregation

The fitted aggregation step.

fit_transform(data, src, labels)#

Fit the aggregation step to the provided data, source space, and labels, and apply the aggregation to extract the ROI time courses. See fit() and transform() for details on the parameters and return values, respectively.

get_names()#

Label names are used as names for rows of the weight matrix.

Returns:
row_nameslist of str

Names for rows of the weight matrix.

get_params()#

Get the single flip parameter of the aggregation step as a dictionary.

Returns:
paramsdict

The parameters of the aggregation step.

get_weights()#

Weight matrix corresponding to the resulting aggregation transformation.

Returns:
weightsarray

The weight matrix.

transform(data)#

Apply the fitted aggregation to the provided data. The applied transformation corresponds to the mne.extract_label_time_course() function with mode="mean" or mode="mean_flip" for flip=False and flip=True, respectively.

Parameters:
dataSourceEstimate

The source estimate containing the reconstructed source time courses.

Returns:
label_tcarray, shape (n_labels, n_times)

The extracted time courses for each label.