当前位置: 首页>>代码示例>>Python>>正文


Python DynamicMap.event方法代码示例

本文整理汇总了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)
开发者ID:basnijholt,项目名称:holoviews,代码行数:10,代码来源:testdynamic.py

示例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)
开发者ID:basnijholt,项目名称:holoviews,代码行数:12,代码来源:testdynamic.py

示例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)
开发者ID:basnijholt,项目名称:holoviews,代码行数:24,代码来源:testdynamic.py


注:本文中的holoviews.core.spaces.DynamicMap.event方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。