Skip to content
This repository was archived by the owner on Jan 7, 2023. It is now read-only.

Commit b4f9a19

Browse files
committed
Merge pull request #204 from ndawe/master
[MRG] array2hist: return the hist to allow chaining and list comprehensions
2 parents 4108861 + f8839ab commit b4f9a19

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

root_numpy/_hist.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,11 @@ def array2hist(array, hist):
219219
hist : ROOT TH1, TH2, or TH3
220220
A ROOT histogram.
221221
222+
Returns
223+
-------
224+
hist : ROOT TH1, TH2, or TH3
225+
The ROOT histogram with bin contents set from the array.
226+
222227
Raises
223228
------
224229
TypeError
@@ -258,7 +263,7 @@ def array2hist(array, hist):
258263
[2, 0, 5, 6, 8],
259264
[0, 0, 6, 5, 2],
260265
[2, 2, 1, 5, 4]])
261-
>>> array2hist(array, hist)
266+
>>> _ = array2hist(array, hist)
262267
>>> # dtype matches histogram type (D, F, I, S, C)
263268
>>> hist2array(hist)
264269
array([[ 9., 7., 6.],
@@ -347,3 +352,4 @@ def array2hist(array, hist):
347352
ROOT.AsCObject(hist), np.ravel(np.transpose(_array)))
348353
# Set the number of entries to the number of array elements
349354
hist.SetEntries(_array.size)
355+
return hist

root_numpy/info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
|_| \___/ \___/ \__|___|_| |_|\__,_|_| |_| |_| .__/ \__, | {0}
77
|_____| |_| |___/
88
"""
9-
__version__ = '4.2.0.dev0'
9+
__version__ = '4.2.1.dev0'
1010
__doc__ = __doc__.format(__version__) # pylint:disable=redefined-builtin

0 commit comments

Comments
 (0)