Skip to content

Instantly share code, notes, and snippets.

@agramfort
Created March 26, 2013 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agramfort/5244414 to your computer and use it in GitHub Desktop.
Save agramfort/5244414 to your computer and use it in GitHub Desktop.
BEM surface stats
# Author: Alexandre Gramfort <gramfort@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)
import numpy as np
from sklearn import neighbors
import mne
from mne.datasets import sample
data_path = sample.data_path()
fname = data_path + '/subjects/sample/bem/sample-5120-5120-5120-bem-sol.fif'
surfaces = mne.read_bem_surfaces(fname, add_geom=True)
print "Number of surfaces : %d" % len(surfaces)
for name, surf in zip(('head', 'skull', 'brain'), surfaces):
points = surf['rr']
nb = neighbors.NearestNeighbors(n_neighbors=2)
nb.fit(points)
G = nb.kneighbors(points, return_distance=True)
print name, np.mean(G[0][:, 1])
@agramfort
Copy link
Author

output is:

head 0.00721512121192
skull 0.0057216261293
brain 0.00540786011339

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment