本文整理汇总了Python中surfer.Brain.remove_data方法的典型用法代码示例。如果您正苦于以下问题:Python Brain.remove_data方法的具体用法?Python Brain.remove_data怎么用?Python Brain.remove_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类surfer.Brain
的用法示例。
在下文中一共展示了Brain.remove_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_meg_inverse
# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import remove_data [as 别名]
def test_meg_inverse():
"""Test plotting of MEG inverse solution."""
_set_backend()
brain = Brain(*std_args)
stc_fname = os.path.join(data_dir, 'meg_source_estimate-lh.stc')
stc = io.read_stc(stc_fname)
vertices = stc['vertices']
colormap = 'hot'
data = stc['data']
data_full = (brain.geo['lh'].nn[vertices][..., np.newaxis] *
data[:, np.newaxis])
time = np.linspace(stc['tmin'], stc['tmin'] + data.shape[1] * stc['tstep'],
data.shape[1], endpoint=False)
def time_label(t):
return 'time=%0.2f ms' % (1e3 * t)
for use_data in (data, data_full):
brain.add_data(use_data, colormap=colormap, vertices=vertices,
smoothing_steps=1, time=time, time_label=time_label)
brain.scale_data_colormap(fmin=13, fmid=18, fmax=22, transparent=True)
assert_equal(brain.data_dict['lh']['time_idx'], 0)
brain.set_time(.1)
assert_equal(brain.data_dict['lh']['time_idx'], 2)
# viewer = TimeViewer(brain)
# multiple data layers
assert_raises(ValueError, brain.add_data, data, vertices=vertices,
time=time[:-1])
brain.add_data(data, colormap=colormap, vertices=vertices,
smoothing_steps=1, time=time, time_label=time_label,
initial_time=.09)
assert_equal(brain.data_dict['lh']['time_idx'], 1)
data_dicts = brain._data_dicts['lh']
assert_equal(len(data_dicts), 3)
assert_equal(data_dicts[0]['time_idx'], 1)
assert_equal(data_dicts[1]['time_idx'], 1)
# shift time in both layers
brain.set_data_time_index(0)
assert_equal(data_dicts[0]['time_idx'], 0)
assert_equal(data_dicts[1]['time_idx'], 0)
brain.set_data_smoothing_steps(2)
# add second data-layer without time axis
brain.add_data(data[:, 1], colormap=colormap, vertices=vertices,
smoothing_steps=2)
brain.set_data_time_index(2)
assert_equal(len(data_dicts), 4)
# change surface
brain.set_surf('white')
# remove all layers
brain.remove_data()
assert_equal(brain._data_dicts['lh'], [])
brain.close()