Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Apr 8, 2022
1 parent 7f20e2e commit 8608b23
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions holoviews/operation/datashader.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ class overlay_aggregate(aggregate):
def applies(cls, element, agg_fn, line_width=None):
return (isinstance(element, NdOverlay) and
(element.type is not Curve or line_width is None) and
((isinstance(agg_fn, (ds.count, ds.sum, ds.mean)) and
((isinstance(agg_fn, (ds.count, ds.sum, ds.mean, ds.any)) and
(agg_fn.column is None or agg_fn.column not in element.kdims)) or
(isinstance(agg_fn, ds.count_cat) and agg_fn.column in element.kdims)))

Expand All @@ -552,7 +552,7 @@ def _process(self, element, key=None):
if not self.applies(element, agg_fn, line_width=self.p.line_width):
raise ValueError(
'overlay_aggregate only handles aggregation of NdOverlay types '
' with count, sum or mean reduction.'
'with count, sum or mean reduction.'
)

# Compute overall bounds
Expand Down Expand Up @@ -596,11 +596,11 @@ def _process(self, element, key=None):
else:
agg_fn1 = aggregate.instance(**agg_params)
agg_fn2 = None
is_sum = isinstance(agg_fn1.aggregator, ds.sum)
is_sum = isinstance(agg_fn, ds.sum)
is_any = isinstance(agg_fn, ds.any)

# Accumulate into two aggregates and mask
agg, agg2, mask = None, None, None
mask = None
for v in element:
# Compute aggregates and mask
new_agg = agg_fn1.process_element(v, None)
Expand All @@ -615,7 +615,10 @@ def _process(self, element, key=None):
if is_sum: mask = new_mask
if agg_fn2: agg2 = new_agg2
else:
agg.data += new_agg.data
if is_any:
agg.data |= new_agg.data
else:
agg.data += new_agg.data
if is_sum: mask &= new_mask
if agg_fn2: agg2.data += new_agg2.data

Expand Down

0 comments on commit 8608b23

Please sign in to comment.