本文整理汇总了Python中mne.Epochs._data方法的典型用法代码示例。如果您正苦于以下问题:Python Epochs._data方法的具体用法?Python Epochs._data怎么用?Python Epochs._data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.Epochs
的用法示例。
在下文中一共展示了Epochs._data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_epochs
# 需要导入模块: from mne import Epochs [as 别名]
# 或者: from mne.Epochs import _data [as 别名]
def _get_epochs(subject):
# if already computed, lets load it from disk
epo_fname = paths('epochs_vhp', subject=subject)
if op.exists(epo_fname):
return load('epochs_vhp', subject=subject, preload=True)
# high pass filter and epoch
for block in range(1, 6):
raw = load('sss', subject=subject, block=block, preload=True)
# Explicit picking of channel to ensure same channels across subjects
picks = ['STI101', 'EEG060', 'EOG061', 'EOG062', 'ECG063', 'EEG064',
'MISC004']
# Potentially add forgotten channels
ch_type = dict(STI='stim', EEG='eeg', EOG='eog', ECG='ecg',
MIS='misc')
missing_chans = list()
for channel in picks:
if channel not in raw.ch_names:
missing_chans.append(channel)
if missing_chans:
info = create_info(missing_chans, raw.info['sfreq'],
[ch_type[ch[:3]] for ch in missing_chans])
raw.add_channels([RawArray(
np.zeros((len(missing_chans), raw.n_times)), info,
raw.first_samp)], force_update_info=True)
# Select same channels order across subjects
picks = [np.where(np.array(raw.ch_names) == ch)[0][0] for ch in picks]
picks = np.r_[np.arange(306), picks]
# Filtered
raw.filter(2, 30, l_trans_bandwidth=.5, filter_length='30s',
n_jobs=1)
# Ensure same sampling rate
if raw.info['sfreq'] != 1000.0:
raw.resample(1000.0)
# Select events
events = find_events(raw, stim_channel='STI101', shortest_event=1)
sel = np.where(events[:, 2] <= 255)[0]
events = events[sel, :]
# Compensate for delay (as measured manually with photodiod
events[1, :] += int(.050 * raw.info['sfreq'])
# Epoch continuous data
this_epochs = Epochs(raw, events, reject=None, tmin=-.200, tmax=1.6,
picks=picks, baseline=None, decim=10)
save(this_epochs, 'epo_block', subject=subject, block=block)
this_epochs._data = None
raw.data = None
del this_epochs, raw
epochs = list()
for block in range(1, 6):
this_epochs = load('epo_block', subject=subject, block=block)
epochs.append(this_epochs)
epochs = concatenate_epochs(epochs)
# save for faster retest
save(epochs, 'epochs_vhp', subject=subject, overwrite=True, upload=False)
return epochs