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

[MRG] array2hist: return the hist to allow chaining and list comprehensions #204

Merged
merged 2 commits into from
Jun 10, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion root_numpy/info.py
Original file line number Diff line number Diff line change
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