Skip to content

Commit 7278aa8

Browse files
committed
wip: still convering
1 parent b78688a commit 7278aa8

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

src/boost_histogram/_internal/hist.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
def _fill_cast(value, inner=False):
4646
"""
47-
Convert to NumPy arrays. Some buffer objects do not get converted by forcecast.
47+
Convert to NumPy arrays; must be c-order dense arrays to work.
4848
If not called by itself (inner=False), then will work through one level of tuple/list.
4949
"""
5050
if value is None or isinstance(value, string_types + (bytes,)):
@@ -340,9 +340,9 @@ def fill(self, *args, **kwargs): # noqa: C901
340340
----------
341341
*args : Union[Array[float], Array[int], Array[str], float, int, str]
342342
Provide one value or array per dimension.
343-
weight : List[Union[Array[float], Array[int], Array[str], float, int, str]]]
344-
Provide weights (only if the histogram storage supports it)
345-
sample : List[Union[Array[float], Array[int], Array[str], float, int, str]]]
343+
weight : List[Union[Array[float], Array[int], float, int]]]
344+
Provide weights (float only if the histogram storage supports it)
345+
sample : List[Union[Array[float], Array[int], float, int]]]
346346
Provide samples (only if the histogram storage supports it)
347347
threads : Optional[int]
348348
Fill with threads. Defaults to None, which does not activate

src/boost_histogram/_internal/sig_tools.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def inject_signature(sig, locals=None):
1515
# type: (str, Optional[Dict[str, Any]]) -> Any
1616
def wrap(f):
1717
return f
18+
1819
return wrap
1920

2021

tests/test_histogram.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ def test_copy():
7373
assert id(b) != id(c)
7474

7575

76+
def test_fill_int_storage_with_floats():
77+
h = bh.Histogram(bh.axis.Regular(10,-1,1), storage=bh.storage.Int64())
78+
h.fill([.3,.4,.5], weight=[1, 3, 2])
79+
h.fill([.3,.4,.5], weight=[.1, .3, .2])
80+
81+
7682
def test_fill_int_1d():
7783

7884
h = bh.Histogram(bh.axis.Integer(-1, 2))

tests/test_numpy_interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@
3131
{"bins": 10},
3232
{"bins": "auto" if np113 else 20},
3333
{"range": (0, 5), "bins": 30},
34-
{"range": np.array((0, 5), dtype=np.float), "bins": np.int32(30)},
34+
{"range": np.array((0, 5), dtype=float), "bins": np.int32(30)},
3535
{"range": np.array((0, 3), dtype=np.double), "bins": np.uint32(10)},
36-
{"range": np.array((0, 10), dtype=np.int), "bins": np.int8(30)},
36+
{"range": np.array((0, 10), dtype=int), "bins": np.int8(30)},
3737
{"bins": [0, 1, 1.2, 1.3, 4, 21]},
3838
)
3939

0 commit comments

Comments
 (0)