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


Python sample.data_path方法代碼示例

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


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

示例1: mne_python

# 需要導入模塊: from mne.datasets import sample [as 別名]
# 或者: from mne.datasets.sample import data_path [as 別名]
def mne_python():
    subjects_dir = data_path + '/subjects'

    # Read data
    evoked = mne.read_evokeds(fname_evoked, condition='Left Auditory',
                              baseline=(None, 0))
    fwd = mne.read_forward_solution(fname_fwd)
    cov = mne.read_cov(fname_cov)

    inv = make_inverse_operator(evoked.info, fwd, cov, loose=0., depth=0.8,
                                verbose=True)

    snr = 3.0
    lambda2 = 1.0 / snr ** 2
    kwargs = dict(initial_time=0.08, hemi='both', subjects_dir=subjects_dir,
                  size=(600, 600))

    stc = abs(apply_inverse(evoked, inv, lambda2, 'MNE', verbose=True))
    stc = mne.SourceEstimate(stc.data * 1e10, stc.vertices, stc.tmin , stc.tstep, subject='sample')
    stc.save(data_path + '/MEG/sample/sample_audvis_MNE')
    # brain = stc.plot(figure=1, **kwargs)
    # brain.add_text(0.1, 0.9, 'MNE', 'title', font_size=14) 
開發者ID:pelednoam,項目名稱:mmvt,代碼行數:24,代碼來源:source_estimates.py

示例2: init_data

# 需要導入模塊: from mne.datasets import sample [as 別名]
# 或者: from mne.datasets.sample import data_path [as 別名]
def init_data():
    data_path = sample.data_path()
    raw_fname = data_path + '/MEG/sample/sample_audvis_raw.fif'
    fname_inv = data_path + '/MEG/sample/sample_audvis-meg-oct-6-meg-inv.fif'
    tmin, tmax, event_id = -0.2, 0.5, 1

    # Setup for reading the raw data
    raw = io.read_raw_fif(raw_fname)
    events = mne.find_events(raw, stim_channel='STI 014')
    inverse_operator = read_inverse_operator(fname_inv)

    # Setting the label
    label = mne.read_label(data_path + '/MEG/sample/labels/Aud-lh.label')

    include = []
    raw.info['bads'] += ['MEG 2443', 'EEG 053']  # bads + 2 more

    # picks MEG gradiometers
    picks = mne.pick_types(raw.info, meg=True, eeg=False, eog=True,
                           stim=False, include=include, exclude='bads')

    # Load condition 1
    event_id = 1
    # Use linear detrend to reduce any edge artifacts
    epochs = mne.Epochs(raw, events, event_id, tmin, tmax, picks=picks,
                        baseline=(None, 0), reject=dict(grad=4000e-13, eog=150e-6),
                        preload=True, detrend=1)
    return epochs, inverse_operator, label 
開發者ID:pelednoam,項目名稱:mmvt,代碼行數:30,代碼來源:source_estimate_power.py


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