當前位置: 首頁>>代碼示例>>Python>>正文


Python io.read_raw_edf方法代碼示例

本文整理匯總了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 
開發者ID:hubertjb,項目名稱:dl-eeg-review,代碼行數:25,代碼來源:utils.py

示例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) 
開發者ID:perslev,項目名稱:U-Time,代碼行數:23,代碼來源:psg_file_loaders.py


注:本文中的mne.io.read_raw_edf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。