Skip to content

Commit

Permalink
wip: still convering
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Feb 9, 2021
1 parent b78688a commit 7278aa8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/boost_histogram/_internal/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

def _fill_cast(value, inner=False):
"""
Convert to NumPy arrays. Some buffer objects do not get converted by forcecast.
Convert to NumPy arrays; must be c-order dense arrays to work.
If not called by itself (inner=False), then will work through one level of tuple/list.
"""
if value is None or isinstance(value, string_types + (bytes,)):
Expand Down Expand Up @@ -340,9 +340,9 @@ def fill(self, *args, **kwargs): # noqa: C901
----------
*args : Union[Array[float], Array[int], Array[str], float, int, str]
Provide one value or array per dimension.
weight : List[Union[Array[float], Array[int], Array[str], float, int, str]]]
Provide weights (only if the histogram storage supports it)
sample : List[Union[Array[float], Array[int], Array[str], float, int, str]]]
weight : List[Union[Array[float], Array[int], float, int]]]
Provide weights (float only if the histogram storage supports it)
sample : List[Union[Array[float], Array[int], float, int]]]
Provide samples (only if the histogram storage supports it)
threads : Optional[int]
Fill with threads. Defaults to None, which does not activate
Expand Down
1 change: 1 addition & 0 deletions src/boost_histogram/_internal/sig_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def inject_signature(sig, locals=None):
# type: (str, Optional[Dict[str, Any]]) -> Any
def wrap(f):
return f

return wrap


Expand Down
6 changes: 6 additions & 0 deletions tests/test_histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ def test_copy():
assert id(b) != id(c)


def test_fill_int_storage_with_floats():
h = bh.Histogram(bh.axis.Regular(10,-1,1), storage=bh.storage.Int64())
h.fill([.3,.4,.5], weight=[1, 3, 2])
h.fill([.3,.4,.5], weight=[.1, .3, .2])


def test_fill_int_1d():

h = bh.Histogram(bh.axis.Integer(-1, 2))
Expand Down
4 changes: 2 additions & 2 deletions tests/test_numpy_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
{"bins": 10},
{"bins": "auto" if np113 else 20},
{"range": (0, 5), "bins": 30},
{"range": np.array((0, 5), dtype=np.float), "bins": np.int32(30)},
{"range": np.array((0, 5), dtype=float), "bins": np.int32(30)},
{"range": np.array((0, 3), dtype=np.double), "bins": np.uint32(10)},
{"range": np.array((0, 10), dtype=np.int), "bins": np.int8(30)},
{"range": np.array((0, 10), dtype=int), "bins": np.int8(30)},
{"bins": [0, 1, 1.2, 1.3, 4, 21]},
)

Expand Down

0 comments on commit 7278aa8

Please sign in to comment.