本文整理汇总了Python中mne.EpochsArray.save方法的典型用法代码示例。如果您正苦于以下问题:Python EpochsArray.save方法的具体用法?Python EpochsArray.save怎么用?Python EpochsArray.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.EpochsArray
的用法示例。
在下文中一共展示了EpochsArray.save方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: cli
# 需要导入模块: from mne import EpochsArray [as 别名]
# 或者: from mne.EpochsArray import save [as 别名]
def cli(matfiles, savename, rec_type, infosrc):
"""
Convert brainstorm epochs to mne.Epochs object
"""
if infosrc:
if rec_type is 'ds':
from mne.io import read_raw_ctf as read_raw
elif rec_type is 'fif':
from mne.io import Raw as read_raw
with nostdout():
raw_with_info = read_raw(infosrc)
isFirst = True
for fname in matfiles:
with nostdout():
mat_epoch = sio.loadmat(fname)
# click.echo(mat_epoch)
if isFirst:
data = mat_epoch['F']
times = mat_epoch['Time']
# print times[0,-1]
isFirst = False
else:
data = np.dstack((data, mat_epoch['F']))
# click.echo(data.shape)
data = data.transpose((2,0,1))
n_channels = data.shape[1]
sfreq = times.shape[1] / (times[0,-1] + times[0,1])
if infosrc:
if rec_type is 'ds':
from mne.io import read_raw_ctf as read_raw
elif rec_type is 'fif':
from mne.io import Raw as read_raw
with nostdout():
raw_with_info = read_raw(infosrc)
good_info = raw_with_info.info
# click.echo(len(good_info['ch_names']))
ch_types = [channel_type(good_info, idx) for idx in range(n_channels)]
# click.echo(len(ch_types))
info = create_info(ch_names=good_info['ch_names'], sfreq=sfreq, ch_types=ch_types)
else:
ch_types='mag'
info = create_info(n_channels, sfreq, ch_types)
with nostdout():
epochs = EpochsArray(data, info)
epochs.save(savename)