本文整理汇总了Python中mne.io.read_raw_edf方法的典型用法代码示例。如果您正苦于以下问题:Python io.read_raw_edf方法的具体用法?Python io.read_raw_edf怎么用?Python io.read_raw_edf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.io
的用法示例。
在下文中一共展示了io.read_raw_edf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_real_eeg_data
# 需要导入模块: from mne import io [as 别名]
# 或者: from mne.io import read_raw_edf [as 别名]
def get_real_eeg_data(start=0, stop=4, chans=4):
"""Get real EEG data for plotting.
Keyword Args:
start (float): start of the EEG segment, in seconds.
stop (float): end of the EEG segment, in seconds.
chans (int or list): number of channels to extract, or list of channel
indices to be interpreted by MNE's get_data() function.
"""
raw_fnames = eegbci.load_data(1, 2)
raws = [read_raw_edf(f, preload=True) for f in raw_fnames]
raw = concatenate_raws(raws)
fs = raw.info['sfreq']
start = int(fs * start)
stop = int(fs * stop)
if not isinstance(chans, list):
chans = np.arange(chans)
data, t = raw.get_data(picks=chans, start=start, stop=stop, return_times=True)
data = data.T
return data, t, fs
示例2: load_edf
# 需要导入模块: from mne import io [as 别名]
# 或者: from mne.io import read_raw_edf [as 别名]
def load_edf(file_path, load_channels, **kwargs):
"""
File loader function for .edf extension files.
Redirects to mne.io.read_raw_edf.
If load_channels is specified, read_raw_edf is called twice:
1st time used to load the available channel names
2nd time used to load with the 'exclude' parameter set - excluding all
channel names in the file not in 'load_channels'.
Returns:
mne.io.RawEDF object
"""
from mne.io import read_raw_edf
edf = read_raw_edf(file_path, preload=False,
stim_channel=None, verbose=False)
if not load_channels:
return edf
else:
exclude = _get_excludes(edf.info["ch_names"], load_channels)
return read_raw_edf(file_path, preload=False, exclude=exclude,
stim_channel=None, verbose=False)