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

Commit

Permalink
array2hist: return the hist to allow chaining and list comprehensions
Browse files Browse the repository at this point in the history
  • Loading branch information
ndawe committed Jun 10, 2015
1 parent 4108861 commit 061906d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion root_numpy/_hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ def array2hist(array, hist):
hist : ROOT TH1, TH2, or TH3
A ROOT histogram.
Returns
-------
hist : ROOT TH1, TH2, or TH3
The ROOT histogram with bin contents set from the array.
Raises
------
TypeError
Expand Down Expand Up @@ -258,7 +263,7 @@ def array2hist(array, hist):
[2, 0, 5, 6, 8],
[0, 0, 6, 5, 2],
[2, 2, 1, 5, 4]])
>>> array2hist(array, hist)
>>> _ = array2hist(array, hist)
>>> # dtype matches histogram type (D, F, I, S, C)
>>> hist2array(hist)
array([[ 9., 7., 6.],
Expand Down Expand Up @@ -347,3 +352,4 @@ def array2hist(array, hist):
ROOT.AsCObject(hist), np.ravel(np.transpose(_array)))
# Set the number of entries to the number of array elements
hist.SetEntries(_array.size)
return hist

0 comments on commit 061906d

Please sign in to comment.