mne.simulation.select_source_in_label(src, label, random_state=None, location='random', subject=None, subjects_dir=None, surf='sphere')[source]

Select source positions using a label.

srclist of dict

The source space.


The label.

random_stateNone | int | instance of RandomState

If random_state is an int, it will be used as a seed for RandomState. If None, the seed will be obtained from the operating system (see RandomState for details). Default is None.


The label location to choose. Can be ‘random’ (default) or ‘center’ to use mne.Label.center_of_mass() (restricting to vertices both in the label and in the source space). Note that for ‘center’ mode the label values are used as weights.

New in version 0.13.

subjectstr | None

The subject the label is defined for. Only used with location='center'.

New in version 0.13.

subjects_dirstr | None

The path to the freesurfer subjects reconstructions. It corresponds to Freesurfer environment variable SUBJECTS_DIR.

New in version 0.13.


The surface to use for Euclidean distance center of mass finding. The default here is “sphere”, which finds the center of mass on the spherical surface to help avoid potential issues with cortical folding.

New in version 0.13.


Selected source coefficients on the left hemisphere.


Selected source coefficients on the right hemisphere.

Examples using mne.simulation.select_source_in_label