Skip to content

Conversation

kadrlica
Copy link
Contributor

@rhl this is my first attempt at implementing a facility to allow the user to set the image colormap (#1 and DM-15182. Some notes:

  • I've implemented both public (setImageColormap) and protected (_setImageColormap) methods with the idea that the public method would be eventually moved upstream to afwDisplay. (I'm not sure about the naming convention because the preceding function, show_colorbar, does not seem to conform with other methods in Display.)
  • I've inserted a stand-in for testing this facility in test_display_matplotlib.py. The test is currently commented out because I'm not sure whether we want to handle the creation of the display in setUp.

@kadrlica
Copy link
Contributor Author

Also pinging @jdswinbank since this is an example for a community PR.

@kadrlica
Copy link
Contributor Author

Usage example:

# Use lsst.afw.display with the matplotlib backend
import lsst.afw.display      as afwDisplay
afwDisplay.setDefaultBackend('matplotlib')

plt.figure(figsize=(10,10))
afw_display = afwDisplay.Display(1)
afw_display.setImageColormap('gray_r')
afw_display.scale('asinh', 'zscale')
afw_display.mtv(calexp.maskedImage)
plt.gca().axis('off')

which produces
image

@jdswinbank
Copy link
Contributor

Thank you for this! I've moved it onto a DM branch in #8, and have asked @RobertLuptonTheGood to review it there.

Since this is a small patch, I don't think it's enough to give you a copyright claim on the code. However, if you disagree, let me know and provide an appropriate copyright statement (see https://developer.lsst.io/legal/copyright-overview.html#copyright-holders for more).

@jdswinbank jdswinbank closed this Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants