question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Should clearly report which element types are supported for datashading

See original GitHub issue

If I write this simple code:

import numpy as np
import holoviews as hv
from holoviews.operation.datashader import datashade
hv.notebook_extension('bokeh')
image = np.random.rand(6000,6000)
image = hv.Raster(image)
datashade(image)

I get the following error:

WARNING:root:dynamic_operation: Exception raised in callable 'dynamic_operation' of type 'function'.
Invoked as dynamic_operation(height=400, scale=1.0, width=400, x_range=None, y_range=None)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
C:\Miniconda3x64\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
    339                 pass
    340             else:
--> 341                 return printer(obj)
    342             # Finally look for special method names
    343             method = get_real_method(obj, self.print_method)

C:\Miniconda3x64\lib\site-packages\holoviews\ipython\display_hooks.py in pprint_display(obj)
    257     if not ip.display_formatter.formatters['text/plain'].pprint:
    258         return None
--> 259     return display(obj, raw=True)
    260 
    261 

C:\Miniconda3x64\lib\site-packages\holoviews\ipython\display_hooks.py in display(obj, raw, **kwargs)
    243     elif isinstance(obj, (HoloMap, DynamicMap)):
    244         with option_state(obj):
--> 245             html = map_display(obj)
    246     else:
    247         return repr(obj) if raw else IPython.display.display(obj, **kwargs)

C:\Miniconda3x64\lib\site-packages\holoviews\ipython\display_hooks.py in wrapped(element)
    130         try:
    131             html = fn(element,
--> 132                       max_frames=OutputSettings.options['max_frames'])
    133 
    134             # Only want to add to the archive for one display hook...

C:\Miniconda3x64\lib\site-packages\holoviews\ipython\display_hooks.py in map_display(vmap, max_frames)
    198         return None
    199 
--> 200     return render(vmap)
    201 
    202 

C:\Miniconda3x64\lib\site-packages\holoviews\ipython\display_hooks.py in render(obj, **kwargs)
     60     if renderer.fig == 'pdf':
     61         renderer = renderer.instance(fig='png')
---> 62     return renderer.html(obj, **kwargs)
     63 
     64 

C:\Miniconda3x64\lib\site-packages\holoviews\plotting\renderer.py in html(self, obj, fmt, css, comm, **kwargs)
    255         code to initialize a Comm, if the plot supplies one.
    256         """
--> 257         plot, fmt =  self._validate(obj, fmt)
    258         figdata, _ = self(plot, fmt, **kwargs)
    259         if css is None: css = self.css

C:\Miniconda3x64\lib\site-packages\holoviews\plotting\renderer.py in _validate(self, obj, fmt)
    191         if isinstance(obj, tuple(self.widgets.values())):
    192             return obj, 'html'
--> 193         plot = self.get_plot(obj, renderer=self)
    194 
    195         fig_formats = self.mode_formats['fig'][self.mode]

C:\Miniconda3x64\lib\site-packages\holoviews\plotting\bokeh\renderer.py in get_plot(self_or_cls, obj, doc, renderer)
    114         combining the bokeh model with another plot.
    115         """
--> 116         plot = super(BokehRenderer, self_or_cls).get_plot(obj, renderer)
    117         if self_or_cls.mode == 'server' and doc is None:
    118             doc = curdoc()

C:\Miniconda3x64\lib\site-packages\holoviews\plotting\renderer.py in get_plot(self_or_cls, obj, renderer)
    164         """
    165         # Initialize DynamicMaps with first data item
--> 166         initialize_dynamic(obj)
    167 
    168         if not isinstance(obj, Plot):

C:\Miniconda3x64\lib\site-packages\holoviews\plotting\util.py in initialize_dynamic(obj)
    177             continue
    178         if not len(dmap):
--> 179             dmap[dmap._initial_key()]
    180 
    181 

C:\Miniconda3x64\lib\site-packages\holoviews\core\spaces.py in __getitem__(self, key)
   1024         # Not a cross product and nothing cached so compute element.
   1025         if cache is not None: return cache
-> 1026         val = self._execute_callback(*tuple_key)
   1027         if data_slice:
   1028             val = self._dataslice(val, data_slice)

C:\Miniconda3x64\lib\site-packages\holoviews\core\spaces.py in _execute_callback(self, *args)
    853 
    854         with dynamicmap_memoization(self.callback, self.streams):
--> 855             retval = self.callback(*args, **kwargs)
    856         return self._style(retval)
    857 

C:\Miniconda3x64\lib\site-packages\holoviews\core\spaces.py in __call__(self, *args, **kwargs)
    520 
    521         try:
--> 522             ret = self.callable(*args, **kwargs)
    523         except KeyError:
    524             # KeyError is caught separately because it is used to signal

C:\Miniconda3x64\lib\site-packages\holoviews\util\__init__.py in dynamic_operation(*key, **kwargs)
    343                 self.p.kwargs.update(kwargs)
    344                 obj = map_obj[key] if isinstance(map_obj, HoloMap) else map_obj
--> 345                 return self._process(obj, key)
    346         else:
    347             def dynamic_operation(*key, **kwargs):

C:\Miniconda3x64\lib\site-packages\holoviews\util\__init__.py in _process(self, element, key)
    329             kwargs = {k: v for k, v in self.p.kwargs.items()
    330                       if k in self.p.operation.params()}
--> 331             return self.p.operation.process_element(element, key, **kwargs)
    332         else:
    333             return self.p.operation(element, **self.p.kwargs)

C:\Miniconda3x64\lib\site-packages\holoviews\core\operation.py in process_element(self, element, key, **params)
    119         """
    120         self.p = param.ParamOverrides(self, params)
--> 121         return self._process(element, key)
    122 
    123 

C:\Miniconda3x64\lib\site-packages\holoviews\operation\datashader.py in _process(self, element, key)
    634 
    635     def _process(self, element, key=None):
--> 636         agg = aggregate._process(self, element, key)
    637         shaded = shade._process(self, agg, key)
    638         return shaded

C:\Miniconda3x64\lib\site-packages\holoviews\operation\datashader.py in _process(self, element, key)
    333             return self._aggregate_ndoverlay(element, agg_fn)
    334 
--> 335         x, y, data, glyph = self.get_agg_data(element, category)
    336         (x_range, y_range), (xs, ys), (width, height), (xtype, ytype) = self._get_sampling(element, x, y)
    337 

C:\Miniconda3x64\lib\site-packages\holoviews\operation\datashader.py in get_agg_data(cls, obj, category)
    219         elif isinstance(obj, Element):
    220             glyph = 'line' if isinstance(obj, Curve) else 'points'
--> 221             paths.append(PandasInterface.as_dframe(obj))
    222 
    223         if dims is None or len(dims) != 2:

C:\Miniconda3x64\lib\site-packages\holoviews\core\data\pandas.py in as_dframe(cls, dataset)
    263         if it already a dataframe type.
    264         """
--> 265         if issubclass(dataset.interface, PandasInterface):
    266             return dataset.data
    267         else:

AttributeError: 'Raster' object has no attribute 'interface'

Out[30]:
:DynamicMap   []

Can anyone help me to sort it out? Am I missing something? Is this a bug?

Using holoviews 1.9.1-x-gc1d66c015 and datashader 0.6.2

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
philippjfrcommented, Dec 11, 2017

I know this was discussed relatively recently and I might be out of the loop…

The trimesh PR makes a start on this, but I’m waiting on @jbednar to tidy up the API for raster regridding before that can be fully unified. However the rasterize operation will rasterize most common elements, nested in whatever way you want but will not apply to unsupported elements. Once that has been merged we can update the Large Data user guide.

0reactions
jlstevenscommented, Dec 11, 2017

@jbednar @philippjfr How does this fit in with the idea of a more general datashading operation that can support more element types? I know this was discussed relatively recently and I might be out of the loop…

Read more comments on GitHub >

github_iconTop Results From Across the Web

pyviz/pyviz - Gitter
This chat is for informal discussions and debugging sessions with developers of the HoloViz.org tools (HoloViews, Datashader, Panel, hvPlot, GeoViews, Param, ...
Read more >
Working with large data using Datashader
Container types supported for datashading. In the above examples datashade() was called directly on each Element, but it can also be called on...
Read more >
Hover tool with categorical aggregates - Datashader
Building on this I am currently trying to display a tooltip that would show information based on categorical data, but I don't know...
Read more >
Pipeline — Datashader v0.14.3
Datashader can work many different data objects provided by different data libraries depending on the type of data involved, such as columnar data...
Read more >
Support datashading hv.Rectangles · Issue #4699 - GitHub
Yes, datashading Rectangles would make good sense and could help render some interesting plot types, but more work would need to be done...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found