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

Commit

Permalink
Merge pull request #204 from ndawe/master
Browse files Browse the repository at this point in the history
[MRG] array2hist: return the hist to allow chaining and list comprehensions
  • Loading branch information
ndawe committed Jun 10, 2015
2 parents 4108861 + f8839ab commit b4f9a19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion root_numpy/_hist.py
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
2 changes: 1 addition & 1 deletion root_numpy/info.py
Expand Up @@ -6,5 +6,5 @@
|_| \___/ \___/ \__|___|_| |_|\__,_|_| |_| |_| .__/ \__, | {0}
|_____| |_| |___/
"""
__version__ = '4.2.0.dev0'
__version__ = '4.2.1.dev0'
__doc__ = __doc__.format(__version__) # pylint:disable=redefined-builtin

0 comments on commit b4f9a19

Please sign in to comment.