Closed bmorris3 closed 4 months ago
The TestCompositeArray.test_cmap_blending
failure looks related?
It is related, I'm working on it.
@bmorris3 - have you had a chance to look into the failures? This seems fine to me otherwise and would be happy to try and get this merged in soon.
@astrofrog – as I mentioned on Slack, I could use some help on that.
@bmorris3 - ok sounds good, will take a look
@bmorris3 - I think the failure should be fixed, let's see if the CI agrees. I think the next step will be to figure out how to expose the opt-in part in the public API so that jdaviz doesn't depend on private API. It might make sense to have a callback property on the image viewer state that controls this (we don't have to expose it in the Qt UI, just on the state class).
In https://github.com/glue-viz/glue/pull/2427, we intentionally ensured that image layers had only one alpha. The
set_bad([color, alpha])
feature in matplotlib colormaps allows a distinct alpha for “bad” values, which is a really useful feature. This PR allows layers to render colormaps that have "bad" values rendered with their own alpha (possibly distinct from the alpha for pixels that are not "bad"). This feature is implemented with an opt-in flag on theCompositeArray
object.Here's an example of how to use it, with jdaviz:
where the "bad" pixels here are rendered with
alpha=0
, and the others withlayer.alpha
. The current behavior on main default behavior can be shown by settinglayer_artist.axes._composite._allow_bad_alpha = False
:where the
layer.alpha
is identical to the alpha of every pixel, regardless of thebad
settings in the matplotlib colormap.