Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions fastplotlib/utils/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,17 +455,17 @@ def subsample_array(
np.ndarray
subsample of the input array
"""
if np.prod(arr.shape) <= max_size:
if np.prod(arr.shape, dtype=np.int64) <= max_size:
Comment thread
kushalkolar marked this conversation as resolved.
Outdated
return arr[:] # no need to subsample if already below the threshold

# get factor by which to divide all dims
f = np.power((np.prod(arr.shape) / max_size), 1.0 / arr.ndim)
f = np.power((np.prod(arr.shape, dtype=np.int64) / max_size), 1.0 / arr.ndim)

# new shape for subsampled array
ns = np.floor(np.array(arr.shape) / f).clip(min=1)

# get the step size for the slices
slices = tuple(
slices = list(
slice(None, None, int(s)) for s in np.floor(arr.shape / ns).astype(int)
)

Expand Down