本文整理汇总了Python中mne.time_frequency.tfr.AverageTFR._onselect方法的典型用法代码示例。如果您正苦于以下问题:Python AverageTFR._onselect方法的具体用法?Python AverageTFR._onselect怎么用?Python AverageTFR._onselect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.time_frequency.tfr.AverageTFR
的用法示例。
在下文中一共展示了AverageTFR._onselect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_plot_tfr_topomap
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import _onselect [as 别名]
def test_plot_tfr_topomap():
"""Test plotting of TFR data
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
raw = _get_raw()
times = np.linspace(-0.1, 0.1, 200)
n_freqs = 3
nave = 1
rng = np.random.RandomState(42)
data = rng.randn(len(raw.ch_names), n_freqs, len(times))
tfr = AverageTFR(raw.info, data, times, np.arange(n_freqs), nave)
tfr.plot_topomap(ch_type="mag", tmin=0.05, tmax=0.150, fmin=0, fmax=10, res=16)
eclick = mpl.backend_bases.MouseEvent("button_press_event", plt.gcf().canvas, 0, 0, 1)
eclick.xdata = 0.1
eclick.ydata = 0.1
eclick.inaxes = plt.gca()
erelease = mpl.backend_bases.MouseEvent("button_release_event", plt.gcf().canvas, 0.9, 0.9, 1)
erelease.xdata = 0.3
erelease.ydata = 0.2
pos = [[0.11, 0.11], [0.25, 0.5], [0.0, 0.2], [0.2, 0.39]]
_onselect(eclick, erelease, tfr, pos, "mag", 1, 3, 1, 3, "RdBu_r", list())
tfr._onselect(eclick, erelease, None, "mean", None)
plt.close("all")
示例2: test_plot_tfr_topomap
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import _onselect [as 别名]
def test_plot_tfr_topomap():
"""Test plotting of TFR data."""
import matplotlib as mpl
import matplotlib.pyplot as plt
raw = read_raw_fif(raw_fname)
times = np.linspace(-0.1, 0.1, 200)
res = 8
n_freqs = 3
nave = 1
rng = np.random.RandomState(42)
picks = [93, 94, 96, 97, 21, 22, 24, 25, 129, 130, 315, 316, 2, 5, 8, 11]
info = pick_info(raw.info, picks)
data = rng.randn(len(picks), n_freqs, len(times))
tfr = AverageTFR(info, data, times, np.arange(n_freqs), nave)
tfr.plot_topomap(ch_type='mag', tmin=0.05, tmax=0.150, fmin=0, fmax=10,
res=res, contours=0)
eclick = mpl.backend_bases.MouseEvent('button_press_event',
plt.gcf().canvas, 0, 0, 1)
eclick.xdata = eclick.ydata = 0.1
eclick.inaxes = plt.gca()
erelease = mpl.backend_bases.MouseEvent('button_release_event',
plt.gcf().canvas, 0.9, 0.9, 1)
erelease.xdata = 0.3
erelease.ydata = 0.2
pos = [[0.11, 0.11], [0.25, 0.5], [0.0, 0.2], [0.2, 0.39]]
_onselect(eclick, erelease, tfr, pos, 'grad', 1, 3, 1, 3, 'RdBu_r', list())
_onselect(eclick, erelease, tfr, pos, 'mag', 1, 3, 1, 3, 'RdBu_r', list())
eclick.xdata = eclick.ydata = 0.
erelease.xdata = erelease.ydata = 0.9
tfr._onselect(eclick, erelease, None, 'mean', None)
plt.close('all')
# test plot_psds_topomap
info = raw.info.copy()
chan_inds = channel_indices_by_type(info)
info = pick_info(info, chan_inds['grad'][:4])
fig, axes = plt.subplots()
freqs = np.arange(3., 9.5)
bands = [(4, 8, 'Theta')]
psd = np.random.rand(len(info['ch_names']), freqs.shape[0])
plot_psds_topomap(psd, freqs, info, bands=bands, axes=[axes])