本文整理汇总了Python中mne.time_frequency.tfr.AverageTFR.plot_topo方法的典型用法代码示例。如果您正苦于以下问题:Python AverageTFR.plot_topo方法的具体用法?Python AverageTFR.plot_topo怎么用?Python AverageTFR.plot_topo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.time_frequency.tfr.AverageTFR
的用法示例。
在下文中一共展示了AverageTFR.plot_topo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_plot_tfr_topo
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import plot_topo [as 别名]
def test_plot_tfr_topo():
"""Test plotting of TFR data
"""
epochs = _get_epochs()
n_freqs = 3
nave = 1
data = np.random.randn(len(epochs.ch_names), n_freqs, len(epochs.times))
tfr = AverageTFR(epochs.info, data, epochs.times, np.arange(n_freqs), nave)
tfr.plot_topo(baseline=(None, 0), mode="ratio", title="Average power", vmin=0.0, vmax=14.0)
tfr.plot([4], baseline=(None, 0), mode="ratio")
示例2: test_plot_tfr_topo
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import plot_topo [as 别名]
def test_plot_tfr_topo():
"""Test plotting of TFR data."""
epochs = _get_epochs()
n_freqs = 3
nave = 1
data = np.random.RandomState(0).randn(len(epochs.ch_names),
n_freqs, len(epochs.times))
tfr = AverageTFR(epochs.info, data, epochs.times, np.arange(n_freqs), nave)
tfr.plot_topo(baseline=(None, 0), mode='ratio', title='Average power',
vmin=0., vmax=14., show=False)
tfr.plot([4], baseline=(None, 0), mode='ratio', show=False, title='foo')
示例3: test_plot
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import plot_topo [as 别名]
def test_plot():
"""Test TFR plotting."""
import matplotlib.pyplot as plt
data = np.zeros((3, 2, 3))
times = np.array([.1, .2, .3])
freqs = np.array([.10, .20])
info = mne.create_info(['MEG 001', 'MEG 002', 'MEG 003'], 1000.,
['mag', 'mag', 'mag'])
tfr = AverageTFR(info, data=data, times=times, freqs=freqs,
nave=20, comment='test', method='crazy-tfr')
tfr.plot([1, 2], title='title', colorbar=False,
mask=np.ones(tfr.data.shape[1:], bool))
plt.close('all')
ax = plt.subplot2grid((2, 2), (0, 0))
ax2 = plt.subplot2grid((2, 2), (1, 1))
ax3 = plt.subplot2grid((2, 2), (0, 1))
tfr.plot(picks=[0, 1, 2], axes=[ax, ax2, ax3])
plt.close('all')
tfr.plot([1, 2], title='title', colorbar=False, exclude='bads')
plt.close('all')
tfr.plot_topo(picks=[1, 2])
plt.close('all')
fig = tfr.plot(picks=[1], cmap='RdBu_r') # interactive mode on by default
fig.canvas.key_press_event('up')
fig.canvas.key_press_event(' ')
fig.canvas.key_press_event('down')
cbar = fig.get_axes()[0].CB # Fake dragging with mouse.
ax = cbar.cbar.ax
_fake_click(fig, ax, (0.1, 0.1))
_fake_click(fig, ax, (0.1, 0.2), kind='motion')
_fake_click(fig, ax, (0.1, 0.3), kind='release')
_fake_click(fig, ax, (0.1, 0.1), button=3)
_fake_click(fig, ax, (0.1, 0.2), button=3, kind='motion')
_fake_click(fig, ax, (0.1, 0.3), kind='release')
fig.canvas.scroll_event(0.5, 0.5, -0.5) # scroll down
fig.canvas.scroll_event(0.5, 0.5, 0.5) # scroll up
plt.close('all')
示例4: test_plot_tfr_topo
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import plot_topo [as 别名]
def test_plot_tfr_topo():
"""Test plotting of TFR data."""
import matplotlib.pyplot as plt
epochs = _get_epochs()
n_freqs = 3
nave = 1
data = np.random.RandomState(0).randn(len(epochs.ch_names),
n_freqs, len(epochs.times))
tfr = AverageTFR(epochs.info, data, epochs.times, np.arange(n_freqs), nave)
plt.close('all')
fig = tfr.plot_topo(baseline=(None, 0), mode='ratio',
title='Average power', vmin=0., vmax=14.)
# test opening tfr by clicking
num_figures_before = len(plt.get_fignums())
# could use np.reshape(fig.axes[-1].images[0].get_extent(), (2, 2)).mean(1)
with pytest.warns(None): # on old mpl there is a warning
_fake_click(fig, fig.axes[0], (0.08, 0.65))
assert num_figures_before + 1 == len(plt.get_fignums())
plt.close('all')
tfr.plot([4], baseline=(None, 0), mode='ratio', show=False, title='foo')
pytest.raises(ValueError, tfr.plot, [4], yscale='lin', show=False)
# nonuniform freqs
freqs = np.logspace(*np.log10([3, 10]), num=3)
tfr = AverageTFR(epochs.info, data, epochs.times, freqs, nave)
fig = tfr.plot([4], baseline=(None, 0), mode='mean', vmax=14., show=False)
assert fig.axes[0].get_yaxis().get_scale() == 'log'
# one timesample
tfr = AverageTFR(epochs.info, data[:, :, [0]], epochs.times[[1]],
freqs, nave)
with pytest.warns(None): # matplotlib equal left/right
tfr.plot([4], baseline=None, vmax=14., show=False, yscale='linear')
# one frequency bin, log scale required: as it doesn't make sense
# to plot log scale for one value, we test whether yscale is set to linear
vmin, vmax = 0., 2.
fig, ax = plt.subplots()
tmin, tmax = epochs.times[0], epochs.times[-1]
with pytest.warns(RuntimeWarning, match='not masking'):
_imshow_tfr(ax, 3, tmin, tmax, vmin, vmax, None, tfr=data[:, [0], :],
freq=freqs[[-1]], x_label=None, y_label=None,
colorbar=False, cmap=('RdBu_r', True), yscale='log')
fig = plt.gcf()
assert fig.axes[0].get_yaxis().get_scale() == 'linear'
# ValueError when freq[0] == 0 and yscale == 'log'
these_freqs = freqs[:3].copy()
these_freqs[0] = 0
with pytest.warns(RuntimeWarning, match='not masking'):
pytest.raises(ValueError, _imshow_tfr, ax, 3, tmin, tmax, vmin, vmax,
None, tfr=data[:, :3, :], freq=these_freqs, x_label=None,
y_label=None, colorbar=False, cmap=('RdBu_r', True),
yscale='log')
示例5: test_plot
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import plot_topo [as 别名]
def test_plot():
"""Test TFR plotting."""
import matplotlib.pyplot as plt
data = np.zeros((3, 2, 3))
times = np.array([0.1, 0.2, 0.3])
freqs = np.array([0.10, 0.20])
info = mne.create_info(["MEG 001", "MEG 002", "MEG 003"], 1000.0, ["mag", "mag", "mag"])
tfr = AverageTFR(info, data=data, times=times, freqs=freqs, nave=20, comment="test", method="crazy-tfr")
tfr.plot([1, 2], title="title")
plt.close("all")
ax = plt.subplot2grid((2, 2), (0, 0))
ax2 = plt.subplot2grid((2, 2), (1, 1))
ax3 = plt.subplot2grid((2, 2), (0, 1))
tfr.plot(picks=[0, 1, 2], axes=[ax, ax2, ax3])
plt.close("all")
tfr.plot_topo()
plt.close("all")
示例6: test_plot
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import plot_topo [as 别名]
def test_plot():
"""Test TFR plotting."""
import matplotlib
matplotlib.use('Agg') # for testing don't use X server
import matplotlib.pyplot as plt
data = np.zeros((3, 2, 3))
times = np.array([.1, .2, .3])
freqs = np.array([.10, .20])
info = mne.create_info(['MEG 001', 'MEG 002', 'MEG 003'], 1000.,
['mag', 'mag', 'mag'])
tfr = AverageTFR(info, data=data, times=times, freqs=freqs,
nave=20, comment='test', method='crazy-tfr')
tfr.plot([1, 2], title='title')
plt.close('all')
ax = plt.subplot2grid((2, 2), (0, 0))
ax2 = plt.subplot2grid((2, 2), (1, 1))
ax3 = plt.subplot2grid((2, 2), (0, 1))
tfr.plot(picks=[0, 1, 2], axes=[ax, ax2, ax3])
plt.close('all')
tfr.plot_topo()
plt.close('all')