本文整理汇总了Python中mne.time_frequency.tfr.AverageTFR.pick_types方法的典型用法代码示例。如果您正苦于以下问题:Python AverageTFR.pick_types方法的具体用法?Python AverageTFR.pick_types怎么用?Python AverageTFR.pick_types使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.time_frequency.tfr.AverageTFR
的用法示例。
在下文中一共展示了AverageTFR.pick_types方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_channels
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import pick_types [as 别名]
def test_add_channels():
"""Test tfr splitting / re-appending channel types
"""
data = np.zeros((6, 2, 3))
times = np.array([.1, .2, .3])
freqs = np.array([.10, .20])
info = mne.create_info(
['MEG 001', 'MEG 002', 'MEG 003', 'EEG 001', 'EEG 002', 'STIM 001'],
1000., ['mag', 'mag', 'mag', 'eeg', 'eeg', 'stim'])
tfr = AverageTFR(info, data=data, times=times, freqs=freqs,
nave=20, comment='test', method='crazy-tfr')
tfr_eeg = tfr.pick_types(meg=False, eeg=True, copy=True)
tfr_meg = tfr.pick_types(meg=True, copy=True)
tfr_stim = tfr.pick_types(meg=False, stim=True, copy=True)
tfr_eeg_meg = tfr.pick_types(meg=True, eeg=True, copy=True)
tfr_new = tfr_meg.add_channels([tfr_eeg, tfr_stim], copy=True)
assert_true(all(ch in tfr_new.ch_names
for ch in tfr_stim.ch_names + tfr_meg.ch_names))
tfr_new = tfr_meg.add_channels([tfr_eeg], copy=True)
assert_true(ch in tfr_new.ch_names for ch in tfr.ch_names)
assert_array_equal(tfr_new.data, tfr_eeg_meg.data)
assert_true(all(ch not in tfr_new.ch_names
for ch in tfr_stim.ch_names))
# Now test errors
tfr_badsf = tfr_eeg.copy()
tfr_badsf.info['sfreq'] = 3.1415927
tfr_eeg = tfr_eeg.crop(-.1, .1)
assert_raises(RuntimeError, tfr_meg.add_channels, [tfr_badsf])
assert_raises(AssertionError, tfr_meg.add_channels, [tfr_eeg])
assert_raises(ValueError, tfr_meg.add_channels, [tfr_meg])
assert_raises(AssertionError, tfr_meg.add_channels, tfr_badsf)
示例2: test_add_channels
# 需要导入模块: from mne.time_frequency.tfr import AverageTFR [as 别名]
# 或者: from mne.time_frequency.tfr.AverageTFR import pick_types [as 别名]
def test_add_channels():
"""Test tfr splitting / re-appending channel types
"""
data = np.zeros((6, 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", "EEG 001", "EEG 002", "STIM 001"],
1000.0,
["mag", "mag", "mag", "eeg", "eeg", "stim"],
)
tfr = AverageTFR(info, data=data, times=times, freqs=freqs, nave=20, comment="test", method="crazy-tfr")
tfr_eeg = tfr.pick_types(meg=False, eeg=True, copy=True)
tfr_meg = tfr.pick_types(meg=True, copy=True)
tfr_stim = tfr.pick_types(meg=False, stim=True, copy=True)
tfr_eeg_meg = tfr.pick_types(meg=True, eeg=True, copy=True)
tfr_new = tfr_meg.add_channels([tfr_eeg, tfr_stim], copy=True)
assert_true(all(ch in tfr_new.ch_names for ch in tfr_stim.ch_names + tfr_meg.ch_names))
tfr_new = tfr_meg.add_channels([tfr_eeg], copy=True)
assert_true(ch in tfr_new.ch_names for ch in tfr.ch_names)
assert_array_equal(tfr_new.data, tfr_eeg_meg.data)
assert_true(all(ch not in tfr_new.ch_names for ch in tfr_stim.ch_names))
# Now test errors
tfr_badsf = tfr_eeg.copy()
tfr_badsf.info["sfreq"] = 3.1415927
tfr_eeg = tfr_eeg.crop(-0.1, 0.1)
assert_raises(RuntimeError, tfr_meg.add_channels, [tfr_badsf])
assert_raises(AssertionError, tfr_meg.add_channels, [tfr_eeg])
assert_raises(ValueError, tfr_meg.add_channels, [tfr_meg])
assert_raises(AssertionError, tfr_meg.add_channels, tfr_badsf)