fix: clamp log scale for negative/zero values, add symlog scaling, and add contrast-aware ticks to colorbar#47
Conversation
7af37a1 to
0af8ee5
Compare
… LUT preset application order
0af8ee5 to
d370e18
Compare
| raw_ticks = np.array(powers) | ||
| elif scale == "symlog": | ||
|
|
||
| def transform(x, th): |
There was a problem hiding this comment.
Why are you making snap, transform and inverse closures?
There was a problem hiding this comment.
I thought transform and inverse are pretty simple and only used in snap. and I think snap falls through like it was a private method, but all could be private methods so it's up to you.
There was a problem hiding this comment.
Since they don't use sibling variable, I think it is better to have them defined once rather than recreating them each time the main method execute.
| ctf = self.lut.GetClientSideObject() | ||
| self.config.effective_color_range = ctf.GetRange() | ||
|
|
||
| self.config.lut_img = lut_to_img(self.lut) |
There was a problem hiding this comment.
Don't you want to capture the image when it is still linear?
There was a problem hiding this comment.
I don’t think so. lut_img is meant to reflect the actual LUT state that the mapper will use, including inversion and any log / symlog remapping, not the intermediate linear preset.
There was a problem hiding this comment.
no it is not linear, it is either linear, log, or symlog, depending on the branching before you hit line 178.
There was a problem hiding this comment.
You see the picture/colors does not change, but the ticks do.
Which also mean that when you reduce the number of colors, they need to be evenly spread on the non linear scale.
|
|
||
| self.render() | ||
|
|
||
| def _apply_linear_to_lut(self, invert=False): |
There was a problem hiding this comment.
Maybe those methods could be in some other module so you can use them in both view_manager(2).py
There was a problem hiding this comment.
I was thinking that view_manager2.py would be moved to view_manager.py once you fixed the issues. I can't imagine both living for an extended period. the methods won't get reused after that.
There was a problem hiding this comment.
Ok so that means the ticks are linear (to some extent)?
There was a problem hiding this comment.
huh? I think this is a new topic.
There was a problem hiding this comment.
I think the comment Ok so that means the ticks are linear (to some extent)? was related to the image linear generation part... I don't know why it is showing up here... Sorry... Airport reviews ;-)
There was a problem hiding this comment.
_apply_linear_to_lut simply applies the preset again. and yes the interpolation is always linear between control points on the presets.
There was a problem hiding this comment.
I was thinking that view_manager2.py would be moved to view_manager.py once you fixed the issues. I can't imagine both living for an extended period. the methods won't get reused after that.
Correct, but since there was one working and the other one not working during the rendering weirdness. We currently have a flag that let you pick one or the other. I actually don't know how long I want/should to keep both.
|
I think the code looks pretty good and it looks like we could merge it and iterate from that point on. But maybe, let's centralize those new color handling helpers first. |

Clamp log scale for negative and zero values, add symlog scaling, and add nice color-appropriate ticks to the color legend.
Addresses #18