Skip to content

Commit 0c20aa8

Browse files
committed
Remove .reduce and .project from cpp class
1 parent 7c8ce4f commit 0c20aa8

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

boost_histogram/_internal/hist.py

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -185,22 +185,6 @@ def __itruediv__(self, other):
185185
def __idiv__(self, other):
186186
return self.__class__(self._hist.__idiv__(other._hist))
187187

188-
def reduce(self, *args):
189-
"""
190-
Reduce based on one or more reduce_option. Generally,
191-
the [] indexing is easier, but this might be useful in
192-
some cases, and is lighter-weight.
193-
"""
194-
195-
return self.__class__(self._hist.reduce(*args))
196-
197-
def project(self, *args):
198-
"""
199-
Project to a single axis or several axes on a multidiminsional histogram. Provided a list of axis numbers, this will produce the histogram over those axes only. Flow bins are used if available.
200-
"""
201-
202-
return self.__class__(self._hist.project(*args))
203-
204188
@inject_signature("self, *args, weight=None, sample=None")
205189
def fill(self, *args, **kwargs):
206190
"""
@@ -280,6 +264,20 @@ def _sum(self, flow=False):
280264
"""
281265
return self._hist.sum(flow)
282266

267+
def _reduce(self, *args):
268+
"""
269+
Reduce based on one or more reduce_option's.
270+
"""
271+
272+
return self.__class__(self._hist.reduce(*args))
273+
274+
def _project(self, *args):
275+
"""
276+
Project to a single axis or several axes on a multidiminsional histogram. Provided a list of axis numbers, this will produce the histogram over those axes only. Flow bins are used if available.
277+
"""
278+
279+
return self.__class__(self._hist.project(*args))
280+
283281

284282
class Histogram(BaseHistogram):
285283
@inject_signature("self, *axes, storage=Double()", locals={"Double": Double})
@@ -420,3 +418,17 @@ def __getitem__(self, index):
420418
def __setitem__(self, index, value):
421419
indexes = _compute_commonindex(self._hist, index, expand=True)
422420
self._hist._at_set(value, *indexes)
421+
422+
def reduce(self, *args):
423+
"""
424+
Reduce based on one or more reduce_option's. If you are operating on most or all of your axis, consider slicing with [] notation.
425+
"""
426+
427+
return self.__class__(self._hist.reduce(*args))
428+
429+
def project(self, *args):
430+
"""
431+
Project to a single axis or several axes on a multidiminsional histogram. Provided a list of axis numbers, this will produce the histogram over those axes only. Flow bins are used if available.
432+
"""
433+
434+
return self.__class__(self._hist.project(*args))

0 commit comments

Comments
 (0)