-
Notifications
You must be signed in to change notification settings - Fork 74
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
silx.gui.colors: Add "percentile" mode for autoscaling #4154
Conversation
It autoscales from 1st to 99th (nan)percentiles of data.
Adding PERCENTILE_1_99 to the tests would be a bonus. Look for STDDEV3 in the tests. |
Hi and thx for the feature. What do you mean by realistic data? Is that a specific use case or domain? Also a percentile is like a mean, it's a sort on the values of millions of pixels, right? The following this processes twice the same sort
Could you please check if numpy can do something faster the following way?
|
There is no specific usecase or domain. With "realistic" I mean that it works well on noisy data, data which has artefacts outside of the region of interest, or a simulation which has extreme values only in a very small ratio of pixels. Min/max scaling would scale to the extreme values and not provide good contrast on the "main" content. In other words, you get good linear contrast for the central 98% of the data. The extisting mean+-std method only works for values around one mean value. This doesn't apply to many imaging examples where you have a value range inside some min/max but said "extreme" values on top.
Simulation of Fresnel propagation without noise (min/max and percentile scaling): Noisy tomo reco: Admittedly not the most impressive examples. I'm on a conference without good access to real data. In any case, 1-99 percentile scaling is the go-to autowindow of everyone in my x-ray imaging / tomography bubble.
Yeah, numpy is indeed able to compute both percentiles simultaneously. This doesn't seem to be a recent addition so I'm not sure why I didn't use it so far. I changed the code to use it. |
Hi @clemisch, I've added some basic tests and reworked the code a bit, it's in this PR on your branch: clemisch#1 |
Add tests for percentile 1-99 autoscale + make percentile more resilient
Oh dang, I forgot to add the tests! Thank you for adding them, and props for committing into my branch despite my neglect 😲 |
It autoscales from 1st to 99th (nan)percentiles of the data. In my experience this usually gives a sensible value window for realistic data.