本文整理汇总了Python中mne.EpochsArray.crop方法的典型用法代码示例。如果您正苦于以下问题:Python EpochsArray.crop方法的具体用法?Python EpochsArray.crop怎么用?Python EpochsArray.crop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.EpochsArray
的用法示例。
在下文中一共展示了EpochsArray.crop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StratifiedKFold
# 需要导入模块: from mne import EpochsArray [as 别名]
# 或者: from mne.EpochsArray import crop [as 别名]
# Setup data for epochs and cross validation
X = np.vstack([data_cls, data_pln])
y = np.concatenate([np.zeros(len(data_cls)), np.ones(len(data_pln))])
cv = StratifiedKFold(n_splits=10, shuffle=True)
# Create epochs to use for classification
n_trial, n_chan, n_time = X.shape
events = np.vstack((range(n_trial), np.zeros(n_trial, int), y.astype(int))).T
chan_names = ['MEG %i' % chan for chan in range(n_chan)]
chan_types = ['mag'] * n_chan
sfreq = 250
info = create_info(chan_names, sfreq, chan_types)
epochs = EpochsArray(data=X, info=info, events=events, verbose=False)
epochs.times = selected_times[:n_time]
epochs.crop(-3.8, None)
# fit model and score
gat = GeneralizationAcrossTime(
scorer="accuracy", cv=cv, predict_method="predict")
gat.fit(epochs, y=y)
gat.score(epochs, y=y)
# Save model
joblib.dump(gat, data_path + "decode_time_gen/%s_gat_tr.jl" % subject)
# make matrix plot and save it
fig = gat.plot(
cmap="viridis",
title="Temporal Gen (Classic vs planning) for transitivity.")
fig.savefig(data_path + "decode_time_gen/%s_gat_matrix_tr.png" % subject)