本文整理汇总了Python中mne.fiff.Raw.info["bads"]方法的典型用法代码示例。如果您正苦于以下问题:Python Raw.info["bads"]方法的具体用法?Python Raw.info["bads"]怎么用?Python Raw.info["bads"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.fiff.Raw
的用法示例。
在下文中一共展示了Raw.info["bads"]方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_load_bad_channels
# 需要导入模块: from mne.fiff import Raw [as 别名]
# 或者: from mne.fiff.Raw import info["bads"] [as 别名]
def test_load_bad_channels():
"""Test reading/writing of bad channels
"""
# Load correctly marked file (manually done in mne_process_raw)
raw_marked = Raw(fif_bad_marked_fname)
correct_bads = raw_marked.info["bads"]
raw = Raw(fif_fname)
# Make sure it starts clean
assert_array_equal(raw.info["bads"], [])
# Test normal case
raw.load_bad_channels(bad_file_works)
# Write it out, read it in, and check
raw.save("foo_raw.fif")
raw_new = Raw("foo_raw.fif")
assert_equal(correct_bads, raw_new.info["bads"])
# Reset it
raw.info["bads"] = []
# Test bad case
assert_raises(ValueError, raw.load_bad_channels, bad_file_wrong)
# Test forcing the bad case
with warnings.catch_warnings(record=True) as w:
raw.load_bad_channels(bad_file_wrong, force=True)
assert_equal(len(w), 1)
# write it out, read it in, and check
raw.save("foo_raw.fif")
raw_new = Raw("foo_raw.fif")
assert_equal(correct_bads, raw_new.info["bads"])
# Check that bad channels are cleared
raw.load_bad_channels(None)
raw.save("foo_raw.fif")
raw_new = Raw("foo_raw.fif")
assert_equal([], raw_new.info["bads"])
示例2: Raw
# 需要导入模块: from mne.fiff import Raw [as 别名]
# 或者: from mne.fiff.Raw import info["bads"] [as 别名]
from mne.beamformer import lcmv
data_path = sample.data_path()
raw_fname = data_path + "/MEG/sample/sample_audvis_raw.fif"
event_fname = data_path + "/MEG/sample/sample_audvis_raw-eve.fif"
fname_fwd = data_path + "/MEG/sample/sample_audvis-meg-vol-7-fwd.fif"
fname_cov = data_path + "/MEG/sample/sample_audvis-cov.fif"
###############################################################################
# Get epochs
event_id, tmin, tmax = 1, -0.2, 0.5
# Setup for reading the raw data
raw = Raw(raw_fname)
raw.info["bads"] = ["MEG 2443", "EEG 053"] # 2 bads channels
events = mne.read_events(event_fname)
# Set up pick list: EEG + MEG - bad channels (modify to your needs)
left_temporal_channels = mne.read_selection("Left-temporal")
picks = pick_types(raw.info, meg=True, eeg=False, stim=True, eog=True, exclude="bads", selection=left_temporal_channels)
# Read epochs
epochs = mne.Epochs(
raw,
events,
event_id,
tmin,
tmax,
proj=True,
picks=picks,