mne.add_source_space_distances#
- mne.add_source_space_distances(src, dist_limit=inf, n_jobs=None, *, verbose=None)[source]#
Compute inter-source distances along the cortical surface.
This function will also try to add patch info for the source space. It will only occur if the
dist_limit
is sufficiently high that all points on the surface are withindist_limit
of a point in the source space.- Parameters:
- srcinstance of
SourceSpaces
The source spaces to compute distances for.
- dist_limit
float
The upper limit of distances to include (in meters). Note: if limit < np.inf, scipy > 0.13 (bleeding edge as of 10/2013) must be installed. If 0, then only patch (nearest vertex) information is added.
- n_jobs
int
|None
The number of jobs to run in parallel. If
-1
, it is set to the number of CPU cores. Requires thejoblib
package.None
(default) is a marker for ‘unset’ that will be interpreted asn_jobs=1
(sequential execution) unless the call is performed under ajoblib.parallel_backend()
context manager that sets another value forn_jobs
. Ignored ifdist_limit==0.
.- verbose
bool
|str
|int
|None
Control verbosity of the logging output. If
None
, use the default verbosity level. See the logging documentation andmne.verbose()
for details. Should only be passed as a keyword argument.
- srcinstance of
- Returns:
- srcinstance of
SourceSpaces
The original source spaces, with distance information added. The distances are stored in src[n][‘dist’]. Note: this function operates in-place.
- srcinstance of
Notes
This function can be memory- and CPU-intensive. On a high-end machine (2012) running 6 jobs in parallel, an ico-5 (10242 per hemi) source space takes about 10 minutes to compute all distances (
dist_limit = np.inf
). Withdist_limit = 0.007
, computing distances takes about 1 minute.We recommend computing distances once per source space and then saving the source space to disk, as the computed distances will automatically be stored along with the source space data for future use.