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


Python mne.set_log_level方法代碼示例

本文整理匯總了Python中mne.set_log_level方法的典型用法代碼示例。如果您正苦於以下問題:Python mne.set_log_level方法的具體用法?Python mne.set_log_level怎麽用?Python mne.set_log_level使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mne的用法示例。


在下文中一共展示了mne.set_log_level方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: interpolate_bads

# 需要導入模塊: import mne [as 別名]
# 或者: from mne import set_log_level [as 別名]
def interpolate_bads(inst, picks, dots=None, reset_bads=True, mode='accurate'):
    """Interpolate bad MEG and EEG channels."""
    import mne
    # to prevent cobyla printf error
    # XXX putting to critical for now unless better solution
    # emerges
    verbose = mne.set_log_level('CRITICAL', return_old_level=True)

    eeg_picks = set(pick_types(inst.info, meg=False, eeg=True, exclude=[]))
    eeg_picks_interp = [p for p in picks if p in eeg_picks]
    if len(eeg_picks_interp) > 0:
        _interpolate_bads_eeg(inst, picks=eeg_picks_interp)

    meg_picks = set(pick_types(inst.info, meg=True, eeg=False, exclude=[]))
    meg_picks_interp = [p for p in picks if p in meg_picks]
    if len(meg_picks_interp) > 0:
        _interpolate_bads_meg_fast(inst, picks=meg_picks_interp,
                                   dots=dots, mode=mode)

    if reset_bads is True:
        inst.info['bads'] = []

    mne.set_log_level(verbose)

    return inst 
開發者ID:autoreject,項目名稱:autoreject,代碼行數:27,代碼來源:utils.py

示例2: _fast_map_meg_channels

# 需要導入模塊: import mne [as 別名]
# 或者: from mne import set_log_level [as 別名]
def _fast_map_meg_channels(info, pick_from, pick_to,
                           dots=None, mode='fast'):
    from mne.io.pick import pick_info
    from mne.forward._field_interpolation import _setup_dots
    from mne.forward._field_interpolation import _compute_mapping_matrix
    from mne.forward._make_forward import _create_meg_coils, _read_coil_defs
    from mne.bem import _check_origin

    miss = 1e-4  # Smoothing criterion for MEG

    # XXX: hack to silence _compute_mapping_matrix
    verbose = mne.get_config('MNE_LOGGING_LEVEL', 'INFO')
    mne.set_log_level('WARNING')

    info_from = pick_info(info, pick_from, copy=True)
    templates = _read_coil_defs()
    coils_from = _create_meg_coils(info_from['chs'], 'normal',
                                   info_from['dev_head_t'], templates)
    my_origin = _check_origin((0., 0., 0.04), info_from)
    int_rad, noise, lut_fun, n_fact = _setup_dots(mode, coils_from, 'meg')

    # This function needs a clean input. It hates the presence of other
    # channels than MEG channels. Make sure all is picked.
    if dots is None:
        dots = self_dots, cross_dots = _compute_dots(info, mode=mode)
    else:
        self_dots, cross_dots = dots

    self_dots, cross_dots = _pick_dots(dots, pick_from, pick_to)

    ch_names = [c['ch_name'] for c in info_from['chs']]
    fmd = dict(kind='meg', ch_names=ch_names,
               origin=my_origin, noise=noise, self_dots=self_dots,
               surface_dots=cross_dots, int_rad=int_rad, miss=miss)

    fmd['data'] = _compute_mapping_matrix(fmd, info_from)
    mne.set_log_level(verbose)

    return fmd['data'] 
開發者ID:autoreject,項目名稱:autoreject,代碼行數:41,代碼來源:utils.py

示例3: raw

# 需要導入模塊: import mne [as 別名]
# 或者: from mne import set_log_level [as 別名]
def raw():
    """Fixture for physionet EEG subject 4, dataset 1."""
    mne.set_log_level("WARNING")
    # load in subject 1, run 1 dataset
    edf_fpath = eegbci.load_data(4, 1, update_path=True)[0]

    # using sample EEG data (https://physionet.org/content/eegmmidb/1.0.0/)
    raw = mne.io.read_raw_edf(edf_fpath, preload=True)

    # The eegbci data has non-standard channel names. We need to rename them:
    eegbci.standardize(raw)

    return raw 
開發者ID:sappelhoff,項目名稱:pyprep,代碼行數:15,代碼來源:conftest.py

示例4: load_data

# 需要導入模塊: import mne [as 別名]
# 或者: from mne import set_log_level [as 別名]
def load_data(n_trials=10, data_type='rest', sfreq=150, epoch=None,
              filter_params=[5., None], equalize="zeropad", n_jobs=1,
              random_state=None):
    """Load and prepare the HCP dataset for multiCSC


    Parameters
    ----------
    n_trials : int
        Number of recordings that are loaded.
    data_type : str
        Type of recordings loaded. Should be in {'rest', 'task_working_memory',
        'task_motor', 'task_story_math', 'noise_empty_room', 'noise_subject'}.
    sfreq : float
        Sampling frequency of the signal. The data are resampled to match it.
    epoch : tuple or None
        If set to a tuple, extract epochs from the raw data, using
        t_min=epoch[0] and t_max=epoch[1]. Else, use the raw signal, divided
        in n_splits chunks.
    filter_params : tuple
        Frequency cut for a band pass filter applied to the signals. The
        default is a high-pass filter with frequency cut at 2Hz.
    n_jobs : int
        Number of jobs that can be used for preparing (filtering) the data.
    random_state : int | None
        State to seed the random number generator.

    Return
    ------
    X : ndarray, shape (n_trials, n_channels, n_times)
        Signals loaded from HCP.
    info : list of mne.Info
        List of the info related to each signals.
    """
    if data_type == "rest" and epoch is not None:
        raise ValueError("epoch != None is not valid with resting-state data.")

    rng = check_random_state(random_state)
    mne.set_log_level(30)

    db = get_all_records()
    records = [(subject, run_index)
               for subject, runs in db[data_type].items()
               for run_index in runs]

    X, info = [], []
    records = rng.permutation(records)[:n_trials]
    for i, (subject, run_index) in enumerate(records):
        print("\rLoading HCP subjects: {:7.2%}".format(i / n_trials),
              end='', flush=True)
        X_n, info_n = load_one_record(
            data_type, subject, int(run_index), sfreq=sfreq, epoch=epoch,
            filter_params=filter_params, n_jobs=n_jobs)
        X += [X_n]
        info += [info_n]

    print("\rLoading HCP subjects: done   ")
    X = make_array(X, equalize=equalize)
    X /= np.std(X)
    return X, info 
開發者ID:alphacsc,項目名稱:alphacsc,代碼行數:62,代碼來源:hcp.py

示例5: data_generator

# 需要導入模塊: import mne [as 別名]
# 或者: from mne import set_log_level [as 別名]
def data_generator(n_trials=10, data_type='rest', sfreq=150, epoch=None,
                   filter_params=[5., None], equalize="zeropad", n_jobs=1,
                   random_state=None):
    """Generator loading subjects from the HCP dataset for multiCSC


    Parameters
    ----------
    n_trials : int
        Number of recordings that are loaded.
    data_type : str
        Type of recordings loaded. Should be in {'rest', 'task_working_memory',
        'task_motor', 'task_story_math', 'noise_empty_room', 'noise_subject'}.
    sfreq : float
        Sampling frequency of the signal. The data are resampled to match it.
    epoch : tuple or None
        If set to a tuple, extract epochs from the raw data, using
        t_min=epoch[0] and t_max=epoch[1]. Else, use the raw signal, divided
        in n_splits chunks.
    filter_params : tuple
        Frequency cut for a band pass filter applied to the signals. The
        default is a high-pass filter with frequency cut at 2Hz.
    n_jobs : int
        Number of jobs that can be used for preparing (filtering) the data.
    random_state : int | None
        State to seed the random number generator.

    Yields
    ------
    X : ndarray, shape (1, n_channels, n_times)
        Signals loaded from HCP.
    info : list of mne.Info
        info related to this signal.
    """
    if data_type == "rest" and epoch is not None:
        raise ValueError("epoch != None is not valid with resting-state data.")

    rng = check_random_state(random_state)
    mne.set_log_level(30)

    db = get_all_records()
    records = [(subject, run_index)
               for subject, runs in db[data_type].items()
               for run_index in runs]

    records = rng.permutation(records)[:n_trials]
    for i, (subject, run_index) in enumerate(records):
        try:
            X_n, info_n = load_one_record(
                data_type, subject, int(run_index), sfreq=sfreq, epoch=epoch,
                filter_params=filter_params, n_jobs=n_jobs)
            X_n /= X_n.std()
            yield X_n, info_n
        except UnicodeDecodeError:
            print("failed to load {}-{}-{}"
                  .format(subject, data_type, run_index)) 
開發者ID:alphacsc,項目名稱:alphacsc,代碼行數:58,代碼來源:hcp.py


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