conpy.restrict_src_to_vertices

conpy.restrict_src_to_vertices(src, vertno_or_idx, check_vertno=True, copy=True, verbose=None)

Restrict a source space to the given vertices.

Note

The order of the vertices in vertno_or_idx does not matter. SourceSpaces objects will always have the vertices ordered by vertex number.

Parameters
src: instance of SourceSpaces

The source space to be restricted.

vertno_or_idxtuple of lists (vertno_lh, vertno_rh) | list of int

Either, for each hemisphere, the vertex numbers to keep. Or a single list of vertex indices to keep. All other vertices are discarded.

check_vertnobool

Whether to check that all requested vertices are present in the SourceSpaces and raise an IndexError if this is not the case. Defaults to True. If all vertices are guaranteed to be present, you can disable this check for avoid unnecessary computation.

copybool

Whether to operate in place (False) to on a copy (True, the default).

verbosebool | str | int | None

If not None, override default verbose level (see mne.verbose() and Logging documentation for more).

Returns
src_outinstance of SourceSpaces

The restricted source space.