Added comparison function as histogram operation (with colorized + info based string return)#763
Added comparison function as histogram operation (with colorized + info based string return)#763gohil-jay wants to merge 28 commits intoscikit-hep:developfrom
Conversation
gohil-jay
commented
Jul 1, 2022

| if (list(self.axes)==list(hist2.axes)): | ||
| return "" | ||
| else: | ||
| return "The axes [" + "\033[91m" + str(list(self.axes)) + " and " + str(list(hist2.axes)) + "\033[0m" + "] are not equal." |
There was a problem hiding this comment.
| return "The axes [" + "\033[91m" + str(list(self.axes)) + " and " + str(list(hist2.axes)) + "\033[0m" + "] are not equal." | |
| return f"The axes [\033[91m{list(self.axes)} and {list(hist2.axes)}\033[0m] are not equal." |
F-strings were made for this. :) Also I'd pull out the color formatting into a variable, like red and reset. Actually, there are lots of concerns with color formatting (needs to be disablable and such), at least rich can auto-format this, so probably leave the color formatting off for the moment.
There was a problem hiding this comment.
I bet if you do import rich; rich.print(h.compare(h2)) this would still be colorful. ;)
There was a problem hiding this comment.
Yes I was going to do something similar (with termcolor), but then though I'd do it without importing a library..
|
@henryiii, pre-commit throws few errors... Any feedback/suggestion? |
|
It's complaining because you are using the result of re.search without checking to see if it has a result first. I think the best fix, though, is to use |
|
I've been looking for something like |
Redefined storage check & removed variance check (as variances is based on values that are already checked)
|
Seems alright now (?) |
|
Note: the goal is to support |