Skip to content

Commit

Permalink
Merge pull request #22625 from charris/backport-22561
Browse files Browse the repository at this point in the history
BUG: Histogramdd breaks on big arrays in Windows
  • Loading branch information
charris committed Nov 19, 2022
2 parents bb5e3a6 + dcd9404 commit 2c4cf9a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion numpy/lib/histograms.py
Expand Up @@ -1019,7 +1019,7 @@ def histogramdd(sample, bins=10, range=None, normed=None, weights=None,
sample = np.atleast_2d(sample).T
N, D = sample.shape

nbin = np.empty(D, int)
nbin = np.empty(D, np.intp)
edges = D*[None]
dedges = D*[None]
if weights is not None:
Expand Down
11 changes: 11 additions & 0 deletions numpy/lib/tests/test_histograms.py
Expand Up @@ -6,6 +6,7 @@
assert_array_almost_equal, assert_raises, assert_allclose,
assert_array_max_ulp, assert_raises_regex, suppress_warnings,
)
from numpy.testing._private.utils import requires_memory
import pytest


Expand Down Expand Up @@ -421,6 +422,16 @@ def test_histogram_bin_edges(self):
edges = histogram_bin_edges(arr, bins='auto', range=(0, 1))
assert_array_equal(edges, e)

@requires_memory(free_bytes=1e10)
@pytest.mark.slow
def test_big_arrays(self):
sample = np.zeros([100000000, 3])
xbins = 400
ybins = 400
zbins = np.arange(16000)
hist = np.histogramdd(sample=sample, bins=(xbins, ybins, zbins))
assert_equal(type(hist), type((1, 2)))


class TestHistogramOptimBinNums:
"""
Expand Down

0 comments on commit 2c4cf9a

Please sign in to comment.