本文整理汇总了Python中mesh.Mesh.plot方法的典型用法代码示例。如果您正苦于以下问题:Python Mesh.plot方法的具体用法?Python Mesh.plot怎么用?Python Mesh.plot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mesh.Mesh
的用法示例。
在下文中一共展示了Mesh.plot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Mesh
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import plot [as 别名]
x_simu = np.zeros(n_dipoles)
dipole_idx = 1000
x_simu[dipole_idx] = 1
# compute forward model
m = np.dot(G_eeg, x_simu)
# add measurement noise
m += 1e-8 * np.random.randn(*m.shape)
# show topography
electrodes_mesh = Mesh("data/model/eeg_channels_mesh.tri")
mlab.figure(1)
mlab.clf()
electrodes_mesh.plot(opacity=1, scalars=m)
###############################################################################
# Run minimum norm
def minimum_norm(m, G, lambd):
"""Compute basic Minimum Norm solution.
x = G^T (G * G^T + lambda * I)^(-1) m
Note
----
This is a very naive implementation as no depth weighting is used
and no data whitening is performed which is crucial for real data.
This is therefore only illustrative.
"""
示例2: Mesh
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import plot [as 别名]
print __doc__
# define some nice colors for the surfaces
head_col = (0.95, 0.83, 0.83) # light pink
skull_col = (0.91, 0.89, 0.67)
brain_col = (0.67, 0.89, 0.91) # light blue
cortex_col = (0.68, 0.68, 0.68) # grey
head = Mesh("data/model/head.tri")
brain = Mesh("data/model/skull.tri")
skull = Mesh("data/model/brain.tri")
cortex = Mesh("data/model/cortex.tri")
mlab.clf()
head.plot(color=head_col, opacity=0.3)
skull.plot(color=skull_col, opacity=0.3)
brain.plot(color=brain_col, opacity=0.3)
cortex.plot(color=cortex_col, opacity=1)
# View EEG electrodes
electrodes = np.loadtxt('data/model/eeg_channels_locations.txt')
mlab.points3d(electrodes[:, 0], electrodes[:, 1], electrodes[:, 2],
opacity=0.5, scale_factor=6)
# View MEG squids
squids = np.loadtxt('data/model/meg_channels_locations.squids')
mlab.quiver3d(squids[:, 0], squids[:, 1], squids[:, 2],
-squids[:, 3], -squids[:, 4], -squids[:, 5],
opacity=0.5, scale_factor=10, mode='cone')
示例3:
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import plot [as 别名]
##############################################################################
# Load 4 leadfields
G_meg = om.loadmat('leadfields/meg_leadfield.mat')
G_eeg = om.loadmat('leadfields/eeg_leadfield.mat')
G_eit = om.loadmat('leadfields/eit_leadfield.mat')
G_ip = om.loadmat('leadfields/ip_leadfield.mat')
G_ecog = om.loadmat('leadfields/ecog_leadfield.mat')
###############################################################################
# EEG leadfield
mlab.figure(1)
mlab.clf()
eeg_chan_idx = 28
cortex.plot(opacity=1, scalars=G_eeg[eeg_chan_idx, :])
# view EEG electrodes
mlab.points3d(eeg_electrodes[[eeg_chan_idx], 0],
eeg_electrodes[[eeg_chan_idx], 1],
eeg_electrodes[[eeg_chan_idx], 2],
opacity=0.5, scale_factor=12, color=(1, 0, 0))
###############################################################################
# ECoG leadfield
mlab.figure(2)
mlab.clf()
ecog_chan_idx = 0
cortex.plot(opacity=1, scalars=G_ecog[ecog_chan_idx, :])
# view EEG electrodes
示例4: Mesh
# 需要导入模块: from mesh import Mesh [as 别名]
# 或者: from mesh.Mesh import plot [as 别名]
from enthought.mayavi import mlab
# define some nice colors for the surfaces
head_col = (0.95, 0.83, 0.83) # light pink
skull_col = (0.91, 0.89, 0.67)
brain_col = (0.67, 0.89, 0.91) # light blue
cortex_col = (0.68, 0.68, 0.68) # grey
head = Mesh("head.tri")
brain = Mesh("skull.tri")
skull = Mesh("brain.tri")
cortex = Mesh("cortex.tri")
mlab.clf()
head.plot(color=head_col, opacity=0.3)
skull.plot(color=skull_col, opacity=0.3)
brain.plot(color=brain_col, opacity=0.3)
cortex.plot(opacity=1, scalars=cortex.normals[:,0])
# View EEG electrodes
electrodes = np.loadtxt('eeg_channels_locations.txt')
mlab.points3d(electrodes[:,0], electrodes[:,1], electrodes[:,2], opacity=0.5,
scale_factor=6)
# View MEG squids
squids = np.loadtxt('meg_channels_locations.squids')
mlab.quiver3d(squids[:,0], squids[:,1], squids[:,2],
-squids[:,3], -squids[:,4], -squids[:,5],
opacity=0.5, scale_factor=10, mode='cone')