本文整理汇总了Python中mne.fiff.Raw.index_as_time方法的典型用法代码示例。如果您正苦于以下问题:Python Raw.index_as_time方法的具体用法?Python Raw.index_as_time怎么用?Python Raw.index_as_time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mne.fiff.Raw
的用法示例。
在下文中一共展示了Raw.index_as_time方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_raw_index_as_time
# 需要导入模块: from mne.fiff import Raw [as 别名]
# 或者: from mne.fiff.Raw import index_as_time [as 别名]
def test_raw_index_as_time():
""" Test index as time conversion"""
raw = Raw(fif_fname, preload=True)
t0 = raw.index_as_time([0], True)[0]
t1 = raw.index_as_time([100], False)[0]
t2 = raw.index_as_time([100], True)[0]
assert_true((t2 - t1) == t0)
示例2: test_raw_index_as_time
# 需要导入模块: from mne.fiff import Raw [as 别名]
# 或者: from mne.fiff.Raw import index_as_time [as 别名]
def test_raw_index_as_time():
""" Test index as time conversion"""
raw = Raw(fif_fname, preload=True)
t0 = raw.index_as_time([0], True)[0]
t1 = raw.index_as_time([100], False)[0]
t2 = raw.index_as_time([100], True)[0]
assert_true((t2 - t1) == t0)
# ensure we can go back and forth
t3 = raw.index_as_time(raw.time_as_index([0], True), True)
assert_array_almost_equal(t3, [0.0], 2)
t3 = raw.index_as_time(raw.time_as_index(raw.info['sfreq'], True), True)
assert_array_almost_equal(t3, [raw.info['sfreq']], 2)
t3 = raw.index_as_time(raw.time_as_index(raw.info['sfreq'], False), False)
assert_array_almost_equal(t3, [raw.info['sfreq']], 2)
i0 = raw.time_as_index(raw.index_as_time([0], True), True)
assert_true(i0[0] == 0)
i1 = raw.time_as_index(raw.index_as_time([100], True), True)
assert_true(i1[0] == 100)
# Have to add small amount of time because we truncate via int casting
i1 = raw.time_as_index(raw.index_as_time([100.0001], False), False)
assert_true(i1[0] == 100)
示例3:
# 需要导入模块: from mne.fiff import Raw [as 别名]
# 或者: from mne.fiff.Raw import index_as_time [as 别名]
# The list isn't that huge to warrant any coolness here
row=0
resp=0
prev_target = -1
prev_target_time = -1
prev_trigger = -1
for ind, before, after in events:
# Now check whether to search for the frame trigger
# Also: since we'll want to fix the reaction times, search also for
# the response strigger
corr_ind = ind
if after == 2 or after == 3:
RT = raw.index_as_time(ind) - prev_target_time
if prev_target == after:
responses[resp,:] = np.r_[resp+1,True,prev_trigger,RT]
else:
responses[resp,:] = np.r_[resp+1,False,prev_trigger,RT]
resp += 1
elif after in imtriggers:
raw_ind = ind - raw.first_samp # now these really are indices into raw!
# anatrig_ind = _find_next_analogue_trigger(raw, raw_ind,triglimit
# ana_channel='MISC001',
# maxdelay_samps=200)
anatrig_ind = _find_next_analogue_trigger(ana_data, raw_ind,triglimit ,
maxdelay_samps=100)
corr_ind += anatrig_ind