本文整理汇总了Python中mne.io.Raw.info['custom_ref_applied']方法的典型用法代码示例。如果您正苦于以下问题:Python Raw.info['custom_ref_applied']方法的具体用法?Python Raw.info['custom_ref_applied']怎么用?Python Raw.info['custom_ref_applied']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.io.Raw
的用法示例。
在下文中一共展示了Raw.info['custom_ref_applied']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_needs_eeg_average_ref_proj
# 需要导入模块: from mne.io import Raw [as 别名]
# 或者: from mne.io.Raw import info['custom_ref_applied'] [as 别名]
def test_needs_eeg_average_ref_proj():
"""Test checking whether a recording needs an EEG average reference"""
raw = Raw(raw_fname, add_eeg_ref=False, preload=False)
assert_true(_needs_eeg_average_ref_proj(raw.info))
raw = Raw(raw_fname, add_eeg_ref=True, preload=False)
assert_true(not _needs_eeg_average_ref_proj(raw.info))
# No EEG channels
raw = Raw(raw_fname, add_eeg_ref=False, preload=True)
eeg = [raw.ch_names[c] for c in pick_types(raw.info, meg=False, eeg=True)]
raw.drop_channels(eeg)
assert_true(not _needs_eeg_average_ref_proj(raw.info))
# Custom ref flag set
raw = Raw(raw_fname, add_eeg_ref=False, preload=False)
raw.info['custom_ref_applied'] = True
assert_true(not _needs_eeg_average_ref_proj(raw.info))
示例2: test_make_eeg_average_ref_proj
# 需要导入模块: from mne.io import Raw [as 别名]
# 或者: from mne.io.Raw import info['custom_ref_applied'] [as 别名]
def test_make_eeg_average_ref_proj():
"""Test EEG average reference projection"""
raw = Raw(raw_fname, add_eeg_ref=False, preload=True)
eeg = mne.pick_types(raw.info, meg=False, eeg=True)
# No average EEG reference
assert_true(not np.all(raw._data[eeg].mean(axis=0) < 1e-19))
# Apply average EEG reference
car = make_eeg_average_ref_proj(raw.info)
reref = raw.copy()
reref.add_proj(car)
reref.apply_proj()
assert_array_almost_equal(reref._data[eeg].mean(axis=0), 0, decimal=19)
# Error when custom reference has already been applied
raw.info['custom_ref_applied'] = True
assert_raises(RuntimeError, make_eeg_average_ref_proj, raw.info)