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
If these are the same length, then each histogram should get scaled (and other operations). Also true for inplace. Maybe dicts should be supported too?
Projections
Operations on a stack should fall through to the histogram, such as projection.
stack=hist.stack("cat")
new_stack=stack.project("x")
# Should be the same asnew_stack=hist.project("cat", "x").stack("cat")
This probably should go for other operations - slicing would be very nice, but does interfere with accessing the stack itself. Maybe we could have a proxy object? Say stack.hists* would apply an operation on every histogram. So stack.hists[0:2] would take [0:2] on every histogram in the stack and return a new stack? If it returns a simple number, then I guess it returns a list? That's a little more irritation statically, though. stack.list*, perhaps, would always return a list?
Setting
The stacks are not settable, they store tuples and have no setter. This should work:
stack[0] *=2
The internal storage should be a list, and setting should make sure the new histogram matches the old one in axes. All the histogram mul/add/sub operations should work, including in place ones.
Other
I'm still not very happy with *args being the constructor for Stack, as things like Stack(x for x in xs) is not easy to write (and mappings are also not supported). But maybe too late to change. Tempting to allow both to work if args len is 1 and not an instance of a BaseHistogram.
The text was updated successfully, but these errors were encountered:
Several improvements to Stacks should be added.
Scaling
This maybe should work:
If these are the same length, then each histogram should get scaled (and other operations). Also true for inplace. Maybe dicts should be supported too?
Projections
Operations on a stack should fall through to the histogram, such as projection.
This probably should go for other operations - slicing would be very nice, but does interfere with accessing the stack itself. Maybe we could have a proxy object? Say
stack.hists*
would apply an operation on every histogram. Sostack.hists[0:2]
would take[0:2]
on every histogram in the stack and return a new stack? If it returns a simple number, then I guess it returns a list? That's a little more irritation statically, though.stack.list*
, perhaps, would always return a list?Setting
The stacks are not settable, they store tuples and have no setter. This should work:
The internal storage should be a list, and setting should make sure the new histogram matches the old one in axes. All the histogram mul/add/sub operations should work, including in place ones.
Other
I'm still not very happy with
*args
being the constructor for Stack, as things likeStack(x for x in xs)
is not easy to write (and mappings are also not supported). But maybe too late to change. Tempting to allow both to work if args len is 1 and not an instance of a BaseHistogram.The text was updated successfully, but these errors were encountered: