Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
PowerNorm: do not clip negative values#10234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
jklymak commentedJan 11, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Ummm.... I don't know who wrote I'd expect 0.5 to map to |
efiring commentedJan 11, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
jklymak commentedJan 11, 2018 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
In#7631: They do Unless I'm being stupid, I don't see that anyone looking at#1204 caught this or this was discussed, but I may have missed it. |
efiring commentedJan 11, 2018
Yes, it is equivalent to ((a - vmin) / (vmax - vmin))**gamma, so a plain Normalize is the case of gamma=1. This seems reasonable to me; we are not dealing with logs. It is consistent with the description of Gamma correction:https://en.wikipedia.org/wiki/Gamma_correction. First the data are linearly scaled to the 0-1 range based on specified vmin and vmax, and second, that 0-1 range is mapped to a new 0-1 range by raising it to a power. The puzzle to me is why the clipping was put there in the first place; it looks like confusion between the need for the second stage to be in the 0-1 range and the implementation, which put part of the clipping in the first stage--where it doesn't belong. I think this PR, removing that odd restriction of the original data to positive values, is doing the right thing. |
jklymak commentedJan 11, 2018
Of course@anntzer picked up on it in#7294 (comment) |
jklymak commentedJan 11, 2018
OK, but thats saying the scale should be the same if vmin=0, vmax=1, or if vmin = 10000 and vmax = 10001. A parabola x**2 has a very different slope at those two values. If the colorbar ticks go 0-1 I'd be fine with that, but they say 10000 to 10001, with the ticks quadratically spaced as if it were from 0 to 1. Thats seems pretty un-numerate to me. If the user wants to normalize between 0 and 1, they should do so and make the colorbar plotted as such. Not sure I get the analogy to gamma correction - thats mapping 0-1 to 0-1 isn't it? But hey, I never use |
jklymak commentedJan 11, 2018
Sorry, parting shot: If I had two axes that were side-by-side and each was power-norm 2, and one went from 0-10, and the other from 5-10, with the second one half as long as the first, I'd expect the spacing between 7 and 8 to be the same in each axis. |
aparamon commentedJan 12, 2018
@jklymak Indeed, The code expectedly outputs after the fix. The value of 0 is in no way special for the rest |
jklymak commentedJan 12, 2018
My point is that |
efiring commentedJan 12, 2018
@jklymak you are talking about a different sort of transform than what is implemented in PowerNorm. What is implemented is not going to be changed, with the likely exception of this PR. If you see a compelling use case for the version you are describing, then it will need a different PR and a different name. |
jklymak commentedJan 12, 2018
Fair enough. Suggest docs change to make the order of operations explicit: |
aparamon commentedJan 12, 2018
Sorry for inaccuracy: |
efiring commentedJan 13, 2018
By all means, making it clear in the docstring exactly what PowerNorm does would be an important addition to this PR. |
jklymak commentedMay 25, 2018
ping! Is this still active? I think this normalization is mathematically wrong-headed, but at least lets document it properly! |
aparamon commentedJun 18, 2018
Are there any show-stoppers left to get the pull request accepted? (are any additional changes expected from my part?) |
efiring commentedJun 18, 2018
It needs to pass the tests. |
tacaswell commentedJul 9, 2018
I am confused by this, it looks like it does still clip negative values to 0... |
jklymak commentedJul 9, 2018
Yes, after the norm has been applied. Thats desirable (vmin maps to zero) |
efiring commentedJul 10, 2018
I was wondering about that also--instead of clipping, should the values be "bad" (out of range?) so they would be colored as such? |
jklymak commentedJul 10, 2018
@efiring I always forget how the out of range stuff works. What gets put in if data is out of range? I didn't quickly find an answer (ahem Documentation issue). Note that I don't think LogNorm puts data out of range, it just clips.... |
PR Summary
Do not clip negative values in PowerNorm, consistently with LogNorm.
PowerNorm can now be used with offset data.