本文整理匯總了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)