本文整理汇总了Python中surfer.Brain.set_distance方法的典型用法代码示例。如果您正苦于以下问题:Python Brain.set_distance方法的具体用法?Python Brain.set_distance怎么用?Python Brain.set_distance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类surfer.Brain
的用法示例。
在下文中一共展示了Brain.set_distance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_brains
# 需要导入模块: from surfer import Brain [as 别名]
# 或者: from surfer.Brain import set_distance [as 别名]
def test_brains():
"""Test plotting of Brain with different arguments."""
# testing backend breaks when passing in a figure, so we use 'auto' here
# (shouldn't affect usability, but it makes testing more annoying)
_set_backend('auto')
with warnings.catch_warnings(record=True): # traits for mlab.figure()
mlab.figure(101)
surfs = ['inflated', 'white', 'white', 'white', 'white', 'white', 'white']
hemis = ['lh', 'rh', 'both', 'both', 'rh', 'both', 'both']
titles = [None, 'Hello', 'Good bye!', 'lut test',
'dict test', 'None test', 'RGB test']
cortices = ["low_contrast", ("Reds", 0, 1, False), 'hotpink',
['yellow', 'blue'], dict(colormap='Greys'),
None, (0.5, 0.5, 0.5)]
sizes = [500, (400, 300), (300, 300), (300, 400), 500, 400, 300]
backgrounds = ["white", "blue", "black", "0.75",
(0.2, 0.2, 0.2), "black", "0.75"]
foregrounds = ["black", "white", "0.75", "red",
(0.2, 0.2, 0.2), "blue", "black"]
with warnings.catch_warnings(record=True): # traits for mlab.figure()
figs = [101, mlab.figure(), None, None, mlab.figure(), None, None]
subj_dir = utils._get_subjects_dir()
subj_dirs = [None, subj_dir, subj_dir, subj_dir,
subj_dir, subj_dir, subj_dir]
alphas = [1.0, 0.5, 0.25, 0.7, 0.5, 0.25, 0.7]
for surf, hemi, title, cort, s, bg, fg, fig, sd, alpha \
in zip(surfs, hemis, titles, cortices, sizes,
backgrounds, foregrounds, figs, subj_dirs, alphas):
brain = Brain(subject_id, hemi, surf, title=title, cortex=cort,
alpha=alpha, size=s, background=bg, foreground=fg,
figure=fig, subjects_dir=sd)
with np.errstate(invalid='ignore'): # encountered in double_scalars
brain.set_distance()
brain.close()
brain = Brain(subject_id, hemi, surf, subjects_dir=sd,
interaction='terrain')
brain.close()
pytest.raises(ValueError, Brain, subject_id, 'lh', 'inflated',
subjects_dir='')
pytest.raises(ValueError, Brain, subject_id, 'lh', 'inflated',
interaction='foo', subjects_dir=sd)