Skip to content

Commit

Permalink
Fixed bug in parallel mode calculation for Canvas.raster()
Browse files Browse the repository at this point in the history
  • Loading branch information
jbednar committed Jan 23, 2018
1 parent c97d1d8 commit cd41369
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions datashader/resampling.py
Expand Up @@ -468,9 +468,13 @@ def _downsample_2d_mode(src, mask, use_mask, method, fill_value, mode_rank, out)
scale_y = src_h / out_h

max_value_count = int(scale_x + 1) * int(scale_y + 1)
values = np.zeros((max_value_count,), dtype=src.dtype)
frequencies = np.zeros((max_value_count,), dtype=np.uint32)
if mode_rank >= max_value_count:
raise ValueError("requested mode_rank too large for max_value_count being collected")

for out_y in prange(out_h):
values = np.zeros((max_value_count,), dtype=src.dtype)
frequencies = np.zeros((max_value_count,), dtype=np.uint32)

src_yf0 = scale_y * out_y
src_yf1 = src_yf0 + scale_y
src_y0 = int(src_yf0)
Expand Down

0 comments on commit cd41369

Please sign in to comment.