conpy.restrict_forward_to_vertices

conpy.restrict_forward_to_vertices(fwd, vertno_or_idx, check_vertno=True, copy=True, verbose=None)

Restrict the forward model to the given vertices.

Note

The order of the vertices in vertno_or_idx does not matter. Forward objects will always have the vertices ordered by vertex number. This also means this function cannot be used to re-order the rows of the leadfield matrix.

Parameters
fwdinstance of Forward

The forward operator to restrict the vertices of.

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 forward solution 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
fwd_outinstance of Forward

The restricted forward operator.

See also

select_vertices_sens_distance

Find the vertices within the given sensor distance.