Uh oh!
There was an error while loading. Please reload this page.
Fix/norm inputs - #693
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
cvanelteren
commented
Apr 20, 2026
@gepcel@munechika-koyo can this be merged? |
| @pytest.mark.parametrize( | ||
| "norm", | ||
| ["linear", ["linear"], ("linear",)], |
There was a problem hiding this comment.
| ["linear", ["linear"], ("linear",)], | |
| ["linear", "log", ["linear"], ("linear",)], |
What about trying a different norm?
There was a problem hiding this comment.
We could; I am currently just testing against the explicit inputs which are str, list or tuple
There was a problem hiding this comment.
I understand that we conducted the type testing there.
It is probably confirmed somewhere that parsing a string and converting it into the corresponding normalizer is possible, so it might not be necessary here.
There was a problem hiding this comment.
I added this test
@pytest.mark.parametrize("norm", [uplt.DiscreteNorm, uplt.colors.mcolors.Normalize])deftest_normalize_types(norm):
data=np.random.rand(10, 10)
target=normprint(norm)
ifnormisuplt.DiscreteNorm:
norm=uplt.DiscreteNorm(levels=[0, 1])
discrete=Trueelifnormisuplt.colors.mcolors.Normalize:
norm=uplt.colors.mcolors.Normalize(vmin=0, vmax=1)
discrete=Falseelse:
raiseValueError("Norm not understood.")
fig, ax=uplt.subplots()
cm=ax.pcolormesh(data, norm=norm, discrete=discrete)
assertisinstance(cm.norm, target)Uh oh!
There was an error while loading. Please reload this page.
Closes#689
When vmin, vmax is given, norms should not be allowed as inputs (as they are part of the norm object). When strings are given, however, we must allow the logic to run.