mne_rsa.rdm_stcs#
- mne_rsa.rdm_stcs(stcs, src=None, spatial_radius=None, temporal_radius=None, dist_metric='sqeuclidean', dist_params={}, y=None, labels=None, n_folds=1, sel_vertices=None, sel_vertices_by_index=None, tmin=None, tmax=None, n_jobs=1, verbose=False)[source]#
Generate RDMs in a searchlight pattern on MNE-Python source estimates.
RDMs are computed using a patch surrounding each source point. Source estimate objects can be either defined along a cortical surface (
SourceEstimateobjects) or volumetric (VolSourceEstimateobjects). For surface source estimates, distances between vertices are measured in 2D space, namely as the length of the path along the surface from one vertex to another. For volume source estimates, distances are measured in 3D space as a straight line from one voxel to another.- Parameters:
- stcslist of mne.SourceEstimate | list of mne.VolSourceEstimate
For each item, a source estimate for the brain activity.
- srcinstance of mne.SourceSpaces | None
The source space used by the source estimates specified in the
stcsparameter. Only needed whenspatial_radiusis used to create spatial searchlight patches. Defaults to None.- spatial_radiusfloat | None
The spatial radius of the searchlight patch in meters. All source points within this radius will belong to the searchlight patch. When this is set,
srcalso must be set to the correct source space. Set to None to only perform the searchlight over time, flattening across sensors. Defaults to None.- temporal_radiusfloat | None
The temporal radius of the searchlight patch in seconds. Set to None to only perform the searchlight over sensors, flattening across time. Defaults to None.
- dist_metricstr
The metric to use to compute the RDM for the source estimates. This can be any metric supported by the scipy.distance.pdist function. See also the
stc_rdm_paramsparameter to specify and additional parameter for the distance function. Defaults to ‘sqeuclidean’.- dist_paramsdict
Extra arguments for the distance metric used to compute the RDMs. Refer to
scipy.spatial.distancefor a list of all other metrics and their arguments. Defaults to an empty dictionary.- yndarray of int, shape (n_items,) | None
Deprecated, use
labelsinstead. For each source estimate, a number indicating the item to which it belongs. Defaults toNone, in which caselabelsis used.- labelslist | None
For each source estimate, a label that identifies the item to which it corresponds. Multiple source estimates may correspond to the same item, in which case they should have the same label and will either be averaged when computing the data RDM (
n_folds=1) or used for cross-validation (n_folds>1). Labels may be of any python type that can be compared with==(int, float, string, tuple, etc). By default (None), the integers0:len(evokeds)are used as labels.Added in version 0.10.
- n_foldsint | sklearn.model_selection.BaseCrollValidator | None
Number of cross-validation folds to use when computing the distance metric. Folds are created based on the
yparameter. SpecifyNoneto use the maximum number of folds possible, given the data. Alternatively, you can pass a Scikit-Learn cross validator object (e.g.sklearn.model_selection.KFold) to assert fine-grained control over how folds are created. Defaults to 1 (no cross-validation).- sel_verticesmne.Label | list of mne.Label | list of ndarray | None
When set, searchlight patches will only be generated for the subset of ROI labels, or vertices/voxels with the given vertex numbers. When giving vertex numbers, supply a list of numpy arrays with for each hemisphere, the selected vertex numbers. For volume source spaces, supple a list with only a single element, with that element being the ndarray with vertex numbers. See also
sel_vertices_by_indexfor an alternative manner of selecting vertices.- sel_vertices_by_indexndarray of int, shape (n_vertices,)
When set, searchlight patches will only be generated for the subset of vertices with the given indices in the
stc.dataarray. See alsosel_verticesfor an alternative manner of selecting vertices.- tminfloat | None
When set, searchlight patches will only be generated from subsequent time points starting from this time point. This value is given in seconds. Defaults to
None, in which case patches are generated starting from the first time point.- tmaxfloat | None
When set, searchlight patches will only be generated up to and including this time point. This value is given in seconds. Defaults to
None, in which case patches are generated up to and including the last time point.- n_jobsint
The number of processes (=number of CPU cores) to use for the source-to-source distance computation. Specify -1 to use all available cores. Defaults to 1.
- verbosebool
Whether to display a progress bar. In order for this to work, you need the tqdm python module installed. Defaults to False.
- Yields:
- rdmndarray, shape (n_items, n_items)
A RDM for each searchlight patch.