You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful to have an integrate function, which could be used to do the following:
Remove a single axis from a histogram, reducing its dimension by 1: h.integrate("y")
Integrate over a range of an axis: h.integrate("y", i, j)
Sum certain entries from a category axis: h.integrate("y", ["cats", "dogs"])
Currently it is possible to do all of these things, however the syntax is unclear and there are a number of pitfalls:
Can reasonably easily be achieved with h[{"y": sum}] or h[{"y": slice(None, None, sum)}], though would be nice to add for completeness.
Can be achieved with h[{"y": slice(i, j, sum)}], however the more obvious h[:, i:j]["y": sum] will give the wrong result, since sum includes the overflow as noted here: [BUG] Sum of sliced histogram boost-histogram#621
For this, the corresponding h[{"y": ["cats", "dogs"]}][{"y": sum}] almost works, as with this slice any other categories don't seem to be added to the overflow. However, if the overflow already contains entries, these will be added to the sum, so seemingly the only way to get the correct result is to do the sum by hand: h[{"y": "cats"}]+h[{"y": "dogs"}] which could quickly become laborious. (Could be done as h[{"y": ["cats", "dogs"]}][{"y": slice(0, len, sum)}])
Linked to this issue, it would be helpful if one could specify whether to include the overflows when projecting out axes using the project method, which if adding a new function is not desired, would at least make some other work-arounds easier.
The text was updated successfully, but these errors were encountered:
It would be useful to have an integrate function, which could be used to do the following:
h.integrate("y")
h.integrate("y", i, j)
h.integrate("y", ["cats", "dogs"])
Currently it is possible to do all of these things, however the syntax is unclear and there are a number of pitfalls:
h[{"y": sum}]
orh[{"y": slice(None, None, sum)}]
, though would be nice to add for completeness.h[{"y": slice(i, j, sum)}]
, however the more obvioush[:, i:j]["y": sum]
will give the wrong result, sincesum
includes the overflow as noted here: [BUG] Sum of sliced histogram boost-histogram#621h[{"y": ["cats", "dogs"]}][{"y": sum}]
almost works, as with this slice any other categories don't seem to be added to the overflow. However, if the overflow already contains entries, these will be added to the sum, so seemingly the only way to get the correct result is to do the sum by hand:h[{"y": "cats"}]+h[{"y": "dogs"}]
which could quickly become laborious. (Could be done ash[{"y": ["cats", "dogs"]}][{"y": slice(0, len, sum)}]
)Linked to this issue, it would be helpful if one could specify whether to include the overflows when projecting out axes using the
project
method, which if adding a new function is not desired, would at least make some other work-arounds easier.The text was updated successfully, but these errors were encountered: