本文整理汇总了Python中mne.Epochs.set_eeg_reference方法的典型用法代码示例。如果您正苦于以下问题:Python Epochs.set_eeg_reference方法的具体用法?Python Epochs.set_eeg_reference怎么用?Python Epochs.set_eeg_reference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.Epochs
的用法示例。
在下文中一共展示了Epochs.set_eeg_reference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_xdawn_regularization
# 需要导入模块: from mne import Epochs [as 别名]
# 或者: from mne.Epochs import set_eeg_reference [as 别名]
def test_xdawn_regularization():
"""Test Xdawn with regularization."""
# Get data
raw, events, picks = _get_data()
epochs = Epochs(raw, events, event_id, tmin, tmax, picks=picks,
preload=True, baseline=None, verbose=False)
# Test with overlapping events.
# modify events to simulate one overlap
events = epochs.events
sel = np.where(events[:, 2] == 2)[0][:2]
modified_event = events[sel[0]]
modified_event[0] += 1
epochs.events[sel[1]] = modified_event
# Fit and check that overlap was found and applied
xd = Xdawn(n_components=2, correct_overlap='auto', reg='oas')
xd.fit(epochs)
assert_equal(xd.correct_overlap_, True)
evoked = epochs['cond2'].average()
assert_true(np.sum(np.abs(evoked.data - xd.evokeds_['cond2'].data)))
# With covariance regularization
for reg in [.1, 0.1, 'ledoit_wolf', 'oas']:
xd = Xdawn(n_components=2, correct_overlap=False,
signal_cov=np.eye(len(picks)), reg=reg)
xd.fit(epochs)
# With bad shrinkage
xd = Xdawn(n_components=2, correct_overlap=False,
signal_cov=np.eye(len(picks)), reg=2)
assert_raises(ValueError, xd.fit, epochs)
# With rank-deficient input
epochs.set_eeg_reference(['EEG 001'])
xd = Xdawn(correct_overlap=False, reg=None)
assert_raises(ValueError, xd.fit, epochs)
xd = Xdawn(correct_overlap=False, reg=0.5)
xd.fit(epochs)