Skip to content

Commit

Permalink
Cleaned up datashader class hierarchy
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Dec 8, 2017
1 parent ea5a1d2 commit 0812ee3
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions holoviews/operation/datashader.py
Expand Up @@ -164,9 +164,10 @@ class aggregate(ResamplingOperation):
"""
aggregate implements 2D binning for any valid HoloViews Element
type using datashader. I.e., this operation turns a HoloViews
Element or overlay of Elements into an hImage or an overlay of
.Images by rasterizing it, which provides a fixed-sized
representation independent of the original dataset size.
Element or overlay of Elements into an Image or an overlay of
Images by rasterizing it. This allows quickly aggregating large
datasets computing a fixed-sized representation independent
of the original dataset size.
By default it will simply count the number of values in each bin
but other aggregators can be supplied implementing mean, max, min
Expand Down Expand Up @@ -486,7 +487,7 @@ def _process(self, element, key=None):
return element.clone(regridded, bounds=bbox, datatype=['xarray'])


class trimesh_rasterize(aggregate):
class trimesh_rasterize(ResamplingOperation):
"""
Rasterize the TriMesh element using the supplied aggregator. If
the TriMesh nodes or edges define a value dimension will plot
Expand Down Expand Up @@ -527,11 +528,13 @@ def _process(self, element, key=None):
return Image(agg, **params)


class rasterize(trimesh_rasterize):

class rasterize(ResamplingOperation):
"""
Rasterize is a high-level operation which will rasterize any
Element or combination of Elements supplied as an (Nd)Overlay
by aggregating with the supplied aggregation function.
Element or combination of Elements supplied as an (Nd)Overlay by
aggregating with the supplied aggregation it with the declared
aggregator and interpolation methods.
By default it will simply count the number of values in each bin
but other aggregators can be supplied implementing mean, max, min
Expand All @@ -552,6 +555,10 @@ class rasterize(trimesh_rasterize):
aggregator = param.ClassSelector(class_=ds.reductions.Reduction,
default=None)

interpolation = param.ObjectSelector(default='bilinear',
objects=['bilinear', None], doc="""
The interpolation method to apply during rasterization.""")

def _process(self, element, key=None):
# Get input Images to avoid multiple rasterization
imgs = element.traverse(lambda x: x, [Image])
Expand Down

1 comment on commit 0812ee3

@jbednar
Copy link
Member

@jbednar jbednar commented on 0812ee3 Dec 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks!

Please sign in to comment.