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


Python holoviews.HoloMap方法代码示例

本文整理汇总了Python中holoviews.HoloMap方法的典型用法代码示例。如果您正苦于以下问题:Python holoviews.HoloMap方法的具体用法?Python holoviews.HoloMap怎么用?Python holoviews.HoloMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在holoviews的用法示例。


在下文中一共展示了holoviews.HoloMap方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_holoviews_with_widgets

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_holoviews_with_widgets(document, comm):
    hmap = hv.HoloMap({(i, chr(65+i)): hv.Curve([i]) for i in range(3)}, kdims=['X', 'Y'])

    hv_pane = HoloViews(hmap)
    layout = hv_pane.get_root(document, comm)
    model = layout.children[0]
    assert len(hv_pane.widget_box.objects) == 2
    assert hv_pane.widget_box.objects[0].name == 'X'
    assert hv_pane.widget_box.objects[1].name == 'Y'

    assert hv_pane._models[layout.ref['id']][0] is model

    hmap = hv.HoloMap({(i, chr(65+i)): hv.Curve([i]) for i in range(3)}, kdims=['A', 'B'])
    hv_pane.object = hmap
    assert len(hv_pane.widget_box.objects) == 2
    assert hv_pane.widget_box.objects[0].name == 'A'
    assert hv_pane.widget_box.objects[1].name == 'B' 
开发者ID:holoviz,项目名称:panel,代码行数:19,代码来源:test_holoviews.py

示例2: test_holoviews_with_widgets_not_shown

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_holoviews_with_widgets_not_shown(document, comm):
    hmap = hv.HoloMap({(i, chr(65+i)): hv.Curve([i]) for i in range(3)}, kdims=['X', 'Y'])

    hv_pane = HoloViews(hmap, show_widgets=False)
    layout_obj = Column(hv_pane, hv_pane.widget_box)
    layout = layout_obj.get_root(document, comm)
    model = layout.children[0]
    assert len(hv_pane.widget_box.objects) == 2
    assert hv_pane.widget_box.objects[0].name == 'X'
    assert hv_pane.widget_box.objects[1].name == 'Y'

    assert hv_pane._models[layout.ref['id']][0] is model

    hmap = hv.HoloMap({(i, chr(65+i)): hv.Curve([i]) for i in range(3)}, kdims=['A', 'B'])
    hv_pane.object = hmap
    assert len(hv_pane.widget_box.objects) == 2
    assert hv_pane.widget_box.objects[0].name == 'A'
    assert hv_pane.widget_box.objects[1].name == 'B' 
开发者ID:holoviz,项目名称:panel,代码行数:20,代码来源:test_holoviews.py

示例3: plot_data

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def plot_data(self, feature_name):
        """ Plots the FeatureType.DATA of eopatch.

        :param feature_name: name of the eopatch feature
        :type feature_name: str
        :return: visualization
        :rtype: holoview/geoviews/bokeh
        """
        crs = self.eopatch.bbox.crs
        crs = CRS.POP_WEB if crs is CRS.WGS84 else crs
        data_da = array_to_dataframe(self.eopatch, (FeatureType.DATA, feature_name), crs=crs)
        if self.mask:
            data_da = self.mask_data(data_da)
        timestamps = self.eopatch.timestamp
        crs = self.eopatch.bbox.crs
        if not self.rgb:
            return data_da.hvplot(x='x', y='y', crs=ccrs.epsg(crs.epsg))
        data_rgb = self.eopatch_da_to_rgb(data_da, feature_name, crs)
        rgb_dict = {timestamp_: self.plot_rgb_one(data_rgb, timestamp_) for timestamp_ in timestamps}

        return hv.HoloMap(rgb_dict, kdims=['time']) 
开发者ID:sentinel-hub,项目名称:eo-learn,代码行数:23,代码来源:eopatch_visualization.py

示例4: plot_vector

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def plot_vector(self, feature_name):
        """ Visualizaton for vector (FeatureType.VECTOR) data

        :param feature_name: name of eopatch feature
        :type feature_name: str
        :return: visualization
        :rtype: holoviews/geoviews/bokeh

        """
        crs = self.eopatch.bbox.crs
        timestamps = self.eopatch.timestamp
        data_gpd = self.fill_vector(FeatureType.VECTOR, feature_name)
        if crs is CRS.WGS84:
            crs = CRS.POP_WEB
            data_gpd = data_gpd.to_crs(crs.pyproj_crs())
        shapes_dict = {timestamp_: self.plot_shapes_one(data_gpd, timestamp_, crs)
                       for timestamp_ in timestamps}
        return hv.HoloMap(shapes_dict, kdims=['time']) 
开发者ID:sentinel-hub,项目名称:eo-learn,代码行数:20,代码来源:eopatch_visualization.py

示例5: generate_holo_map

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def generate_holo_map(rgb_images, height, width):
    frame_map = {}
    for i, image in enumerate(rgb_images):

        # print('image type: ' + str(type(image)))
        hv_rgb = hv.RGB(np.array(image))
        shape = image.shape
        frame_map[i] = hv_rgb
    holomap = hv.HoloMap(frame_map)
    holomap = holomap.options(width=int(width), height=int(height))
    return holomap 
开发者ID:jhu-lcsr,项目名称:costar_plan,代码行数:13,代码来源:stack_player.py

示例6: setUp

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def setUp(self):
        if 'bokeh' not in Store.renderers and pn is not None:
            raise SkipTest("Bokeh and Panel required to test 'bokeh' renderer")
        self.image1 = Image(np.array([[0,1],[2,3]]), label='Image1')
        self.image2 = Image(np.array([[1,0],[4,-2]]), label='Image2')
        self.map1 = HoloMap({1:self.image1, 2:self.image2}, label='TestMap')
        self.renderer = BokehRenderer.instance()
        self.nbcontext = Renderer.notebook_context
        self.comm_manager = Renderer.comm_manager
        with param.logging_level('ERROR'):
            Renderer.notebook_context = False
            Renderer.comm_manager = CommManager 
开发者ID:holoviz,项目名称:holoviews,代码行数:14,代码来源:testrenderer.py

示例7: test_render_holomap_individual

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_render_holomap_individual(self):
        hmap = HoloMap({i: Curve([1, 2, i]) for i in range(5)})
        obj, _ = self.renderer._validate(hmap, None)
        self.assertIsInstance(obj, pn.pane.HoloViews)
        self.assertEqual(obj.center, True)
        self.assertEqual(obj.widget_location, 'right')
        self.assertEqual(obj.widget_type, 'individual')
        widgets = obj.layout.select(DiscreteSlider)
        self.assertEqual(len(widgets), 1)
        slider = widgets[0]
        self.assertEqual(slider.options, OrderedDict([(str(i), i) for i in range(5)])) 
开发者ID:holoviz,项目名称:holoviews,代码行数:13,代码来源:testrenderer.py

示例8: test_render_holomap_embedded

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_render_holomap_embedded(self):
        hmap = HoloMap({i: Curve([1, 2, i]) for i in range(5)})
        data, _ = self.renderer.components(hmap)
        self.assertIn('State"', data['text/html']) 
开发者ID:holoviz,项目名称:holoviews,代码行数:6,代码来源:testrenderer.py

示例9: test_render_holomap_not_embedded

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_render_holomap_not_embedded(self):
        hmap = HoloMap({i: Curve([1, 2, i]) for i in range(5)})
        data, _ = self.renderer.instance(widget_mode='live').components(hmap)
        self.assertNotIn('State"', data['text/html']) 
开发者ID:holoviz,项目名称:holoviews,代码行数:6,代码来源:testrenderer.py

示例10: test_render_holomap_scrubber

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_render_holomap_scrubber(self):
        hmap = HoloMap({i: Curve([1, 2, i]) for i in range(5)})
        obj, _ = self.renderer._validate(hmap, 'scrubber')
        self.assertIsInstance(obj, pn.pane.HoloViews)
        self.assertEqual(obj.center, True)
        self.assertEqual(obj.widget_location, 'bottom')
        self.assertEqual(obj.widget_type, 'scrubber')
        widgets = obj.layout.select(Player)
        self.assertEqual(len(widgets), 1)
        player = widgets[0]
        self.assertEqual(player.start, 0)
        self.assertEqual(player.end, 4) 
开发者ID:holoviz,项目名称:holoviews,代码行数:14,代码来源:testrenderer.py

示例11: test_render_holomap_individual_widget_position

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_render_holomap_individual_widget_position(self):
        hmap = HoloMap({i: Curve([1, 2, i]) for i in range(5)})
        obj, _ = self.renderer.instance(widget_location='top')._validate(hmap, None)
        self.assertIsInstance(obj, pn.pane.HoloViews)
        self.assertEqual(obj.center, True)
        self.assertEqual(obj.widget_location, 'top')
        self.assertEqual(obj.widget_type, 'individual') 
开发者ID:holoviz,项目名称:holoviews,代码行数:9,代码来源:testrenderer.py

示例12: test_deep_ellipsis_curve_slicing_1

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_deep_ellipsis_curve_slicing_1(self):
        hmap = hv.HoloMap({i:hv.Curve([(j,j) for j in range(10)])
                   for i in range(10)})
        sliced = hmap[2:5,...]
        self.assertEqual(sliced.keys(), [2, 3, 4]) 
开发者ID:holoviz,项目名称:holoviews,代码行数:7,代码来源:testellipsis.py

示例13: test_deep_ellipsis_curve_slicing_2

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_deep_ellipsis_curve_slicing_2(self):
        hmap = hv.HoloMap({i:hv.Curve([(j,j) for j in range(10)])
                   for i in range(10)})
        sliced = hmap[2:5,1:8,...]
        self.assertEqual(sliced.last.range('x'), (1,7)) 
开发者ID:holoviz,项目名称:holoviews,代码行数:7,代码来源:testellipsis.py

示例14: test_deep_ellipsis_curve_slicing_3

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_deep_ellipsis_curve_slicing_3(self):
        hmap = hv.HoloMap({i:hv.Curve([(j,2*j) for j in range(10)])
                   for i in range(10)})
        sliced = hmap[...,2:5]
        self.assertEqual(sliced.last.range('y'), (2, 4)) 
开发者ID:holoviz,项目名称:holoviews,代码行数:7,代码来源:testellipsis.py

示例15: test_unique_keys_complete_overlap

# 需要导入模块: import holoviews [as 别名]
# 或者: from holoviews import HoloMap [as 别名]
def test_unique_keys_complete_overlap(self):
        hmap1 = HoloMap({i: Curve(range(10)) for i in range(5)})
        hmap2 = HoloMap({i: Curve(range(10)) for i in range(3, 10)})
        dims, keys = unique_dimkeys(hmap1+hmap2)
        self.assertEqual(hmap1.kdims, dims)
        self.assertEqual(keys, [(i,) for i in range(10)]) 
开发者ID:holoviz,项目名称:holoviews,代码行数:8,代码来源:testtraversal.py


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