本文整理汇总了Python中holoviews.core.spaces.DynamicMap.event方法的典型用法代码示例。如果您正苦于以下问题:Python DynamicMap.event方法的具体用法?Python DynamicMap.event怎么用?Python DynamicMap.event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类holoviews.core.spaces.DynamicMap
的用法示例。
在下文中一共展示了DynamicMap.event方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dynamic_event_renaming_valid
# 需要导入模块: from holoviews.core.spaces import DynamicMap [as 别名]
# 或者: from holoviews.core.spaces.DynamicMap import event [as 别名]
def test_dynamic_event_renaming_valid(self):
def fn(x1, y1):
return Scatter([(x1, y1)])
xy = PointerXY(rename={'x':'x1','y':'y1'})
dmap = DynamicMap(fn, kdims=[], streams=[xy])
dmap.event(x1=1, y1=2)
示例2: test_dynamic_event_renaming_invalid
# 需要导入模块: from holoviews.core.spaces import DynamicMap [as 别名]
# 或者: from holoviews.core.spaces.DynamicMap import event [as 别名]
def test_dynamic_event_renaming_invalid(self):
def fn(x1, y1):
return Scatter([(x1, y1)])
xy = PointerXY(rename={'x':'x1','y':'y1'})
dmap = DynamicMap(fn, kdims=[], streams=[xy])
regexp = '(.+?)do not correspond to stream parameters'
with self.assertRaisesRegexp(KeyError, regexp):
dmap.event(x=1, y=2)
示例3: test_dynamic_overlay_memoization
# 需要导入模块: from holoviews.core.spaces import DynamicMap [as 别名]
# 或者: from holoviews.core.spaces.DynamicMap import event [as 别名]
def test_dynamic_overlay_memoization(self):
"""Tests that Callable memoizes unchanged callbacks"""
def fn(x, y):
return Scatter([(x, y)])
dmap = DynamicMap(fn, kdims=[], streams=[PointerXY()])
counter = [0]
def fn2(x, y):
counter[0] += 1
return Image(np.random.rand(10, 10))
dmap2 = DynamicMap(fn2, kdims=[], streams=[PointerXY()])
overlaid = dmap * dmap2
overlay = overlaid[()]
self.assertEqual(overlay.Scatter.I, fn(0, 0))
dmap.event(x=1, y=2)
overlay = overlaid[()]
# Ensure dmap return value was updated
self.assertEqual(overlay.Scatter.I, fn(1, 2))
# Ensure dmap2 callback was called only once
self.assertEqual(counter[0], 1)