Invert color scale of cutout images using afwDisplay


I’m using display = afwDisplay.Display(frame=fig) to display a cutout image. I defined the scale of the image using display.scale(“asinh”, “zscale”). I’m trying to invert the zscale so that the darker regions are bright and the brighter regions are dark.

I’ve looked on this resource on lsst.afw.display (Getting started tutorial part 3: displaying exposures and source tables output by single frame processing — LSST Science Pipelines) but when the scale is defined there isn’t any information on how to invert it.

Does anyone have any insight into this problem?

Hi @dehiggin,
You could try using the setImageColormap function (defined here) to change the color map such that the inverted version is used.

For example, if you are using the notebook DP02_03a_Image_Display_and_Manipulation, you can invert the colors of the image in Sec 3.1 by modifying the cell as follows:

fig = plt.figure()
display = afwDisplay.Display(frame=fig)
display.scale('asinh', 'zscale')

Note that the added line was display.setImageColormap("gray_r"), where “_r” should invert the color map used. And I believe “gray” is the default colormap.