Closed henryiii closed 4 years ago
You are right, this should be added. Perhaps not too hard to implement on top of what we have...
These are good ideas, but I wouldn't take it as far as adding spacers. When you need a spacer, you might be better off just using the other type of interface. I like that the rule for 1D is no longer special, that's very nice thinking.
Closed in develop
Currently, there are two forms for each reducer, one that takes an axis number and works in ND histograms, and one that does not take an axis and only works in 1D. This could be generalized fairly naturally, I believe, to ND as well:
would be supported in if
h
is a 2D histogram. If it was not a 2D, this would throw an exception, as it does now. Thenh1.reduce(rebin(2))
is no longer a special case, but just the 1D form of the above rule.[^1]rebin(1)
This would add one of the benefits of the Python's UHI system (easy per-axis application) without adding new syntax, just generalizing a current one. This has a readability benefit, as you are guaranteed to see what happens on each axis.
Thoughts? Is this possible/reasonable/a good idea?
[^1]: Currently, for 1D histograms, listing multiple reducers without an axis is supported, and they all apply to axis 0. This could become a special case for 1D to preserve backward compatibility.